test: Split test_tht_de9_to_tht_de9 into two test routines to measure speed better

This commit is contained in:
Mikolaj Wielgus 2025-09-17 11:32:32 +02:00
parent 59cd745332
commit a390c67e4f
2 changed files with 14 additions and 4 deletions

View File

@ -48,7 +48,10 @@ pub fn replay_and_assert(invoker: &mut Invoker<SpecctraMesadata>, 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<SpecctraMesadata>, 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.

View File

@ -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]