Skip to content

Commit

Permalink
* More tests
Browse files Browse the repository at this point in the history
Signed-off-by: Pradnya Khalate <[email protected]>
  • Loading branch information
khalatepradnya committed Nov 23, 2024
1 parent e05a249 commit f6bea16
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions python/tests/backends/test_braket.py
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,36 @@ def kernel(qubit_count: int):
assert "1111" in counts


def test_qvector_slicing():

@cudaq.kernel
def kernel():
q = cudaq.qvector(4)
x(q.front(2))
mz(q)

## error: 'quake.subveq' op unable to translate op to OpenQASM 2.0
with pytest.raises(RuntimeError) as e:
cudaq.sample(kernel, shots_count=100).dump()
assert "Could not successfully translate to qasm2" in repr(e)


def test_mid_circuit_measurement():

@cudaq.kernel
def simple():
q = cudaq.qvector(2)
h(q[0])
if mz(q[0]):
x(q[1])
mz(q)

## error: 'cf.cond_br' op unable to translate op to OpenQASM 2.0
with pytest.raises(RuntimeError) as e:
cudaq.sample(simple, shots_count=100).dump()
assert "Could not successfully translate to qasm2" in repr(e)


@pytest.mark.parametrize("device_arn", [
"arn:aws:braket:::device/quantum-simulator/amazon/dm1",
"arn:aws:braket:::device/quantum-simulator/amazon/tn1"
Expand Down

0 comments on commit f6bea16

Please sign in to comment.