chessfriend/board/src/tests.rs

24 lines
599 B
Rust
Raw Normal View History

// Eryn Wells <eryn@erynwells.me>
/// Test helper utilities.
use crate::Square;
/// A constructor function that returns a Square representing the square on the
/// chessboard indicated by the algebraic notation.
macro_rules! sq_constructor {
($func_name:ident) => {
pub(crate) fn $func_name() -> Square {
Square::from_algebraic_str(stringify!($func_name)).expect(stringify!($func_name))
}
};
}
impl Square {
sq_constructor!(d5);
sq_constructor!(e2);
sq_constructor!(e3);
sq_constructor!(e4);
sq_constructor!(e5);
sq_constructor!(f5);
}