-
Notifications
You must be signed in to change notification settings - Fork 0
58 lines (51 loc) · 1.73 KB
/
engine_test.yaml
File metadata and controls
58 lines (51 loc) · 1.73 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
name: Perft
on:
push:
branches:
- main
jobs:
Perft:
runs-on: ubuntu-latest
strategy:
matrix:
suites:
- name: Normal
epd: perftsuite.epd
count: 127
depth: 5
steps:
- uses: actions/checkout@v4
- uses: goto-bus-stop/setup-zig@v2
with:
version: "0.14.0"
- name: Build engine
run: zig build
- name: Perft ${{ matrix.suites.name }}
run: |
COUNTER=0
FAILED=0
wget -q -O suite.epd https://raw.githubusercontent.com/TerjeKir/EngineTests/master/testfiles/${{ matrix.suites.epd }}
while IFS= read -r line || [ -n "$line" ]; do
fen=$(echo "$line" | sed 's/ ;.*//')
expected=$(echo "$line" | grep -oP "(?<=;D${{ matrix.suites.depth }} )\d+")
if [ -z "$expected" ]; then
continue
fi
COUNTER=$((COUNTER + 1))
actual=$(printf "position fen %s\nperft %s\nquit\n" "$fen" "${{ matrix.suites.depth }}" | ./zig-out/bin/NeuroSpeed 2>&1 | awk '/^Nodes:/{print $NF}' | head -1)
if [ "$actual" != "$expected" ]; then
echo "FAIL $COUNTER: $fen -> Expected: $expected, Got: $actual"
FAILED=$((FAILED + 1))
else
echo "OK $COUNTER: $fen -> $actual"
fi
done < suite.epd
if [ $FAILED -ne 0 ]; then
echo "$FAILED/$COUNTER positions failed!"
exit 1
fi
if [ $COUNTER -ne ${{ matrix.suites.count }} ]; then
echo "Expected ${{ matrix.suites.count }} positions but found $COUNTER"
exit 1
fi
echo "All $COUNTER/${{ matrix.suites.count }} positions passed!"