diff --git a/tests/common/mod.rs b/tests/common/mod.rs index 49660db..10a6150 100644 --- a/tests/common/mod.rs +++ b/tests/common/mod.rs @@ -145,12 +145,18 @@ pub fn assert_band_length( board: &Board, source: &str, target: &str, - length: f64, - epsilon: f64, + expected_length: f64, + rel_err: f64, ) { let band = board.band_between_pins(source, target).unwrap(); let band_length = band.0.ref_(board.layout().drawing()).length(); - assert!((band_length - length).abs() < epsilon); + assert!( + (band_length - expected_length).abs() < expected_length * rel_err, + "band_length = {}, expected_length = {}, epsilon = {}", + band_length, + expected_length, + rel_err + ); } fn unionfind(autorouter: &mut Autorouter) -> UnionFind> { diff --git a/tests/single_layer.rs b/tests/single_layer.rs index 4c583a8..12361af 100644 --- a/tests/single_layer.rs +++ b/tests/single_layer.rs @@ -38,7 +38,7 @@ fn test_tht_diode_bridge_rectifier() { common::assert_single_layer_groundless_autoroute(&mut autorouter, "F.Cu"); //common::assert_number_of_conncomps(&mut autorouter, 4); - common::assert_band_length(autorouter.board(), "J2-2", "D4-2", 15500.0, 0.5); + common::assert_band_length(autorouter.board(), "J2-2", "D4-2", 15900.0, 0.01); let mut invoker = Invoker::new(autorouter); let result = invoker.execute(Command::PlaceVia(ViaWeight {