From c3e45da6364af8b0aa0b2331a5d2991f6c9e224d Mon Sep 17 00:00:00 2001 From: eug-vs Date: Thu, 26 Jan 2023 22:03:24 +0300 Subject: test: add endgame position perft test --- src/board/engine.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) 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 @@ -349,6 +349,16 @@ mod tests { // assert_eq!(board.perft(4, false), PerftResult { leaf_nodes: 4085603, captures: 757163, en_passants: 1929, castles: 128013, checks: 25523 }); } + #[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(); -- cgit v1.2.3