Commit 9531d73
Add unit tests for promoted piece validation in FEN validation
Added comprehensive test cases to test.py covering the promoted piece validation feature:
- test_validate_fen_promoted_pieces() method with test cases for:
* Valid promoted pieces in shogi variants (should pass validation)
* Invalid promoted pieces that cannot be promoted (should return FEN_INVALID_PROMOTED_PIECE = -12)
* Non-shogi variants with '+' character (should fail with character validation, not promoted piece validation)
- Added FEN_INVALID_PROMOTED_PIECE constant to Python bindings in pyffish.cpp
- Tests verify the fix works correctly:
* kyotoshogi correctly rejects +K (promoted king) with error -12
* shogi rejects double promotion (++K) with error -12
* chess rejects '+' as invalid character with error -10
* Valid promoted pieces in shogi (like +p, +b, +r, +s, +n, +l) pass validation
All existing tests continue to pass, confirming no regression.
Co-authored-by: ianfab <12969303+ianfab@users.noreply.github.com>1 parent 9253991 commit 9531d73
3 files changed
Lines changed: 57 additions & 0 deletions
Binary file not shown.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
462 | 462 | | |
463 | 463 | | |
464 | 464 | | |
| 465 | + | |
465 | 466 | | |
466 | 467 | | |
467 | 468 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1184 | 1184 | | |
1185 | 1185 | | |
1186 | 1186 | | |
| 1187 | + | |
| 1188 | + | |
| 1189 | + | |
| 1190 | + | |
| 1191 | + | |
| 1192 | + | |
| 1193 | + | |
| 1194 | + | |
| 1195 | + | |
| 1196 | + | |
| 1197 | + | |
| 1198 | + | |
| 1199 | + | |
| 1200 | + | |
| 1201 | + | |
| 1202 | + | |
| 1203 | + | |
| 1204 | + | |
| 1205 | + | |
| 1206 | + | |
| 1207 | + | |
| 1208 | + | |
| 1209 | + | |
| 1210 | + | |
| 1211 | + | |
| 1212 | + | |
| 1213 | + | |
| 1214 | + | |
| 1215 | + | |
| 1216 | + | |
| 1217 | + | |
| 1218 | + | |
| 1219 | + | |
| 1220 | + | |
| 1221 | + | |
| 1222 | + | |
| 1223 | + | |
| 1224 | + | |
| 1225 | + | |
| 1226 | + | |
| 1227 | + | |
| 1228 | + | |
| 1229 | + | |
| 1230 | + | |
| 1231 | + | |
| 1232 | + | |
| 1233 | + | |
| 1234 | + | |
| 1235 | + | |
| 1236 | + | |
| 1237 | + | |
| 1238 | + | |
| 1239 | + | |
| 1240 | + | |
| 1241 | + | |
| 1242 | + | |
1187 | 1243 | | |
1188 | 1244 | | |
1189 | 1245 | | |
| |||
0 commit comments