Implement some helpful testing types and traits in the moves package

This commit is contained in:
Eryn Wells 2024-02-25 09:15:07 -08:00
parent d714374f35
commit 9b7bf3a212
4 changed files with 30 additions and 11 deletions

View file

@ -1,12 +1,14 @@
// Eryn Wells <eryn@erynwells.me>
pub mod testing;
mod builder;
mod castle;
mod defs;
mod en_passant;
mod moves;
pub use builder::{Builder, Error as BuilderError};
pub use builder::{Builder, Error as BuildMoveError, Result as BuildMoveResult};
pub use castle::Castle;
pub use defs::PromotionShape;
pub use en_passant::EnPassant;

17
moves/src/testing.rs Normal file
View file

@ -0,0 +1,17 @@
// Eryn Wells <eryn@erynwells.me>
use crate::BuildMoveError;
pub type TestResult = Result<(), TestError>;
#[derive(Debug, Eq, PartialEq)]
pub enum TestError {
BuildMove(BuildMoveError),
NoLegalMoves,
}
impl From<BuildMoveError> for TestError {
fn from(value: BuildMoveError) -> Self {
TestError::BuildMove(value)
}
}