Sfoglia il codice sorgente

Test failing :(

master
Pete Shadbolt 8 anni fa
parent
commit
b280709ee8
1 ha cambiato i file con 32 aggiunte e 0 eliminazioni
  1. +32
    -0
      tests/test_against_anders_and_briegel.py

+ 32
- 0
tests/test_against_anders_and_briegel.py Vedi File

@@ -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


Loading…
Annulla
Salva