44from bloqade .squin import op , qubit , kernel
55from bloqade .analysis .measure_id import MeasurementIDAnalysis
66from bloqade .analysis .measure_id .lattice import (
7- NotMeasureId ,
87 MeasureIdBool ,
98 MeasureIdTuple ,
109 InvalidMeasureId ,
@@ -111,10 +110,15 @@ def test():
111110 HintConst (dialects = test .dialects ).unsafe_run (test )
112111 frame , _ = MeasurementIDAnalysis (test .dialects ).run_analysis (test )
113112
114- assert [frame .entries [result ] for result in results_at (test , 0 , 7 )] == [
115- NotMeasureId (),
116- MeasureIdTuple ((MeasureIdBool (idx = 1 ),)),
113+ # MeasureIdTuple(data=MeasureIdBool(idx=1),) should occur twice:
114+ # First from the measurement in the true branch, then
115+ # the result of the scf.IfElse itself
116+ analysis_results = [
117+ val
118+ for val in frame .entries .values ()
119+ if val == MeasureIdTuple (data = (MeasureIdBool (idx = 1 ),))
117120 ]
121+ assert len (analysis_results ) == 2
118122
119123
120124def test_scf_cond_false ():
@@ -136,10 +140,13 @@ def test():
136140 HintConst (dialects = test .dialects ).unsafe_run (test )
137141 frame , _ = MeasurementIDAnalysis (test .dialects ).run_analysis (test )
138142
139- assert [frame .entries [result ] for result in results_at (test , 0 , 7 )] == [
140- NotMeasureId (),
141- MeasureIdBool (idx = 1 ),
143+ # MeasureIdBool(idx=1) should occur twice:
144+ # First from the measurement in the false branch, then
145+ # the result of the scf.IfElse itself
146+ analysis_results = [
147+ val for val in frame .entries .values () if val == MeasureIdBool (idx = 1 )
142148 ]
149+ assert len (analysis_results ) == 2
143150
144151
145152def test_slice ():
0 commit comments