[board] Implement a test_position macro that prints a Position after it builds it

Update the sight tests to use test_position!
Remove a stray leftover mut.
Clean up the test imports.
This commit is contained in:
Eryn Wells 2024-01-21 13:06:44 -08:00
parent 3c699b0b3d
commit 704ee2f425
2 changed files with 21 additions and 5 deletions

View file

@ -18,3 +18,17 @@ macro_rules! position {
.build()
};
}
#[cfg(test)]
#[macro_export]
macro_rules! test_position {
[$($color:ident $shape:ident on $square:ident),* $(,)?] => {
{
let pos = $crate::PositionBuilder::new()
$(.place_piece(piece!($color $shape on $square)))*
.build();
println!("{pos}");
pos
}
};
}