Skip to content

Commit

Permalink
updating unit test for routine return value.
Browse files Browse the repository at this point in the history
  • Loading branch information
weinbe58 committed Sep 29, 2023
1 parent 30fc63a commit dd3eedb
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions tests/test_builder_factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
Field,
Uniform,
)
from bloqade.ir.routine.params import Params
from bloqade.ir.routine.base import Routine
from bloqade.ir.routine.params import Params
import numpy as np


Expand Down Expand Up @@ -89,7 +89,7 @@ def delta(t, amp, omega):
batch_params = [{"omega": omega} for omega in [1, 2, 4, 8]]
args = ["run_time"]

prog = rydberg_h(
routine = rydberg_h(
register,
detuning=delta,
amplitude=ampl,
Expand All @@ -108,12 +108,23 @@ def delta(t, amp, omega):
)
sequence = Sequence({rydberg: pulse})

routine = prog.parse()
source = (
register.rydberg.detuning.uniform.apply(delta)
.amplitude.uniform.apply(ampl)
.phase.uniform.apply(phase)
.assign(**static_params)
.batch_assign(batch_params)
.args(args)
)

circuit = AnalogCircuit(register, sequence)
params = Params(static_params, batch_params, args)
expected_routine = Routine(source, circuit, params)

assert routine == Routine(prog, circuit, params)
# ignore because no equality implemented
# assert routine.source == expected_routine.source
assert routine.circuit == expected_routine.circuit
assert routine.params == expected_routine.params


def test_rydberg_h_2():
Expand Down

0 comments on commit dd3eedb

Please sign in to comment.