Skip to content

Commit

Permalink
add more san disambiguation tests (niklasf/shakmaty#77)
Browse files Browse the repository at this point in the history
  • Loading branch information
niklasf committed Jul 10, 2024
1 parent e2df65c commit 9de4c44
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/san.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -201,3 +201,20 @@ test('overspecified pawn move', () => {
const pos = Chess.default();
expect(parseSan(pos, '2e4')).toEqual({ from: 12, to: 28 });
});

test.each([
['N3k2N/8/8/3N4/N4N1N/2R5/1R6/4K3 w - -', 'e1f1', 'Kf1'],
['N3k2N/8/8/3N4/N4N1N/2R5/1R6/4K3 w - -', 'c3c2', 'Rcc2'],
['N3k2N/8/8/3N4/N4N1N/2R5/1R6/4K3 w - -', 'b2c2', 'Rbc2'],
['N3k2N/8/8/3N4/N4N1N/2R5/1R6/4K3 w - -', 'a4b6', 'N4b6'],
['N3k2N/8/8/3N4/N4N1N/2R5/1R6/4K3 w - -', 'h8g6', 'N8g6'],
['N3k2N/8/8/3N4/N4N1N/2R5/1R6/4K3 w - -', 'h4g6', 'Nh4g6'],
['8/2KN1p2/5p2/3N1B1k/5PNp/7P/7P/8 w - -', 'd5f6', 'N5xf6#'],
['8/8/8/R2nkn2/8/8/2K5/8 b - -', 'f5e3', 'Ne3+'],
['7k/1p2Npbp/8/2P5/1P1r4/3b2QP/3q1pPK/2RB4 b - -', 'f2f1q', 'f1=Q'],
['7k/1p2Npbp/8/2P5/1P1r4/3b2QP/3q1pPK/2RB4 b - -', 'f2f1n', 'f1=N+'],
])('disambiguation', (fen, uci, san) => {
const pos = Chess.fromSetup(parseFen(fen).unwrap()).unwrap();
const move = parseUci(uci)!;
expect(makeSan(pos, move)).toBe(san);
});

0 comments on commit 9de4c44

Please sign in to comment.