Skip to content

Commit

Permalink
adding unit tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
weinbe58 committed Sep 27, 2023
1 parent 024031d commit ea31aba
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions tests/test_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
# import bloqade.builder.backend as builder_backend
import bloqade.ir.routine.quera as quera
import bloqade.ir.routine.braket as braket
from plum import NotFoundLookupError

from bloqade.ir.control.waveform import instruction
from bloqade.ir import rydberg, detuning, hyperfine, rabi
Expand Down Expand Up @@ -67,16 +68,25 @@ def test_add_position_dispatch():
position = np.array([[1, 2], [3, 4]])
position_list = list(map(tuple, position.tolist()))

a = start.add_position(position)
b = start.add_position(position_list)
c = start.add_position(position_list[0]).add_position(position_list[1])
a = start.add_position(position, np.array([True, False]))
b = start.add_position(position_list, [True, False])
c = start.add_position(position_list[0]).add_position(position_list[1], False)

assert a.location_list == b.location_list
assert a.location_list == c.location_list

with pytest.raises(AssertionError):
start.add_position(position_list, [True])

with pytest.raises(NotFoundLookupError):
start.add_position(position_list, True)

with pytest.raises(NotFoundLookupError):
start.add_position(position_list, np.array([True, True]))

with pytest.raises(NotFoundLookupError):
start.add_position(position, [True, True])


def test_piecewise_const():
prog = start.rydberg.detuning.uniform.piecewise_constant(
Expand Down

0 comments on commit ea31aba

Please sign in to comment.