added time move to tests

This commit is contained in:
andy 2021-07-13 14:20:33 +01:00
parent eb1a240bd7
commit ab0d0e5df3

View File

@ -235,13 +235,16 @@ fn insert_scores_one_take() {
#[cfg(feature = "time_ex")] #[cfg(feature = "time_ex")]
#[wasm_bindgen_test] #[wasm_bindgen_test]
fn tree_2_depth() { fn tree_depth() {
let iter = 3; let depth = 1;
let mut times = Vec::with_capacity(iter); let iter = 5;
for d in 1..8 {
log!("Testing depth {}", d);
for _ in 0..iter { for _ in 0..iter {
times.push(time_tree_gen(6)); time_get_move(d);
}
} }
} }
@ -259,6 +262,19 @@ fn time_tree_gen(depth: usize) {
web_sys::console::time_end_with_label("tree_timer"); web_sys::console::time_end_with_label("tree_timer");
} }
#[cfg(feature = "time_ex")]
fn time_get_move(depth: usize) {
web_sys::console::time_with_label("tree_timer");
let mut comp = Computer::new(depth, White);
let brd = Board::init_game(Board::new(8, 8, White), 3);
comp.get_move(brd);
web_sys::console::time_end_with_label("tree_timer");
}
// #[wasm_bindgen_test] // #[wasm_bindgen_test]
// fn tree_get_move() { // fn tree_get_move() {
// let mut brd = Board::new(5, 4, White); // let mut brd = Board::new(5, 4, White);