[board, moves, position] Make the Peter Ellis Jones gotcha unit tests work

Move this file over to position/tests. That makes it an integration test, technically.
Update it to comply with the current API conventions. This is a pretty radical
change from when I first wrote these!

In the process of running these tests, I found a bug in my PawnMoveGenerator where
it was generating the origin squares for en passant captures incorrectly. Fix
those bugs and write two new tests to exercise those code paths.

One of the test_board! variants was setting .active_color instead of using the
setter. This is a build failure. Fix it.

Move the assert_move_list! macro to the moves crate. This is a more natural home
for it. Additionally, add assert_move_list_contains! and assert_move_list_does_not_contain!
to generate assertions that a collection of moves (anything that implements
.contains()) has or doesn't have a set of moves. Also remove formatted_move_list!,
which is no longer used.

All that done, make the tests pass!
This commit is contained in:
Eryn Wells 2025-06-06 21:45:07 -07:00
parent d7f426697d
commit 651c982ead
11 changed files with 316 additions and 315 deletions

View file

@ -32,7 +32,7 @@ macro_rules! test_board {
chessfriend_core::Square::$square,
$crate::PlacePieceStrategy::default());
)*
board.active_color = chessfriend_core::Color::$to_move;
board.set_active_color(chessfriend_core::Color::$to_move);
println!("{}", board.display());