diff options
| -rwxr-xr-x | perft.bash | 24 |
1 files changed, 22 insertions, 2 deletions
@@ -1,5 +1,7 @@ #!/usr/bin/env bash +status=0 + testPerft() { local fen="$1" local depth="$2" @@ -8,8 +10,8 @@ testPerft() { echo "" result=$(./build/mono "perft" $depth "$fen") - count=$(echo $result | jq -r '.result') - took=$(echo $result | jq -r '.ms') + count=$(echo "$result" | jq -r '.result') + took=$(echo "$result" | jq -r '.ms') if [ "$count" = "$expected" ]; then echo "Results match" echo "Took: $took ms" @@ -20,6 +22,7 @@ testPerft() { echo "Fen: $fen" echo "Expected: $expected" echo "Got: $count" + status=1 fi } @@ -37,9 +40,26 @@ configs=( "r3k2r/p1ppqpb1/bn2pnp1/3PN3/1p2P3/2N2Q1p/PPPBBPPP/R3K2R w KQkq -|3|97862" "r3k2r/p1ppqpb1/bn2pnp1/3PN3/1p2P3/2N2Q1p/PPPBBPPP/R3K2R w KQkq -|4|4085603" "r3k2r/p1ppqpb1/bn2pnp1/3PN3/1p2P3/2N2Q1p/PPPBBPPP/R3K2R w KQkq -|5|193690690" + + # other positions + "8/2p5/3p4/KP5r/1R3p1k/8/4P1P1/8 w - - 0 1|1|14" + "8/2p5/3p4/KP5r/1R3p1k/8/4P1P1/8 w - - 0 1|2|191" + "8/2p5/3p4/KP5r/1R3p1k/8/4P1P1/8 w - - 0 1|3|2812" + "8/2p5/3p4/KP5r/1R3p1k/8/4P1P1/8 w - - 0 1|4|43238" + "8/2p5/3p4/KP5r/1R3p1k/8/4P1P1/8 w - - 0 1|5|674624" + + # even more cool ones + "r3k2r/Pppp1ppp/1b3nbN/nP6/BBP1P3/q4N2/Pp1P2PP/R2Q1RK1 w kq - 0 1|1|6" + "r3k2r/Pppp1ppp/1b3nbN/nP6/BBP1P3/q4N2/Pp1P2PP/R2Q1RK1 w kq - 0 1|2|264" + "r3k2r/Pppp1ppp/1b3nbN/nP6/BBP1P3/q4N2/Pp1P2PP/R2Q1RK1 w kq - 0 1|3|9467" + "r3k2r/Pppp1ppp/1b3nbN/nP6/BBP1P3/q4N2/Pp1P2PP/R2Q1RK1 w kq - 0 1|4|422333" + "r3k2r/Pppp1ppp/1b3nbN/nP6/BBP1P3/q4N2/Pp1P2PP/R2Q1RK1 w kq - 0 1|5|15833292" ) for config in "${configs[@]}"; do IFS='|' read -r fen depth expected <<< "$config" testPerft "$fen" "$depth" "$expected" + if [ $status -ne 0 ]; then + exit "$status" + fi done
\ No newline at end of file |
