From a9040d0bd34a2ee706d8523bbc4702c61b2a67b2 Mon Sep 17 00:00:00 2001 From: Mikolaj Wielgus Date: Mon, 17 Nov 2025 01:27:08 +0100 Subject: [PATCH] test: Add automatic test routine for tht_db25_to_tht_db25 test --- tests/unilayer.rs | 163 ++++--- .../tht_db25_to_tht_db25/autoroute_all.cmd | 425 ++++++++++++++++++ 2 files changed, 503 insertions(+), 85 deletions(-) create mode 100644 tests/unilayer/tht_db25_to_tht_db25/autoroute_all.cmd diff --git a/tests/unilayer.rs b/tests/unilayer.rs index 23a8202..aadc400 100644 --- a/tests/unilayer.rs +++ b/tests/unilayer.rs @@ -22,6 +22,42 @@ mod common; #[case::with_undo_redo_replay("with_undo_redo_replay")] fn test_master(#[case] variant: &str) {} +#[apply(test_master)] +fn autoroute_0603_breakout(variant: &str) { + let mut autorouter = common::load_design("tests/unilayer/0603_breakout/0603_breakout.dsn"); + common::assert_layer_0_navnode_count(&mut autorouter, "R1-2", "J1-2", 22); + let mut invoker = common::create_invoker_and_assert(autorouter); + common::replay_and_assert_and_report( + &mut invoker, + "tests/unilayer/0603_breakout/autoroute_all.cmd", + variant, + ); + + let (mut autorouter, ..) = invoker.dissolve(); + + common::assert_that_all_ratlines_besides_gnd_are_autorouted(&mut autorouter); + //common::assert_number_of_conncomps(&mut autorouter, 2); +} + +#[apply(test_master)] +fn autoroute_4x_3rd_order_smd_lc_filters(variant: &str) { + let mut autorouter = common::load_design( + "tests/unilayer/4x_3rd_order_smd_lc_filters/4x_3rd_order_smd_lc_filters.dsn", + ); + common::assert_layer_0_navnode_count(&mut autorouter, "J1-1", "L1-1", 558); + let mut invoker = common::create_invoker_and_assert(autorouter); + common::replay_and_assert_and_report( + &mut invoker, + "tests/unilayer/4x_3rd_order_smd_lc_filters/autoroute_signals.cmd", + variant, + ); + + let (mut autorouter, ..) = invoker.dissolve(); + + common::assert_that_all_ratlines_besides_gnd_are_autorouted(&mut autorouter); + //common::assert_number_of_conncomps(&mut autorouter, 16); +} + #[apply(test_master)] fn autoroute_4x4_1206_led_matrix_breakout(variant: &str) { let autorouter = common::load_design( @@ -54,6 +90,42 @@ fn autoroute_4x4_1206_led_matrix_breakout_in_predefined_order(variant: &str) { common::assert_that_all_ratlines_besides_gnd_are_autorouted(&mut autorouter); } +#[apply(test_master)] +fn autoroute_smd_non_rectangular_buck_converter(variant: &str) { + let path = + "tests/unilayer/smd_non_rectangular_buck_converter/smd_non_rectangular_buck_converter.dsn"; + let autorouter = common::load_design(&path); + + let mut invoker = common::create_invoker_and_assert(autorouter); + + common::replay_and_assert_and_report( + &mut invoker, + "tests/unilayer/smd_non_rectangular_buck_converter/route_all.cmd", + variant, + ); + + let (mut autorouter, ..) = invoker.dissolve(); + + common::assert_that_all_ratlines_besides_gnd_are_autorouted(&mut autorouter); + //common::assert_number_of_conncomps(&mut autorouter, 16); +} + +#[apply(test_master)] +fn autoroute_tht_db25_to_tht_db25(variant: &str) { + let autorouter = + common::load_design("tests/unilayer/tht_db25_to_tht_db25/tht_db25_to_tht_db25.dsn"); + let mut invoker = common::create_invoker_and_assert(autorouter); + common::undo_all_and_assert(&mut invoker); + common::replay_and_assert_and_report( + &mut invoker, + "tests/unilayer/tht_db25_to_tht_db25/autoroute_all.cmd", + variant, + ); + + let (mut autorouter, ..) = invoker.dissolve(); + common::assert_that_all_ratlines_besides_gnd_are_autorouted(&mut autorouter); +} + #[apply(test_master)] fn autoroute_tht_de9_to_tht_de9(variant: &str) { let autorouter = @@ -85,23 +157,6 @@ fn autoroute_tht_de9_to_tht_de9_in_predefined_order(variant: &str) { common::assert_that_all_ratlines_besides_gnd_are_autorouted(&mut autorouter); } -#[apply(test_master)] -fn autoroute_0603_breakout(variant: &str) { - let mut autorouter = common::load_design("tests/unilayer/0603_breakout/0603_breakout.dsn"); - common::assert_layer_0_navnode_count(&mut autorouter, "R1-2", "J1-2", 22); - let mut invoker = common::create_invoker_and_assert(autorouter); - common::replay_and_assert_and_report( - &mut invoker, - "tests/unilayer/0603_breakout/autoroute_all.cmd", - variant, - ); - - let (mut autorouter, ..) = invoker.dissolve(); - - common::assert_that_all_ratlines_besides_gnd_are_autorouted(&mut autorouter); - //common::assert_number_of_conncomps(&mut autorouter, 2); -} - #[apply(test_master)] fn autoroute_tht_diode_bridge_rectifier(variant: &str) { let mut autorouter = common::load_design( @@ -140,47 +195,23 @@ fn autoroute_tht_diode_bridge_rectifier(variant: &str) { } #[apply(test_master)] -fn autoroute_4x_3rd_order_smd_lc_filters(variant: &str) { - let mut autorouter = common::load_design( - "tests/unilayer/4x_3rd_order_smd_lc_filters/4x_3rd_order_smd_lc_filters.dsn", - ); - common::assert_layer_0_navnode_count(&mut autorouter, "J1-1", "L1-1", 558); +fn autoroute_triangle_problem(variant: &str) { + let path = "tests/unilayer/triangle_problem/triangle_problem.dsn"; + let autorouter = common::load_design(&path); + let mut invoker = common::create_invoker_and_assert(autorouter); + common::replay_and_assert_and_report( &mut invoker, - "tests/unilayer/4x_3rd_order_smd_lc_filters/autoroute_signals.cmd", + "tests/unilayer/triangle_problem/route_all.cmd", variant, ); let (mut autorouter, ..) = invoker.dissolve(); common::assert_that_all_ratlines_besides_gnd_are_autorouted(&mut autorouter); - //common::assert_number_of_conncomps(&mut autorouter, 16); } -// FIXME: This test fails indeterministically. -// NOTE: Disabled until determinism is fixed. -//#[test] -/*#[allow(unused)] -#[case("")] -#[case("with_undo_redo_replay")] -fn test_tht_3pin_xlr_to_tht_3pin_xlr(#[case] variant: &str) { - let mut autorouter = common::load_design( - "tests/unilayer/tht_3pin_xlr_to_tht_3pin_xlr/tht_3pin_xlr_to_tht_3pin_xlr.dsn", - ); - //common::assert_navnode_count(&mut autorouter, "R1-2", "J1-2", ?); - let mut invoker = common::create_invoker_and_assert(autorouter); - common::replay_and_assert_and_report( - &mut invoker, - "tests/unilayer/tht_3pin_xlr_to_tht_3pin_xlr/autoroute_all.cmd", - "undo_redo_replay", - ); - - let (mut autorouter, ..) = invoker.dissolve(); - - common::assert_that_all_unilayer_groundless_ratlines_are_autorouted(&mut autorouter, "F.Cu"); -}*/ - #[apply(test_master)] fn autoroute_vga_dac_breakout(variant: &str) { let mut autorouter = @@ -197,41 +228,3 @@ fn autoroute_vga_dac_breakout(variant: &str) { common::assert_that_all_ratlines_besides_gnd_are_autorouted(&mut autorouter); } - -#[apply(test_master)] -fn autoroute_smd_non_rectangular_buck_converter(variant: &str) { - let path = - "tests/unilayer/smd_non_rectangular_buck_converter/smd_non_rectangular_buck_converter.dsn"; - let autorouter = common::load_design(&path); - - let mut invoker = common::create_invoker_and_assert(autorouter); - - common::replay_and_assert_and_report( - &mut invoker, - "tests/unilayer/smd_non_rectangular_buck_converter/route_all.cmd", - variant, - ); - - let (mut autorouter, ..) = invoker.dissolve(); - - common::assert_that_all_ratlines_besides_gnd_are_autorouted(&mut autorouter); - //common::assert_number_of_conncomps(&mut autorouter, 16); -} - -#[apply(test_master)] -fn autoroute_triangle_problem(variant: &str) { - let path = "tests/unilayer/triangle_problem/triangle_problem.dsn"; - let autorouter = common::load_design(&path); - - let mut invoker = common::create_invoker_and_assert(autorouter); - - common::replay_and_assert_and_report( - &mut invoker, - "tests/unilayer/triangle_problem/route_all.cmd", - variant, - ); - - let (mut autorouter, ..) = invoker.dissolve(); - - common::assert_that_all_ratlines_besides_gnd_are_autorouted(&mut autorouter); -} diff --git a/tests/unilayer/tht_db25_to_tht_db25/autoroute_all.cmd b/tests/unilayer/tht_db25_to_tht_db25/autoroute_all.cmd new file mode 100644 index 0000000..fbd4777 --- /dev/null +++ b/tests/unilayer/tht_db25_to_tht_db25/autoroute_all.cmd @@ -0,0 +1,425 @@ +{ + "done": [ + { + "Autoroute": [ + [ + { + "pin": "J1-1", + "layer": "B.Cu" + }, + { + "pin": "J1-1", + "layer": "F.Cu" + }, + { + "pin": "J1-10", + "layer": "B.Cu" + }, + { + "pin": "J1-10", + "layer": "F.Cu" + }, + { + "pin": "J1-11", + "layer": "B.Cu" + }, + { + "pin": "J1-11", + "layer": "F.Cu" + }, + { + "pin": "J1-12", + "layer": "B.Cu" + }, + { + "pin": "J1-12", + "layer": "F.Cu" + }, + { + "pin": "J1-13", + "layer": "B.Cu" + }, + { + "pin": "J1-13", + "layer": "F.Cu" + }, + { + "pin": "J1-14", + "layer": "B.Cu" + }, + { + "pin": "J1-14", + "layer": "F.Cu" + }, + { + "pin": "J1-15", + "layer": "B.Cu" + }, + { + "pin": "J1-15", + "layer": "F.Cu" + }, + { + "pin": "J1-16", + "layer": "B.Cu" + }, + { + "pin": "J1-16", + "layer": "F.Cu" + }, + { + "pin": "J1-17", + "layer": "B.Cu" + }, + { + "pin": "J1-17", + "layer": "F.Cu" + }, + { + "pin": "J1-18", + "layer": "B.Cu" + }, + { + "pin": "J1-18", + "layer": "F.Cu" + }, + { + "pin": "J1-19", + "layer": "B.Cu" + }, + { + "pin": "J1-19", + "layer": "F.Cu" + }, + { + "pin": "J1-2", + "layer": "B.Cu" + }, + { + "pin": "J1-2", + "layer": "F.Cu" + }, + { + "pin": "J1-20", + "layer": "B.Cu" + }, + { + "pin": "J1-20", + "layer": "F.Cu" + }, + { + "pin": "J1-21", + "layer": "B.Cu" + }, + { + "pin": "J1-21", + "layer": "F.Cu" + }, + { + "pin": "J1-22", + "layer": "B.Cu" + }, + { + "pin": "J1-22", + "layer": "F.Cu" + }, + { + "pin": "J1-23", + "layer": "B.Cu" + }, + { + "pin": "J1-23", + "layer": "F.Cu" + }, + { + "pin": "J1-24", + "layer": "B.Cu" + }, + { + "pin": "J1-24", + "layer": "F.Cu" + }, + { + "pin": "J1-25", + "layer": "B.Cu" + }, + { + "pin": "J1-25", + "layer": "F.Cu" + }, + { + "pin": "J1-3", + "layer": "B.Cu" + }, + { + "pin": "J1-3", + "layer": "F.Cu" + }, + { + "pin": "J1-4", + "layer": "B.Cu" + }, + { + "pin": "J1-4", + "layer": "F.Cu" + }, + { + "pin": "J1-5", + "layer": "B.Cu" + }, + { + "pin": "J1-5", + "layer": "F.Cu" + }, + { + "pin": "J1-6", + "layer": "B.Cu" + }, + { + "pin": "J1-6", + "layer": "F.Cu" + }, + { + "pin": "J1-7", + "layer": "B.Cu" + }, + { + "pin": "J1-7", + "layer": "F.Cu" + }, + { + "pin": "J1-8", + "layer": "B.Cu" + }, + { + "pin": "J1-8", + "layer": "F.Cu" + }, + { + "pin": "J1-9", + "layer": "B.Cu" + }, + { + "pin": "J1-9", + "layer": "F.Cu" + }, + { + "pin": "J2-1", + "layer": "B.Cu" + }, + { + "pin": "J2-1", + "layer": "F.Cu" + }, + { + "pin": "J2-10", + "layer": "B.Cu" + }, + { + "pin": "J2-10", + "layer": "F.Cu" + }, + { + "pin": "J2-11", + "layer": "B.Cu" + }, + { + "pin": "J2-11", + "layer": "F.Cu" + }, + { + "pin": "J2-12", + "layer": "B.Cu" + }, + { + "pin": "J2-12", + "layer": "F.Cu" + }, + { + "pin": "J2-13", + "layer": "B.Cu" + }, + { + "pin": "J2-13", + "layer": "F.Cu" + }, + { + "pin": "J2-14", + "layer": "B.Cu" + }, + { + "pin": "J2-14", + "layer": "F.Cu" + }, + { + "pin": "J2-15", + "layer": "B.Cu" + }, + { + "pin": "J2-15", + "layer": "F.Cu" + }, + { + "pin": "J2-16", + "layer": "B.Cu" + }, + { + "pin": "J2-16", + "layer": "F.Cu" + }, + { + "pin": "J2-17", + "layer": "B.Cu" + }, + { + "pin": "J2-17", + "layer": "F.Cu" + }, + { + "pin": "J2-18", + "layer": "B.Cu" + }, + { + "pin": "J2-18", + "layer": "F.Cu" + }, + { + "pin": "J2-19", + "layer": "B.Cu" + }, + { + "pin": "J2-19", + "layer": "F.Cu" + }, + { + "pin": "J2-2", + "layer": "B.Cu" + }, + { + "pin": "J2-2", + "layer": "F.Cu" + }, + { + "pin": "J2-20", + "layer": "B.Cu" + }, + { + "pin": "J2-20", + "layer": "F.Cu" + }, + { + "pin": "J2-21", + "layer": "B.Cu" + }, + { + "pin": "J2-21", + "layer": "F.Cu" + }, + { + "pin": "J2-22", + "layer": "B.Cu" + }, + { + "pin": "J2-22", + "layer": "F.Cu" + }, + { + "pin": "J2-23", + "layer": "B.Cu" + }, + { + "pin": "J2-23", + "layer": "F.Cu" + }, + { + "pin": "J2-24", + "layer": "B.Cu" + }, + { + "pin": "J2-24", + "layer": "F.Cu" + }, + { + "pin": "J2-25", + "layer": "B.Cu" + }, + { + "pin": "J2-25", + "layer": "F.Cu" + }, + { + "pin": "J2-3", + "layer": "B.Cu" + }, + { + "pin": "J2-3", + "layer": "F.Cu" + }, + { + "pin": "J2-4", + "layer": "B.Cu" + }, + { + "pin": "J2-4", + "layer": "F.Cu" + }, + { + "pin": "J2-5", + "layer": "B.Cu" + }, + { + "pin": "J2-5", + "layer": "F.Cu" + }, + { + "pin": "J2-6", + "layer": "B.Cu" + }, + { + "pin": "J2-6", + "layer": "F.Cu" + }, + { + "pin": "J2-7", + "layer": "B.Cu" + }, + { + "pin": "J2-7", + "layer": "F.Cu" + }, + { + "pin": "J2-8", + "layer": "B.Cu" + }, + { + "pin": "J2-8", + "layer": "F.Cu" + }, + { + "pin": "J2-9", + "layer": "B.Cu" + }, + { + "pin": "J2-9", + "layer": "F.Cu" + } + ], + { + "principal_layer": 0, + "presort_by": "RatlineIntersectionCountAndLength", + "permutate": true, + "router": { + "routed_band_width": 100.0, + "wrap_around_bands": true, + "squeeze_through_under_bends": true + }, + "timeout": { + "initial": 1.0, + "progress_bonus": 0.005 + } + } + ] + } + ], + "undone": [] +} \ No newline at end of file