Skip to content

Commit

Permalink
[Bind2] Update XMR tests
Browse files Browse the repository at this point in the history
Updates XMR tests to avoid setting instances as attributes on top-level
circuits.
  • Loading branch information
rsetaluri committed Mar 23, 2023
1 parent 7a339d3 commit 65940f6
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions tests/test_bind2.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,14 @@ class TopBasicAsserts(m.Circuit):


@pytest.mark.parametrize(
"backend,flatten_all_tuples",
"backend,flatten_all_tuples,inst_attr",
(
("mlir", True),
("mlir", False),
("mlir", False, False),
("mlir", True, False),
("mlir", True, True),
)
)
def test_xmr(backend, flatten_all_tuples):
def test_xmr(backend, flatten_all_tuples, inst_attr):

class T(m.Product):
x = m.Bit
Expand All @@ -80,8 +81,12 @@ class Middle(m.Circuit):

class Top(m.Circuit):
io = m.IO(I=m.In(T), O=m.Out(T))
middle = Middle(name="middle")
io.O @= middle(io.I)
if inst_attr:
middle = Middle(name="middle")
O = middle(io.I)
else:
O = Middle(name="middle")(io.I)
io.O @= O

class TopXMRAsserts(m.Circuit):
name = f"TopXMRAsserts_{backend}"
Expand Down

0 comments on commit 65940f6

Please sign in to comment.