40 lines
1 KiB
Rust
40 lines
1 KiB
Rust
// 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!(a1);
|
|
sq_constructor!(a2);
|
|
sq_constructor!(b1);
|
|
sq_constructor!(b2);
|
|
sq_constructor!(c3);
|
|
sq_constructor!(c5);
|
|
sq_constructor!(d2);
|
|
sq_constructor!(d3);
|
|
sq_constructor!(d4);
|
|
sq_constructor!(d5);
|
|
sq_constructor!(d6);
|
|
sq_constructor!(e2);
|
|
sq_constructor!(e3);
|
|
sq_constructor!(e4);
|
|
sq_constructor!(e5);
|
|
sq_constructor!(f2);
|
|
sq_constructor!(f3);
|
|
sq_constructor!(f4);
|
|
sq_constructor!(f5);
|
|
sq_constructor!(f6);
|
|
sq_constructor!(g3);
|
|
sq_constructor!(g5);
|
|
sq_constructor!(h8);
|
|
}
|