Skip to content

Commit

Permalink
test: Add coverage for Badger split circuit multi-threading (#505)
Browse files Browse the repository at this point in the history
Coverage checks for #495 showed a hole in coverage for the Badger
optimiser, when using multi-threading with circuit splitting. This PR
fixes this.
  • Loading branch information
lmondada committed Jul 24, 2024
1 parent 32a9885 commit 573d0ba
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions tket2/src/optimiser/badger.rs
Original file line number Diff line number Diff line change
Expand Up @@ -656,6 +656,27 @@ mod tests {
opt_rz.hugr_mut().update_validate(&REGISTRY).unwrap();
}

#[rstest]
#[case::compiled(badger_opt_compiled())]
#[case::json(badger_opt_json())]
fn rz_rz_cancellation_split_parallel(
rz_rz: Circuit,
#[case] badger_opt: DefaultBadgerOptimiser,
) {
let mut opt_rz = badger_opt.optimise(
&rz_rz,
BadgerOptions {
timeout: Some(0),
n_threads: 2.try_into().unwrap(),
queue_size: 4,
split_circuit: true,
..Default::default()
},
);
opt_rz.hugr_mut().update_validate(&REGISTRY).unwrap();
assert_eq!(opt_rz.commands().count(), 2);
}

#[rstest]
#[ignore = "Loading the ECC set is really slow (~5 seconds)"]
fn non_composable_rewrites(
Expand Down

0 comments on commit 573d0ba

Please sign in to comment.