Skip to content

Commit

Permalink
Add unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
rafaelha committed Aug 28, 2024
1 parent 3600f88 commit 8cf74db
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion tests/test_simplify.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@
from fractions import Fraction
from pyzx.generate import cliffordT
from pyzx.simplify import *
from pyzx.simplify import supplementarity_simp
from pyzx.simplify import supplementarity_simp, to_clifford_normal_form_graph
from pyzx import compare_tensors
from pyzx.generate import cliffordT

np: Optional[ModuleType]
try:
Expand Down Expand Up @@ -130,6 +132,13 @@ def test_full_reduce_with_h_box(self):
full_reduce(g)
self.assertTrue("Input graph is not a ZX-diagram" in str(context.exception))

def test_to_clifford_normal_form_graph(self):
for _ in range(10):
g = cliffordT(4, 20, p_t=0)
g0 = g.copy()
to_clifford_normal_form_graph(g)
self.assertTrue(compare_tensors(g0, g, preserve_scalar=True))


qasm_1 = """OPENQASM 2.0;
include "qelib1.inc";
Expand Down

0 comments on commit 8cf74db

Please sign in to comment.