use std::time::Instant; use astar_rust::algorithm_impl::search; use astar_rust::input_reader::{print_grid, read_grid_map}; #[test] fn astar_test_10_x_10() { for i in 1..100 + 1 { dynamic_grid_test(i) } } fn dynamic_grid_test(i: i32) { let file_path = String::from(format!("./../board_utility/{}.board", i)); let (test_cases, grid, show_grid) = read_grid_map(&file_path); let start = Instant::now(); println!("Board File: {}", i); for (counter, test_case) in test_cases.iter().enumerate() { let mut current_grid = grid.to_vec(); let start_of_test_case = Instant::now(); search(&mut current_grid, test_case.initial_position, test_case.goal); let search_function_in_micros = start_of_test_case.elapsed().as_micros() as f64; println!("Time Taken: {:?} microseconds, {:?} seconds", search_function_in_micros, search_function_in_micros / 1000000.); } let total_time_in_micros = start.elapsed().as_micros() as f64; println!("Total Time Taken: {:?} microseconds, {:?} seconds", total_time_in_micros, total_time_in_micros / 1000000.); }