- test_deal.js(新):§2 发牌构成——92张/去3-4共16/三家各28+底8/分值(§6.1) - test_arith.js:§3 编码排序(order_cards 降序=设计顺序、is_continuous 相邻链逐段+反例)、 §7 每档小光/过庄分界+升3级补齐 - test_paiju.js:§8.2 亮牌更多边界(6个7仅qi、固定主9→null、固定主10仅zhu) - test_config.js:§10 直接调 export.get_asetcount/get_needroomcard(_joinroom) - test_rpc.js/_rpc.js:§12 端到端(真实驱动 叫分→上庄→选主→埋牌→出牌ready)、 §9 maipai 亮牌门控 + get_deskinfo PushCards 门控 - 02-测试计划.md/README:P2 与 DoD 标记达成 全部单测 204 项断言全绿(node server/games/erqiwang/test/run.js) Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
29 lines
1.3 KiB
JavaScript
29 lines
1.3 KiB
JavaScript
// §2 牌局构成:两副去3/4共92张、三家各28+底8、分值。期望取自 design §2/§6.1
|
||
require('./_shim');
|
||
const P = require('../class.paiju.js');
|
||
const t = require('./_assert')();
|
||
|
||
const pj = P.new({ paiju_list: [] }, 0); // 真实发牌(min_random 由 shim 提供)
|
||
|
||
// dealowner 统计:-1 去掉的3/4;0 底牌;1/2/3 三家
|
||
const cnt = {};
|
||
for (const c of pj.cards) cnt[c.dealowner] = (cnt[c.dealowner] || 0) + 1;
|
||
|
||
t.eq('发牌 三家各28', [P.get_seat_cards_deal(pj, 0).length, P.get_seat_cards_deal(pj, 1).length, P.get_seat_cards_deal(pj, 2).length], [28, 28, 28]);
|
||
t.eq('发牌 底牌8', P.get_bottomcards(pj).length, 8);
|
||
t.eq('发牌 总发出92(28×3+8)', (cnt[0] || 0) + (cnt[1] || 0) + (cnt[2] || 0) + (cnt[3] || 0), 92);
|
||
t.eq('去掉的3/4共16', cnt[-1], 16);
|
||
t.eq('无3/4被发出', pj.cards.filter(c => (c.number === 3 || c.number === 4) && c.dealowner !== -1).length, 0);
|
||
t.eq('牌对象总数108', pj.cards.length, 108);
|
||
|
||
// 分值 (§6.1):5→5、10→10、K(13)→10、其余0
|
||
const scoreOf = n => pj.cards.find(x => x.number === n).score;
|
||
t.eq('分值 5→5', scoreOf(5), 5);
|
||
t.eq('分值 10→10', scoreOf(10), 10);
|
||
t.eq('分值 K(13)→10', scoreOf(13), 10);
|
||
t.eq('分值 A(1)→0', scoreOf(1), 0);
|
||
t.eq('分值 6→0', scoreOf(6), 0);
|
||
t.eq('分值 大王→0', scoreOf(54), 0);
|
||
|
||
process.exit(t.done('deal') ? 0 : 1);
|