So I made a test position with as many corner cases and likely bugs as possible. Here it is -
[d]Bn1N3R/ppPpNR1r/BnBr1NKR/k3pP2/3PR2R/N7/3P2P1/4Q2R w - e6 0 1
Things it tests:
- * Castling must be done with a king (Qg1 is not castling!)
* En-passant must be done with a pawn (Ne6 is not en passant)
* Rank and file disambiguations, with and without captures (rooks on the left)
* Must prefer using file to disambiguate (Rfxh7, not R7xh7, even though both are unambiguous)
* No need to disambiguate with opponent piece or other piece types (Nd4, not Nad4 - knight on b6 is black, and bishop on a6 is a bishop)
* Pawn captures must include file, even if there's no ambiguity (dxe5)
* No disambiguation needed if the other candidate move is illegal because it's pinned (Nd5, not Ned5).
* Cases where both rank and file disambiguations are required (Ba6xb7)
* Capture promotions and normal promotions (cxb8=X, c8=X)
Not tested:
- * Castling (conflicts with #1)
Code: Select all
d3+
g3
g4
d5
dxe5
fxe6
cxb8=R
cxb8=N
cxb8=B
cxb8=Q
c8=R
c8=N
c8=B
c8=Q
Nb1
Nc2
Nc4+
Nb5
Nd5
Nc8
Ng8
Ne6
Nxb7+
Bf1
Be2
Bd3
Bc4
Bab5
Ba6xb7
Ba4
Bcb5
Bd5
Bcxb7
Bxd7
Ba8xb7
Rf1
Rg1
R1h2
R1h3
Re2
Re3
Ref4
Reg4
Rxe5+
R4h2
R4h3
Rhf4
Rhg4
R4h5
R6h5
Rh6xh7
Rg7
Rfxh7
Rff8
Rh8xh7
Re8
Rhf8
Rg8
Qa1
Qb1
Qc1
Qd1
Qf1
Qg1
Qe2
Qf2
Qe3
Qg3
Kg5
Kh5
Kxh7
Note that this is a SAN-generation test, not a move-gen test. So this doesn't test for possible move-gen bugs, if they aren't likely to cause SAN-generation bugs.