cleanup board tests

This commit is contained in:
Simon Gardling 2025-02-19 13:29:35 -05:00
parent b2b5fb9e2c
commit 1061292409
Signed by: titaniumtown
GPG Key ID: 9AB28AC10ECE533D

View File

@ -95,6 +95,7 @@ lazy_static! {
pub struct Board {
/// [`BitBoard`] containing all white pieces
white_board: BitBoard,
/// [`BitBoard`] containing all black pieces
black_board: BitBoard,
}
@ -274,6 +275,7 @@ impl Board {
// if overlapping chains were to exist, `self.place_unchecked` could collide with `self.get`
(*(self as *const Self)).propegate_from_dry(i, j, starting_color)
};
let mut count = 0;
for &(i, j) in iterator {
self.place_unchecked(i, j, starting_color);
@ -356,9 +358,9 @@ mod test {
let mut board = Board::new();
board.place_unchecked(0, 0, Piece::Black);
board.place_unchecked(0, 1, Piece::White);
board.place_unchecked(0, 2, Piece::Black);
board.propegate_from(0, 2);
assert_eq!(board.place(0, 2, Piece::Black), Ok(()));
assert_eq!(board.get(0, 1), Some(Piece::Black));
}
@ -367,11 +369,10 @@ mod test {
let mut board = Board::new();
board.place_unchecked(0, 0, Piece::Black);
board.place_unchecked(0, 2, Piece::White);
board.place_unchecked(0, 3, Piece::Black);
board.propegate_from(0, 3);
// should fail
assert_ne!(board.place(0, 3, Piece::Black), Ok(()));
assert_eq!(
board.get(0, 1),
@ -390,8 +391,7 @@ mod test {
board.place_unchecked(0, j, Piece::White);
}
board.place_unchecked(0, 7, Piece::Black);
board.propegate_from(0, 7);
assert_eq!(board.place(0, 7, Piece::Black), Ok(()));
for j in 2..=6 {
assert_eq!(