Files
erqiwang_youle/server/games/erqiwang/test/_shim.js
T
joywayerandClaude Opus 4.8 6d663c8a66 二七王:新增 Node 单元测试,CLAUDE.md 记录测试命令
- test/_shim.js:平台全局垫片(min_ary_include/deduct、min_random/now/ontimeout、
  youle_erqiwang.import mock),忠实复刻 minhttp.js;仅测试用,不进正式代码
- test/_assert.js + run.js:极简断言与总运行器
- test/test_arith.js(扣底/算子常规+爬坡/算奖/甩牌/跟牌分量) test_config.js(位串/局数扣卡)
  test/test_paiju.js(亮牌/结算 get_paiju_account 集成),共 89 项断言全过
- test/README.md:运行方式与双运行时原理
- CLAUDE.md:常用命令补测试入口,说明服务端双运行时规范

(CLAUDE.md 内另含此前一处措辞微调,随本次文档更新一并纳入)

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-04 23:51:12 +08:00

27 lines
1.1 KiB
JavaScript
Raw 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.
// Node 单测环境:提供正式代码按全局名引用的平台工具(不进正式代码,dev-guide 01 §1)
global.min_ary_include = function(aryparent, arychild){
for (var i = 0; i < arychild.length; i++){
var found = false;
for (var j = 0; j < aryparent.length; j++){ if (aryparent[j] == arychild[i]){ found = true; break; } }
if (!found){ return false; }
}
return true;
};
global.min_ary_deduct = function(aryparent, arychild){
var re = [];
for (var i = 0; i < aryparent.length; i++){
var found = false;
for (var j = 0; j < arychild.length; j++){ if (aryparent[i] == arychild[j]){ found = true; break; } }
if (!found){ re.push(aryparent[i]); }
}
return re;
};
global.min_random = function(min, max){ return min + Math.round(Math.random() * (max - min)); };
global.min_now = function(ts){ return ts ? ts : Date.now(); };
global.min_ontimeout = function(func, time){ /* 单测不真正异步执行 */ };
global.youle_erqiwang = global.youle_erqiwang || {
import: { check_player: function(){ return null; }, deduct_roomcard: function(){}, save_grade: function(){} },
app: { SendPack: function(){} }
};
module.exports = {};