From a390c67e4f41cd6fb4beaaa667da49e2cf347b5c Mon Sep 17 00:00:00 2001 From: Mikolaj Wielgus Date: Wed, 17 Sep 2025 11:32:32 +0200 Subject: [PATCH] test: Split test_tht_de9_to_tht_de9 into two test routines to measure speed better --- tests/common/mod.rs | 3 +++ tests/single_layer.rs | 15 +++++++++++---- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/tests/common/mod.rs b/tests/common/mod.rs index 18036b8..c687061 100644 --- a/tests/common/mod.rs +++ b/tests/common/mod.rs @@ -48,7 +48,10 @@ pub fn replay_and_assert(invoker: &mut Invoker, filename: &str let history: History = serde_json::from_reader(file).unwrap(); invoker.replay(history); + assert_undo_redo_replay(invoker, filename); +} +pub fn assert_undo_redo_replay(invoker: &mut Invoker, filename: &str) { let prev_node_count = invoker.autorouter().board().layout().drawing().node_count(); // Sanity test: check if node count remained the same after some attempts at undo-redo. diff --git a/tests/single_layer.rs b/tests/single_layer.rs index d962ced..3b82e58 100644 --- a/tests/single_layer.rs +++ b/tests/single_layer.rs @@ -15,7 +15,7 @@ use topola::{ mod common; #[test] -fn test_tht_de9_to_tht_de9() { +fn test_tht_de9_to_tht_de9_in_order() { let autorouter = common::load_design("tests/single_layer/tht_de9_to_tht_de9/tht_de9_to_tht_de9.dsn"); let mut invoker = common::create_invoker_and_assert(autorouter); @@ -24,16 +24,23 @@ fn test_tht_de9_to_tht_de9() { "tests/single_layer/tht_de9_to_tht_de9/autoroute_all_in_an_order.cmd", ); - let (mut autorouter, history, ..) = invoker.dissolve(); - + let (mut autorouter, ..) = invoker.dissolve(); common::assert_single_layer_groundless_autoroute(&mut autorouter, "F.Cu"); +} - invoker = Invoker::new_with_history(autorouter, history); +#[test] +fn test_tht_de9_to_tht_de9() { + let autorouter = + common::load_design("tests/single_layer/tht_de9_to_tht_de9/tht_de9_to_tht_de9.dsn"); + let mut invoker = common::create_invoker_and_assert(autorouter); common::undo_all_and_assert(&mut invoker); common::replay_and_assert( &mut invoker, "tests/single_layer/tht_de9_to_tht_de9/autoroute_all.cmd", ); + + let (mut autorouter, ..) = invoker.dissolve(); + common::assert_single_layer_groundless_autoroute(&mut autorouter, "F.Cu"); } #[test]