tests: update reference value in THT diode bridge rectifier test

This commit is contained in:
Mikolaj Wielgus 2024-08-25 23:49:10 +02:00
parent 817fd5e57f
commit 31bc9a9447
2 changed files with 10 additions and 4 deletions

View File

@ -145,12 +145,18 @@ pub fn assert_band_length(
board: &Board<impl AccessMesadata>, board: &Board<impl AccessMesadata>,
source: &str, source: &str,
target: &str, target: &str,
length: f64, expected_length: f64,
epsilon: f64, rel_err: f64,
) { ) {
let band = board.band_between_pins(source, target).unwrap(); let band = board.band_between_pins(source, target).unwrap();
let band_length = band.0.ref_(board.layout().drawing()).length(); 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<impl AccessMesadata>) -> UnionFind<NodeIndex<usize>> { fn unionfind(autorouter: &mut Autorouter<impl AccessMesadata>) -> UnionFind<NodeIndex<usize>> {

View File

@ -38,7 +38,7 @@ fn test_tht_diode_bridge_rectifier() {
common::assert_single_layer_groundless_autoroute(&mut autorouter, "F.Cu"); common::assert_single_layer_groundless_autoroute(&mut autorouter, "F.Cu");
//common::assert_number_of_conncomps(&mut autorouter, 4); //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 mut invoker = Invoker::new(autorouter);
let result = invoker.execute(Command::PlaceVia(ViaWeight { let result = invoker.execute(Command::PlaceVia(ViaWeight {