[moves] Add several macros to help with testing: ply! and assert_move_list!

ply! implements a small DSL for writing moves in code using a natural-ish
algebraic notation.

assert_move_list! takes a generator and an expected list of moves and asserts
that they're equal. This macro is mostly a copy from one I wrote earlier in the
position crate.
This commit is contained in:
Eryn Wells 2025-05-25 11:04:49 -07:00
parent 09bf17d66b
commit 3f3842c7c8
4 changed files with 90 additions and 0 deletions

View file

@ -2,6 +2,9 @@
mod pawn;
#[cfg(test)]
mod testing;
pub use pawn::PawnMoveGenerator;
use crate::Move;
@ -11,6 +14,12 @@ pub struct GeneratedMove {
pub(crate) ply: Move,
}
impl std::fmt::Display for GeneratedMove {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
self.ply.fmt(f)
}
}
impl From<Move> for GeneratedMove {
fn from(value: Move) -> Self {
GeneratedMove { ply: value }