[moves] Two new pawn move tests
This commit is contained in:
parent
faca844733
commit
2c6a7828bc
1 changed files with 39 additions and 1 deletions
|
@ -6,7 +6,7 @@ use super::GeneratedMove;
|
||||||
use crate::{Move, PromotionShape};
|
use crate::{Move, PromotionShape};
|
||||||
use chessfriend_bitboard::{bit_scanner::TrailingBitScanner, BitBoard};
|
use chessfriend_bitboard::{bit_scanner::TrailingBitScanner, BitBoard};
|
||||||
use chessfriend_board::Board;
|
use chessfriend_board::Board;
|
||||||
use chessfriend_core::{Color, Direction, Rank, Shape, Square};
|
use chessfriend_core::{Color, Direction, Rank, Square};
|
||||||
use std::slice;
|
use std::slice;
|
||||||
|
|
||||||
pub struct PawnMoveGenerator {
|
pub struct PawnMoveGenerator {
|
||||||
|
@ -364,6 +364,44 @@ mod tests {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn white_f6_right_captures() {
|
||||||
|
let white_captures_board = test_board!(White Pawn on F6, Black Queen on G7);
|
||||||
|
let generated_moves: HashSet<GeneratedMove> =
|
||||||
|
PawnMoveGenerator::new(&white_captures_board, Some(Color::White)).collect();
|
||||||
|
assert_eq!(
|
||||||
|
generated_moves,
|
||||||
|
[
|
||||||
|
GeneratedMove {
|
||||||
|
ply: Move::capture(Square::F6, Square::G7)
|
||||||
|
},
|
||||||
|
GeneratedMove {
|
||||||
|
ply: Move::quiet(Square::F6, Square::F7)
|
||||||
|
}
|
||||||
|
]
|
||||||
|
.into()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn black_d5_right_captures() {
|
||||||
|
let black_captures_board = test_board!(Black Pawn on D5, White Queen on C4);
|
||||||
|
let generated_moves: HashSet<GeneratedMove> =
|
||||||
|
PawnMoveGenerator::new(&black_captures_board, Some(Color::Black)).collect();
|
||||||
|
assert_eq!(
|
||||||
|
generated_moves,
|
||||||
|
[
|
||||||
|
GeneratedMove {
|
||||||
|
ply: Move::capture(Square::D5, Square::C4)
|
||||||
|
},
|
||||||
|
GeneratedMove {
|
||||||
|
ply: Move::quiet(Square::D5, Square::D4)
|
||||||
|
}
|
||||||
|
]
|
||||||
|
.into()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn white_g7_push_promotions() {
|
fn white_g7_push_promotions() {
|
||||||
let board = test_board!(White Pawn on G7);
|
let board = test_board!(White Pawn on G7);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue