[board, moves] Reorganize castling_right API on Board
Board::color_has_castling_right takes an Option<Color> which it unwraps. With that unwrapped Color, it can call… Board::color_has_castling_right_unwrapped, which performs the evaluation with a non-Option Color. Clean up some imports.
This commit is contained in:
parent
8dc1e859e0
commit
37cb9bcaa0
5 changed files with 28 additions and 19 deletions
|
@ -193,7 +193,7 @@ mod tests {
|
|||
use super::*;
|
||||
use crate::{MakeMove, Move, PromotionShape, ValidateMove};
|
||||
use chessfriend_board::test_board;
|
||||
use chessfriend_core::{piece, Color, Square, Wing};
|
||||
use chessfriend_core::{Color, Square, Wing, piece};
|
||||
|
||||
type TestResult = Result<(), Box<dyn std::error::Error>>;
|
||||
|
||||
|
@ -406,7 +406,7 @@ mod tests {
|
|||
assert_eq!(board.get_piece(Square::H1), None);
|
||||
assert_eq!(board.get_piece(Square::G1), Some(piece!(White King)));
|
||||
assert_eq!(board.get_piece(Square::F1), Some(piece!(White Rook)));
|
||||
assert!(!board.color_has_castling_right(Color::White, Wing::KingSide));
|
||||
assert!(!board.color_has_castling_right_unwrapped(Color::White, Wing::KingSide));
|
||||
|
||||
board.unmake_move(&record)?;
|
||||
|
||||
|
@ -438,7 +438,7 @@ mod tests {
|
|||
assert_eq!(board.get_piece(Square::A1), None);
|
||||
assert_eq!(board.get_piece(Square::C1), Some(piece!(White King)));
|
||||
assert_eq!(board.get_piece(Square::D1), Some(piece!(White Rook)));
|
||||
assert!(!board.color_has_castling_right(Color::White, Wing::QueenSide));
|
||||
assert!(!board.color_has_castling_right_unwrapped(Color::White, Wing::QueenSide));
|
||||
|
||||
board.unmake_move(&record)?;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue