21 lines
524 B
Rust
21 lines
524 B
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!(e2);
|
||
|
|
sq_constructor!(e3);
|
||
|
|
sq_constructor!(e4);
|
||
|
|
}
|