Files
joywayerandClaude Opus 4.8 339e6e99e1 二七王测试:完成 P2 用例,达成测试计划 DoD
- 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>
2026-07-05 01:24:34 +08:00

39 lines
2.0 KiB
JavaScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
// roomtype 位串解析 + 局数/扣卡映射(design §10.1)
require('./_shim');
const C = require('../class.config.js');
const t = require('./_assert')();
// 复刻 export 的两个映射(现为2行)做端到端验证
const needroomcard = rt => { const c = C.parse(rt); return c.deductAA ? (c.aset12 ? 2 : 1) : (c.aset12 ? 4 : 2); };
const asetcount = rt => { const c = C.parse(rt); return c.aset12 ? 12 : 6; };
// --- parse 位串 ---
t.eq('"00000"', C.parse("00000"), { aset12: false, deductAA: false, bangwang: false, climb: false, nocheck: false });
t.eq('"10100"', C.parse("10100"), { aset12: true, deductAA: false, bangwang: true, climb: false, nocheck: false });
t.eq('"01011"', C.parse("01011"), { aset12: false, deductAA: true, bangwang: false, climb: true, nocheck: true });
t.eq('"" 兜底', C.parse(""), { aset12: false, deductAA: false, bangwang: false, climb: false, nocheck: false });
t.eq('undefined 兜底', C.parse(undefined), { aset12: false, deductAA: false, bangwang: false, climb: false, nocheck: false });
t.eq('"1" 短串', C.parse("1"), { aset12: true, deductAA: false, bangwang: false, climb: false, nocheck: false });
// --- 局数 ---
t.eq('6局 "0"', asetcount("00000"), 6);
t.eq('12局 "1"', asetcount("10000"), 12);
// --- 开房房卡 (design §10.1) ---
t.eq('房主6局', needroomcard("00000"), 2);
t.eq('房主12局', needroomcard("10000"), 4);
t.eq('AA6局', needroomcard("01000"), 1);
t.eq('AA12局', needroomcard("11000"), 2);
// --- 直接调用 export 的接口(替代复刻映射) ---
const exp = require('../class.export.js').new();
t.eq('export 局数6', exp.get_asetcount("00000"), 6);
t.eq('export 局数12', exp.get_asetcount("10000"), 12);
t.eq('export 房主6局2张', exp.get_needroomcard("00000"), 2);
t.eq('export 房主12局4张', exp.get_needroomcard("10000"), 4);
t.eq('export AA6局1张', exp.get_needroomcard("01000"), 1);
t.eq('export 加入·房主0张', exp.get_needroomcard_joinroom("00000"), 0);
t.eq('export 加入·AA6局1张', exp.get_needroomcard_joinroom("01000"), 1);
process.exit(t.done('config') ? 0 : 1);