Use 'ChessBoardBuilder' in checkers test
This commit is contained in:
parent
37a6862dda
commit
f1468334e1
|
@ -711,40 +711,19 @@ mod test {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn checkers() {
|
fn checkers() {
|
||||||
let position = ChessBoard {
|
let position = {
|
||||||
piece_occupancy: [
|
let mut builder = ChessBoardBuilder::new();
|
||||||
// King
|
builder[Square::C1] = Some((Piece::Knight, Color::White));
|
||||||
Square::E2 | Square::E8,
|
builder[Square::D3] = Some((Piece::Bishop, Color::White));
|
||||||
// Queen
|
builder[Square::E1] = Some((Piece::Rook, Color::White));
|
||||||
Square::E7 | Square::H2,
|
builder[Square::E2] = Some((Piece::King, Color::White));
|
||||||
// Rook
|
builder[Square::H2] = Some((Piece::Queen, Color::White));
|
||||||
Square::A2 | Square::E1,
|
builder[Square::G1] = Some((Piece::Knight, Color::Black));
|
||||||
// Bishop
|
builder[Square::F3] = Some((Piece::Bishop, Color::Black));
|
||||||
Square::D3 | Square::F3,
|
builder[Square::A2] = Some((Piece::Rook, Color::Black));
|
||||||
// Knight
|
builder[Square::E8] = Some((Piece::King, Color::Black));
|
||||||
Square::C1 | Square::G1,
|
builder[Square::E7] = Some((Piece::Queen, Color::Black));
|
||||||
// Pawn
|
TryInto::<ChessBoard>::try_into(builder).unwrap()
|
||||||
Bitboard::EMPTY,
|
|
||||||
],
|
|
||||||
color_occupancy: [
|
|
||||||
Square::C1 | Square::D3 | Square::E1 | Square::E2 | Square::H2,
|
|
||||||
Square::A2 | Square::E7 | Square::E8 | Square::F3 | Square::G1,
|
|
||||||
],
|
|
||||||
combined_occupancy: Square::A2
|
|
||||||
| Square::C1
|
|
||||||
| Square::D3
|
|
||||||
| Square::E1
|
|
||||||
| Square::E2
|
|
||||||
| Square::E7
|
|
||||||
| Square::E8
|
|
||||||
| Square::F3
|
|
||||||
| Square::G1
|
|
||||||
| Square::H2,
|
|
||||||
castle_rights: [CastleRights::NoSide; Color::NUM_VARIANTS],
|
|
||||||
en_passant: None,
|
|
||||||
half_move_clock: 0,
|
|
||||||
total_plies: 0,
|
|
||||||
side: Color::White,
|
|
||||||
};
|
};
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
position.checkers(),
|
position.checkers(),
|
||||||
|
|
Loading…
Reference in a new issue