diff --git a/docs/source/advanced_usage.rst b/docs/source/advanced_usage.rst index 1312d9d15..2a653ae1f 100644 --- a/docs/source/advanced_usage.rst +++ b/docs/source/advanced_usage.rst @@ -411,8 +411,8 @@ method. # Declare our memory spaces branching_prog = Program() - test_register = branching_prog.declare('test_register', 'BIT') ro = branching_prog.declare('ro', 'BIT') + test_register = branching_prog.declare('test_register', 'BIT') # Construct each branch of our if-statement. We can have empty branches # simply by having empty programs. diff --git a/test/unit/__snapshots__/test_quil.ambr b/test/unit/__snapshots__/test_quil.ambr index a0ea5ad94..c1cea031b 100644 --- a/test/unit/__snapshots__/test_quil.ambr +++ b/test/unit/__snapshots__/test_quil.ambr @@ -30,6 +30,15 @@ ''' # --- +# name: test_classical_regs + ''' + DECLARE reg BIT[2] + DECLARE ro BIT[2] + X 0 + MEASURE 0 reg[1] + + ''' +# --- # name: test_construction_syntax ''' DECLARE ro BIT[2] @@ -338,13 +347,13 @@ # --- # name: test_prog_merge.1 ''' - DEFGATE PERM AS PERMUTATION: - 0, 1, 3, 2 - DEFGATE test AS MATRIX: 1, 0 0, 1 + DEFGATE PERM AS PERMUTATION: + 0, 1, 3, 2 + X 0 test 0 PERM 0 1 diff --git a/test/unit/test_quil.py b/test/unit/test_quil.py index 482a52e2f..da19fb9fb 100644 --- a/test/unit/test_quil.py +++ b/test/unit/test_quil.py @@ -316,14 +316,14 @@ def test_prog_init(snapshot): assert p.out() == snapshot -def test_classical_regs(): +def test_classical_regs(snapshot: SnapshotAssertion): p = Program() p.inst( - Declare("ro", "BIT", 2), Declare("reg", "BIT", 2), + Declare("ro", "BIT", 2), X(0), ).measure(0, MemoryReference("reg", 1)) - assert p.out() == "DECLARE reg BIT[2]\nDECLARE ro BIT[2]\nX 0\nMEASURE 0 reg[1]\n" + assert p.out() == snapshot assert p.declarations == { "reg": Declare("reg", "BIT", 2), "ro": Declare("ro", "BIT", 2), diff --git a/test/unit/test_rewrite_arithmetic.py b/test/unit/test_rewrite_arithmetic.py index 896428a59..0e803c410 100644 --- a/test/unit/test_rewrite_arithmetic.py +++ b/test/unit/test_rewrite_arithmetic.py @@ -58,14 +58,13 @@ def test_rewrite_arithmetic_mixed(): ParameterAref(index=1, name="__P2"): "(beta[0] + theta[0])/(2*pi)", } assert ( - response.quil - == Program( + Program(response.quil) == Program( "DECLARE __P2 REAL[2]", "DECLARE theta REAL[1]", "DECLARE beta REAL[1]", "RZ(__P2[0]) 0", "RZ(__P2[1]) 0", - ).out() + ) )