use thiserror::Error;
#[derive(Debug, Error, PartialEq)]
#[error("Invalid Chess960 ID: {spid}, must be between 0 and 959")]
pub struct Chess960SPIDError {
pub spid: u16,
}
impl Chess960SPIDError {
pub fn new(spid: u16) -> Self {
Chess960SPIDError { spid }
}
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn test_chess960_id_error_creation() {
let error = Chess960SPIDError::new(960);
assert_eq!(error.spid, 960);
assert_eq!(
error.to_string(),
"Invalid Chess960 ID: 960, must be between 0 and 959"
);
}
}