Skip to content

Commit 573d0ba

Browse files
authored
test: Add coverage for Badger split circuit multi-threading (#505)
Coverage checks for #495 showed a hole in coverage for the Badger optimiser, when using multi-threading with circuit splitting. This PR fixes this.
1 parent 32a9885 commit 573d0ba

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

tket2/src/optimiser/badger.rs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -656,6 +656,27 @@ mod tests {
656656
opt_rz.hugr_mut().update_validate(&REGISTRY).unwrap();
657657
}
658658

659+
#[rstest]
660+
#[case::compiled(badger_opt_compiled())]
661+
#[case::json(badger_opt_json())]
662+
fn rz_rz_cancellation_split_parallel(
663+
rz_rz: Circuit,
664+
#[case] badger_opt: DefaultBadgerOptimiser,
665+
) {
666+
let mut opt_rz = badger_opt.optimise(
667+
&rz_rz,
668+
BadgerOptions {
669+
timeout: Some(0),
670+
n_threads: 2.try_into().unwrap(),
671+
queue_size: 4,
672+
split_circuit: true,
673+
..Default::default()
674+
},
675+
);
676+
opt_rz.hugr_mut().update_validate(&REGISTRY).unwrap();
677+
assert_eq!(opt_rz.commands().count(), 2);
678+
}
679+
659680
#[rstest]
660681
#[ignore = "Loading the ECC set is really slow (~5 seconds)"]
661682
fn non_composable_rewrites(

0 commit comments

Comments
 (0)