Skip to content

Commit 22f788a

Browse files
committed
adding test
1 parent 629a844 commit 22f788a

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

test/qasm2/test_lowering.py

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

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

@@ -20,3 +22,26 @@
2022
ast = qasm2.parse.loads(lines)
2123
code = QASM2(qasm2.main).run(ast)
2224
code.print()
25+
26+
27+
def test_inline():
28+
29+
def import_qasm(qasm2_prog):
30+
@qasm2.main.add(qasm2.inline_)
31+
def entry():
32+
qasm2.inline(qasm2_prog)
33+
34+
return q # noqa: F821
35+
36+
return entry
37+
38+
test_qasm = """// Generated from Cirq v1.4.1
39+
OPENQASM 2.0;
40+
include "qelib1.inc";
41+
// Qubits: [q_0, q_1, q_2, q_3, q_4, q_5]
42+
qreg q[6];
43+
u3(pi*0.9999896015,pi*1.8867094803,pi*0.1132905197) q[2];
44+
"""
45+
46+
kernel = import_qasm(test_qasm)
47+
assert isinstance(kernel, ir.Method)

0 commit comments

Comments
 (0)