Skip to content

Commit

Permalink
Added CY and CZ gates to test_abs2openqasm tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
alexfleury-sb committed Feb 17, 2022
1 parent eeefc2c commit e1a7f2c
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions tangelo/linq/tests/test_translator.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@

path_data = os.path.dirname(os.path.realpath(__file__)) + '/data'

gates = [Gate("H", 2), Gate("CNOT", 1, control=0), Gate("CNOT", 2, control=1), Gate("Y", 0), Gate("S", 0)]
gates = [Gate("H", 2), Gate("CNOT", 1, control=0), Gate("CY", 1, control=0), Gate("CZ", 1, control=0), Gate("CNOT", 2, control=1), Gate("Y", 0), Gate("S", 0)]
abs_circ = Circuit(gates) + Circuit([Gate("RX", 1, parameter=2.)])
multi_controlled_gates = [Gate("X", 0), Gate("X", 1), Gate("CX", target=2, control=[0, 1])]
abs_multi_circ = Circuit(multi_controlled_gates)
Expand Down Expand Up @@ -336,8 +336,9 @@ def test_abs2openqasm(self):
This test failing implies that either Qiskit QASM output has changed or that translate_qiskit fails
(the latter has its own tests)
"""
openqasm_circuit1 = '''OPENQASM 2.0;\ninclude "qelib1.inc";\nqreg q[3];\ncreg c[3];\nh q[2];\ncx q[0],q[1];\ncx '''\
'''q[1],q[2];\ny q[0];\ns q[0];\nrx(1.5) q[1];\nmeasure q[0] -> c[0];\n'''
openqasm_circuit1 = '''OPENQASM 2.0;\ninclude "qelib1.inc";\nqreg q[3];\ncreg c[3];\nh q[2];\ncx q[0],q[1];'''\
'''\ncy q[0],q[1];\ncz q[0],q[1];\ncx q[1],q[2];\ny q[0];\ns q[0];\nrx(1.5) q[1];'''\
'''\nmeasure q[0] -> c[0];\n'''
openqasm_circuit2 = translator.translate_openqasm(abs_circ_mixed)
print(openqasm_circuit2)

Expand Down

0 comments on commit e1a7f2c

Please sign in to comment.