[board] Add position::tests::rook_for_castle

This commit is contained in:
Eryn Wells 2024-01-21 10:39:24 -08:00
parent fa1c6b452e
commit 8835d8b40e
2 changed files with 20 additions and 2 deletions

View file

@ -239,7 +239,7 @@ impl fmt::Display for Position {
#[cfg(test)]
mod tests {
use crate::position;
use crate::{position, Castle, Color};
#[test]
fn king_is_in_check() {
@ -258,4 +258,22 @@ mod tests {
];
assert!(!pos.is_king_in_check());
}
#[test]
fn rook_for_castle() {
let pos = position![
White King on E1,
White Rook on H1,
White Rook on A1,
];
assert_eq!(
pos.rook_for_castle(Color::White, Castle::KingSide),
Some(piece!(White Rook on H1))
);
assert_eq!(
pos.rook_for_castle(Color::White, Castle::QueenSide),
Some(piece!(White Rook on A1))
);
}
}

View file

@ -230,7 +230,7 @@ mod tests {
#[macro_use]
mod knight {
use crate::{sight::Sight, Position};
use crate::sight::Sight;
sight_test!(
f6_knight,