Skip to content

Commit 551723e

Browse files
committed
adding test
1 parent 0160210 commit 551723e

File tree

1 file changed

+16
-3
lines changed

1 file changed

+16
-3
lines changed

test/qasm2/test_lowering.py

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import textwrap
22

3+
from kirin.dialects import func
4+
35
from bloqade import qasm2
46
from bloqade.qasm2.parse.lowering import QASM2
57

@@ -17,6 +19,17 @@
1719
rx(pi/2) q[0];
1820
"""
1921
)
20-
ast = qasm2.parse.loads(lines)
21-
code = QASM2(qasm2.main).run(ast)
22-
code.print()
22+
23+
24+
def test_run_lowering():
25+
ast = qasm2.parse.loads(lines)
26+
code = QASM2(qasm2.main).run(ast)
27+
code.print()
28+
29+
30+
def test_loads():
31+
32+
kernel = QASM2(qasm2.main).loads(lines, "test", returns="c")
33+
qasm2.main.run_pass(kernel) # type: ignore
34+
assert isinstance((ret := kernel.callable_region.blocks[0].last_stmt), func.Return)
35+
assert ret.value.type.is_equal(qasm2.types.CRegType)

0 commit comments

Comments
 (0)