Skip to content

Commit

Permalink
setup tests for miri
Browse files Browse the repository at this point in the history
  • Loading branch information
Icerath committed Jan 9, 2025
1 parent cec1996 commit b3fc502
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/core/perft.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,11 @@ pub(crate) mod tests {

#[test]
fn perft_start() {
#[cfg(miri)]
let results = [1, 20, 400];
#[cfg(not(miri))]
let results = [1, 20, 400, 8_902, 197_281, 4_865_609, 119_060_324];

for (depth, &result) in results.iter().enumerate() {
let count = Board::start_pos().run_perft(depth as u8);
assert_eq!(count, result, "depth: {depth}");
Expand All @@ -45,6 +49,9 @@ pub(crate) mod tests {

#[test]
pub(crate) fn perft_kiwi() {
#[cfg(miri)]
let results = [1, 48];
#[cfg(not(miri))]
let results = [1, 48, 2_039, 97_862, 4_085_603, 193_690_690];
for (depth, &result) in results.iter().enumerate() {
let count = Board::kiwipete().run_perft(depth as u8);
Expand All @@ -53,6 +60,9 @@ pub(crate) mod tests {
}
#[test]
fn perft_position_3() {
#[cfg(miri)]
let results = [1, 14, 191];
#[cfg(not(miri))]
let results = [1, 14, 191, 2_812, 43_238, 674_624, 11_030_083, 178_633_661];
for (depth, &result) in results.iter().enumerate() {
let count = Board::perft_position_3().run_perft(depth as u8);
Expand All @@ -61,6 +71,9 @@ pub(crate) mod tests {
}
#[test]
fn perft_position_4() {
#[cfg(miri)]
let results = [1, 6, 264];
#[cfg(not(miri))]
let results = [1, 6, 264, 9_467, 422_333, 15_833_292 /*, 706_045_033*/];
for (depth, &result) in results.iter().enumerate() {
let count = Board::perft_position_4().run_perft(depth as u8);
Expand All @@ -69,6 +82,9 @@ pub(crate) mod tests {
}
#[test]
fn perft_talk() {
#[cfg(miri)]
let results = [1, 44];
#[cfg(not(miri))]
let results = [1, 44, 1_486, 62_379, 2_103_487, 89_941_194];
for (depth, &result) in results.iter().enumerate() {
let count = Board::perft_position_5().run_perft(depth as u8);
Expand Down

0 comments on commit b3fc502

Please sign in to comment.