Skip to content

Commit

Permalink
test(phirgen): add testcase for regwise op with int
Browse files Browse the repository at this point in the history
Closes: #88
  • Loading branch information
qartik committed Jan 17, 2024
1 parent 1ec0de1 commit e604c7d
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions tests/test_phirgen.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,16 @@ def test_nested_arith(self) -> None:
"returns": ["c"],
"args": [{"cop": "+", "args": ["a", {"cop": "/", "args": ["b", "c"]}]}],
}

def test_arith_with_int(self) -> None:
"""From https://github.com/CQCL/pytket-phir/issues/88."""
circ = Circuit(1)
a = circ.add_c_register("a", 2)
circ.add_classicalexpbox_register(a << 1, a.to_list())

phir = json.loads(pytket_to_phir(circ))
assert phir["ops"][2] == {
"cop": "=",
"returns": ["a"],
"args": [{"cop": "<<", "args": ["a", 1]}],
}

0 comments on commit e604c7d

Please sign in to comment.