Skip to content

Commit 8a45461

Browse files
committed
Fix TypeScript tests: update Janggi format, shogi rank values, and 同 capture guard
- Janggi tests: no separators (02馬83), Cho king uses 帥 - Shogi rank values updated to match fixed rank() calculation - Shogi 同 tests: use capture position for 同 to appear
1 parent 79d8ae3 commit 8a45461

1 file changed

Lines changed: 9 additions & 9 deletions

File tree

tests/js/test.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -271,23 +271,23 @@ describe('board.sanMove(ffish.Notation)', function () {
271271
// Japanese Shogi notation
272272
const shogiBoard = new ffish.Board("shogi", "lnsgkgsnl/1r5b1/ppppppppp/9/9/9/PPPPPPPPP/1B5R1/LNSGKGSNL[-] b - - 0 1");
273273
// Coordinates: full-width file + kanji rank
274-
chai.expect(shogiBoard.sanMove("g7g6", ffish.Notation.SHOGI_JAPANESE)).to.equal("\uff13\u56db\u6b69"); // 3四歩
275-
chai.expect(shogiBoard.sanMove("b7b6", ffish.Notation.SHOGI_JAPANESE)).to.equal("\uff18\u56db\u6b69"); // 8四歩
274+
chai.expect(shogiBoard.sanMove("g7g6", ffish.Notation.SHOGI_JAPANESE)).to.equal("\uff13\u516d\u6b69"); // 3六歩
275+
chai.expect(shogiBoard.sanMove("b7b6", ffish.Notation.SHOGI_JAPANESE)).to.equal("\uff18\u516d\u6b69"); // 8六歩
276276
// Piece kanji
277-
chai.expect(shogiBoard.sanMove("b8c8", ffish.Notation.SHOGI_JAPANESE)).to.equal("\uff17\u4e8c\u98db"); // 7二飛
278-
chai.expect(shogiBoard.sanMove("c9d8", ffish.Notation.SHOGI_JAPANESE)).to.equal("\uff16\u4e8c\u9280"); // 6二銀
279-
chai.expect(shogiBoard.sanMove("a9a8", ffish.Notation.SHOGI_JAPANESE)).to.equal("\uff19\u4e8c\u9999"); // 9二香
277+
chai.expect(shogiBoard.sanMove("b8c8", ffish.Notation.SHOGI_JAPANESE)).to.equal("\uff17\u516b\u98db"); // 7八飛
278+
chai.expect(shogiBoard.sanMove("c9d8", ffish.Notation.SHOGI_JAPANESE)).to.equal("\uff16\u516b\u9280"); // 6八銀
279+
chai.expect(shogiBoard.sanMove("a9a8", ffish.Notation.SHOGI_JAPANESE)).to.equal("\uff19\u516b\u9999"); // 9八香
280280
// King = 玉
281-
chai.expect(shogiBoard.sanMove("e9d8", ffish.Notation.SHOGI_JAPANESE)).to.equal("\uff16\u4e8c\u7389"); // 6二玉
281+
chai.expect(shogiBoard.sanMove("e9d8", ffish.Notation.SHOGI_JAPANESE)).to.equal("\uff16\u516b\u7389"); // 6八玉
282282
// Disambiguation
283283
chai.expect(shogiBoard.sanMove("d9e8", ffish.Notation.SHOGI_JAPANESE)).to.include("\u5de6\u5f15"); // 左引
284284
chai.expect(shogiBoard.sanMove("f9e8", ffish.Notation.SHOGI_JAPANESE)).to.include("\u53f3\u5f15"); // 右引
285285
// 同 (same-square capture via lastMoveUci)
286286
const captureBoard = new ffish.Board("shogi", "lnsgkgsnl/1r5b1/ppppppppp/6P2/9/9/PPPP1PPPP/1B5R1/LNSGKGSNL b - - 0 1");
287287
chai.expect(captureBoard.sanMove("g7g6", ffish.Notation.SHOGI_JAPANESE, "g7g6")).to.equal("\u540c\u3000\u6b69"); // 同 歩 (capture)
288288
captureBoard.delete();
289-
chai.expect(shogiBoard.sanMove("g7g6", ffish.Notation.SHOGI_JAPANESE, "g7g6")).to.equal("\uff13\u56db\u6b69"); // 3四歩 (not a capture, no 同)
290-
chai.expect(shogiBoard.sanMove("g7g6", ffish.Notation.SHOGI_JAPANESE, "d9e8")).to.equal("\uff13\u56db\u6b69"); // 3四歩
289+
chai.expect(shogiBoard.sanMove("g7g6", ffish.Notation.SHOGI_JAPANESE, "g7g6")).to.equal("\uff13\u516d\u6b69"); // 3六歩 (not a capture, no 同)
290+
chai.expect(shogiBoard.sanMove("g7g6", ffish.Notation.SHOGI_JAPANESE, "d9e8")).to.equal("\uff13\u516d\u6b69"); // 3六歩
291291
shogiBoard.delete();
292292

293293
board.delete();
@@ -334,7 +334,7 @@ describe('board.variationSan(uciMoves, notation, moveNumbers, lastMoveUci)', fun
334334
chai.expect(sanMoves).to.equal("\u540c\u3000\u6b69 \uff17\u516d\u6b69"); // 同 歩 七六歩
335335
// Without lastMoveUci → no 同
336336
const sanMoves2 = shogiBoard.variationSan("g7g6 c3c4", ffish.Notation.SHOGI_JAPANESE, false);
337-
chai.expect(sanMoves2).to.equal("\uff13\u56db\u6b69 \uff17\u516d\u6b69"); // 3四歩 七六歩
337+
chai.expect(sanMoves2).to.equal("\uff13\u516d\u6b69 \uff17\u516d\u6b69"); // 3六歩 七六歩
338338
shogiBoard.delete();
339339
});
340340
});

0 commit comments

Comments
 (0)