add 2 tests and log errors to stderr - chess-puzzles - chess puzzle book generator
(HTM) git clone git://git.codemadness.org/chess-puzzles
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) README
(DIR) LICENSE
---
(DIR) commit 13632b938c00ed21681a7bde25d8c119666524b8
(DIR) parent b157d49005e4d9fd2e5e979b72a1e222e21fdec3
(HTM) Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date: Tue, 11 Jun 2024 15:41:20 +0200
add 2 tests and log errors to stderr
Diffstat:
M tests.sh | 32 ++++++++++++++++++++-----------
1 file changed, 21 insertions(+), 11 deletions(-)
---
(DIR) diff --git a/tests.sh b/tests.sh
@@ -13,9 +13,9 @@ testfen() {
# input FEN with no moves should match output FEN (except "startpos").
output=$(./fen -o fen "$fen" "")
if test "$fen" != "startpos" && test "$fen" != "$output"; then
- printf '[FEN] Fail: %s, input FEN does not match output FEN\n' "$name"
- printf '\texpected: %s\n' "$fen"
- printf '\tgot: %s\n' "$output"
+ printf '[FEN] Fail: %s, input FEN does not match output FEN\n' "$name" >&2
+ printf '\texpected: %s\n' "$fen" >&2
+ printf '\tgot: %s\n' "$output" >&2
statuscode=1
failed=$((failed+1))
fi
@@ -24,10 +24,10 @@ testfen() {
if test "$output" = "$expect"; then
printf '[FEN] OK: %s\n' "$name"
else
- printf '[FEN] Fail: %s\n' "$name"
- printf '\texpected: %s\n' "$expect"
- printf '\tgot: %s\n' "$output"
- printf '\tInput FEN, moves: "%s" "%s"\n' "$fen" "$moves"
+ printf '[FEN] Fail: %s\n' "$name" >&2
+ printf '\texpected: %s\n' "$expect" >&2
+ printf '\tgot: %s\n' "$output" >&2
+ printf '\tInput FEN, moves: "%s" "%s"\n' "$fen" "$moves" >&2
statuscode=1
failed=$((failed+1))
fi
@@ -44,10 +44,10 @@ testpgn() {
if test "$output" = "$expect"; then
printf '[PGN] OK: %s\n' "$name"
else
- printf '[PGN] Fail: %s\n' "$name"
- printf '\texpected: %s\n' "$expect"
- printf '\tgot: %s\n' "$output"
- printf '\tInput FEN, moves: "%s" "%s"\n' "$fen" "$moves"
+ printf '[PGN] Fail: %s\n' "$name" >&2
+ printf '\texpected: %s\n' "$expect" >&2
+ printf '\tgot: %s\n' "$output" >&2
+ printf '\tInput FEN, moves: "%s" "%s"\n' "$fen" "$moves" >&2
statuscode=1
failed=$((failed+1))
fi
@@ -601,6 +601,16 @@ testpgn 'castles chess 960'\
'1. ... O-O'\
'rk1r4/ppqp1bnp/2pbppn1/6p1/4P1P1/1PPN1P1P/P1QPBN1B/RK1R4 b KQkq - 0 1'\
'b8g8'
+
+testpgn 'test file/rank for pawn move (was bug)'\
+ '7. gxf3 Qh4#'\
+ 'rn1qk1nr/ppp2ppp/3b4/8/8/2N2b2/PPPPP1PP/R1BQKB1R w KQkq - 0 7'\
+ 'g2f3 d8h4'
+
+testpgn 'test en passant check (was bug)'\
+ '35. Kg4 h5+ 36. gxh6 f5+ 37. Kg5 Rg3#'\
+ '8/2R2p1p/4k1p1/6P1/5P1P/r5K1/8/8 w - - 1 35'\
+ 'g3g4 h7h5 g5h6 f7f5 g4g5 a3g3'
}
tests_fen