aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authoreug-vs <eugene@eug-vs.xyz>2023-01-23 14:10:44 +0300
committereug-vs <eugene@eug-vs.xyz>2023-01-23 14:10:44 +0300
commit2238b6eecdf01cfce6dfbfc785c2a35850595f55 (patch)
tree0576b4ee485991e0ae3b86925d6ea274974a92d7 /src
parent95b3c67b6e142d8e7ee5a4384a75d43777647153 (diff)
downloadchessnost-2238b6eecdf01cfce6dfbfc785c2a35850595f55.tar.gz
test: add position perft
Diffstat (limited to 'src')
-rw-r--r--src/board.rs9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/board.rs b/src/board.rs
index eea60fe..efe0b80 100644
--- a/src/board.rs
+++ b/src/board.rs
@@ -619,6 +619,15 @@ mod tests {
}
#[test]
+ fn test_position_perft() {
+ let fen = String::from("r3k2r/p1ppqpb1/bn2pnp1/3PN3/1p2P3/2N2Q1p/PPPBBPPP/R3K2R w KQkq - ");
+ let mut board = Board::from_FEN(fen);
+ assert_eq!(board.perft(0, false), (1, 0, 0, 0));
+ assert_eq!(board.perft(1, false), (48, 8, 0, 0));
+ assert_eq!(board.perft(2, false), (2039, 351, 3, 1));
+ }
+
+ #[test]
fn test_is_square_attacked() {
let board = Board::new();