Bladeren bron

Test failing :(

master
Pete Shadbolt 8 jaren geleden
bovenliggende
commit
b280709ee8
1 gewijzigde bestanden met toevoegingen van 32 en 0 verwijderingen
  1. +32
    -0
      tests/test_against_anders_and_briegel.py

+ 32
- 0
tests/test_against_anders_and_briegel.py Bestand weergeven

@@ -1,5 +1,8 @@
from abp.graphstate import GraphState
from anders_briegel import graphsim
import random
import difflib
import re

def test_1():
N=10
@@ -17,3 +20,32 @@ def test_1():
b.act_cz(i, i+1)

assert a.get_adj_list() == b.adj_list()


def test_2():
N=10

a = graphsim.GraphRegister(N)
b = GraphState()

for i in range(N):
b.add_vertex(i)

for i in range(100):
if random.random()>0.5:
j = random.randint(0, N-1)
a.hadamard(j)
b.act_hadamard(j)
else:
q = random.randint(0, N-2)
a.cphase(q, q+1)
b.act_cz(q, q+1)

aa = a.get_adj_list()
bb = b.adj_list()
try:
assert re.sub("\\s", "", aa) == re.sub("\\s", "", bb)
except AssertionError:
print aa
print bb


Laden…
Annuleren
Opslaan