48 lines
2 KiB
Rust
48 lines
2 KiB
Rust
macro_rules! perft_test {
|
|
($name:ident, $fen:expr, $depth:expr, $expected:expr) => {
|
|
#[test]
|
|
fn $name() {
|
|
let result = chs::chess::perft::run_perft($fen, $depth, $expected);
|
|
assert!(result);
|
|
}
|
|
};
|
|
}
|
|
|
|
mod perft {
|
|
use chs::constants::*;
|
|
|
|
perft_test!(start_fen_depth_0, START_FEN, 0, 1);
|
|
perft_test!(start_fen_depth_1, START_FEN, 1, 20);
|
|
perft_test!(start_fen_depth_2, START_FEN, 2, 400);
|
|
perft_test!(start_fen_depth_3, START_FEN, 3, 8_902);
|
|
perft_test!(start_fen_depth_4, START_FEN, 4, 197_281);
|
|
perft_test!(start_fen_depth_5, START_FEN, 5, 4_865_609);
|
|
|
|
perft_test!(position_2_depth_1, POSITION_2, 1, 48);
|
|
perft_test!(position_2_depth_2, POSITION_2, 2, 2_039);
|
|
perft_test!(position_2_depth_3, POSITION_2, 3, 97_862);
|
|
perft_test!(position_2_depth_4, POSITION_2, 4, 4_085_603);
|
|
|
|
perft_test!(position_3_depth_1, POSITION_3, 1, 14);
|
|
perft_test!(position_3_depth_2, POSITION_3, 2, 191);
|
|
perft_test!(position_3_depth_3, POSITION_3, 3, 2_812);
|
|
perft_test!(position_3_depth_4, POSITION_3, 4, 43_238);
|
|
perft_test!(position_3_depth_5, POSITION_3, 5, 674_624);
|
|
perft_test!(position_3_depth_6, POSITION_3, 6, 11_030_083);
|
|
|
|
perft_test!(position_4_depth_1, POSITION_4, 1, 6);
|
|
perft_test!(position_4_depth_2, POSITION_4, 2, 264);
|
|
perft_test!(position_4_depth_3, POSITION_4, 3, 9_467);
|
|
perft_test!(position_4_depth_4, POSITION_4, 4, 422_333);
|
|
perft_test!(position_4_depth_5, POSITION_4, 5, 15_833_292);
|
|
|
|
perft_test!(position_5_depth_1, POSITION_5, 1, 44);
|
|
perft_test!(position_5_depth_2, POSITION_5, 2, 1_486);
|
|
perft_test!(position_5_depth_3, POSITION_5, 3, 62_379);
|
|
perft_test!(position_5_depth_4, POSITION_5, 4, 2_103_487);
|
|
|
|
perft_test!(position_6_depth_1, POSITION_6, 1, 46);
|
|
perft_test!(position_6_depth_2, POSITION_6, 2, 2_079);
|
|
perft_test!(position_6_depth_3, POSITION_6, 3, 89_890);
|
|
perft_test!(position_6_depth_4, POSITION_6, 4, 3_894_594);
|
|
}
|