pub struct PerftTestCase {
pub fen: String,
/* private fields */
}Expand description
Represents a perft test case.
Contains a FEN string and a list of expected results for different depths.
§Examples
use chessly::PerftTestCase;
let test_case = PerftTestCase::try_from("4k3/8/8/8/8/8/8/4K2R b K - 0 1 ;D1 5 ;D2 75 ;D3 459 ;D4 8290 ;D5 47635 ;D6 899442").unwrap();
assert_eq!(test_case.fen, "4k3/8/8/8/8/8/8/4K2R b K - 0 1");
test_case.run(6, |result| {
assert!(result.is_ok());
});Fields§
§fen: StringThe FEN string of a position to test.
Implementations§
Source§impl PerftTestCase
impl PerftTestCase
Sourcepub fn run(&self, max_depth: u8, callback: impl Fn(PerftTestResult))
pub fn run(&self, max_depth: u8, callback: impl Fn(PerftTestResult))
Runs the test case.
The callback is called for each depth, with a PerftTestResult as argument.
§Panics
Panics if the FEN string is invalid.
§Examples
use chessly::PerftTestCase;
let test_case = PerftTestCase::try_from("4k3/8/8/8/8/8/8/4K2R b K - 0 1 ;D1 5 ;D2 75 ;D3 459 ;D4 8290 ;D5 47635 ;D6 899442").unwrap();
assert_eq!(test_case.fen, "4k3/8/8/8/8/8/8/4K2R b K - 0 1");
test_case.run(6, |result| {
assert!(result.is_ok());
});Trait Implementations§
Source§impl Debug for PerftTestCase
impl Debug for PerftTestCase
Auto Trait Implementations§
impl Freeze for PerftTestCase
impl RefUnwindSafe for PerftTestCase
impl Send for PerftTestCase
impl Sync for PerftTestCase
impl Unpin for PerftTestCase
impl UnwindSafe for PerftTestCase
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more