diff options
author | eug-vs <eugene@eug-vs.xyz> | 2023-01-26 22:03:24 +0300 |
---|---|---|
committer | eug-vs <eugene@eug-vs.xyz> | 2023-01-26 22:03:24 +0300 |
commit | c3e45da6364af8b0aa0b2331a5d2991f6c9e224d (patch) | |
tree | d7dd041db85a75fe92a4c42215d2e8a39ee6577f /src/board | |
parent | d0840175c37d0e1041e279bd85b4106015bfd5e4 (diff) | |
download | chessnost-c3e45da6364af8b0aa0b2331a5d2991f6c9e224d.tar.gz |
test: add endgame position perft test
Diffstat (limited to 'src/board')
-rw-r--r-- | src/board/engine.rs | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/board/engine.rs b/src/board/engine.rs index 2aa8e28..ceee108 100644 --- a/src/board/engine.rs +++ b/src/board/engine.rs @@ -350,6 +350,16 @@ mod tests { } #[test] + fn endgame_perft() { + let fen = String::from("8/2p5/3p4/KP5r/1R3p1k/8/4P1P1/8 w - - "); + let mut board = Board::from_FEN(fen); + + assert_eq!(board.perft(1, false), PerftResult { leaf_nodes: 14, captures: 1, en_passants: 0, castles: 0 , checks: 2 }); + assert_eq!(board.perft(2, false), PerftResult { leaf_nodes: 191, captures: 14, en_passants: 0, castles: 0 , checks: 10 }); + // assert_eq!(board.perft(3, false), PerftResult { leaf_nodes: 2182, captures: 209, en_passants: 2, castles: 0 , checks: 267 }); + } + + #[test] fn material_advantage() { let board = Board::new(); assert_eq!(board.material_advantage(), 0.0, "Material advantage should be 0 at starting position"); |