Files
gplan-2/game/tests/unit/battle_settlement/extended_row_violation_test.gd
T
DKChan 9f21236f80 工程(注释标记词换代·oracle→判据出处): 用户 2026-11-07 令——判据出处注记的标记词改用项目已有中文名,避免 Oracle 被读成数据库。注释格式句、机检正则、标识符、卡片与登记同步换代;零行为改动。
改动面 112 文件 572+/572-:game/tests/** 与 game/probe/** 共 106 件 545 行 `# oracle:`→`# 判据出处:`;tools/capability_audit.py 正则字面量换中文+ORACLE_*→CRITERION_*/check_oracle_markers→check_criterion_markers/oracle_marked(flagged)→criterion_* 共 11 行;test-conventions.md:119 格式句+:155 措辞;待办清单与需求卡片-QA覆盖余量收口批各 1 处字面量;coverage_enum.py:21 与 camp_scene_layout_test.gd:101 旁支措辞;ui_click_probe.gd 对拍局部变量 oracle→expected 7 处;auto_player.gd 三处 safe_set 真值措辞。不动:历史审计报告两份、test-oracle-anchor 分支名、git 史、生成日志;指针格式/扫描面/判红条件/验收义务全不变。

读数(区内实跑):改前 capability_audit --strict「417 注记函数·红项 0」→改后「417 判据出处注记函数·红项 0」exit=0;新标记 545 行/106 文件,现行义务面 oracle 残留 0(在册沿革除外);diff 自检 game/ 非注释新增行仅 6 行且全在 ui_click_probe.gd 的 expected 变量段;112 改动文件 CRLF=0;py_compile tools/capability_audit.py OK;--docs exit=0【验收通过】无新增红;--gates exit=0(静态扫描绿、闸壳 bash -n ×13 失败 0)。
2026-11-07 07:11:15 +08:00

40 lines
2.4 KiB
GDScript
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.
# 致命类用例(独立进程,期望退出码 1)——迭代 38 卡④ wr2-np:扩展行必载 effect_id 负路径断言
# 违约直调 _emit_row(type=extended 无 effect_id 载荷)→ a2 行协议校验 assert 炸(debug 实况,
# 输出中的 SCRIPT ERROR 为其测试目标——负面套件全文折叠)→ 零发射;
# 回归态(校验段被移除)= 违约行照发 → 退出码 2 ≠ 期望 1(闸红)。
# 独立进程理由:GDScript assert 失败必产 SCRIPT ERROR 且不可捕获,非负面套件会被 run_all 错误
# 扫描判红(迭代 38 卡④ grilling 第二轮同款结论——负面豁免机制为此存在,counter_prefix 先例)。
# 运行:godot --headless --path game --script res://tests/unit/battle_settlement/extended_row_violation_test.gd
extends SceneTree
const Kit := preload("res://tests/unit/test_kit.gd")
func _init() -> void:
# 判据出处: design/gdd/systems/表现与支撑/数据配置.md:199 (扩展行必载 effect_id——加载致命组)
var db = load("res://core/config_db.gd").new()
if not db.load_tables("res://data/tables", false):
push_error("[extended_row_violation_test] 表加载失败")
quit(2)
return
var rng = load("res://core/rng_service.gd").new()
rng.set_master_seed(74100)
var oc = load("res://core/battle_orchestrator.gd").new(db, rng)
var hits: Array = []
oc.step_row.connect(func(row): hits.append(row))
# 违约直调(缺 effect_id 载荷——行协议违约):debug 下 a2 校验 assert 炸中断 _emit_row 本体,
# 控制流回到本函数(headless assert 语义=中断当前函数不中止运行);release 下 return 零发射同效
oc._emit_row({"type": "extended", "source_class": "fx_reveal", "origin_cell": Vector2i.ZERO}, 1, "负路径", 0, {})
if not hits.is_empty():
push_error("[extended_row_violation_test] 违约行被发射——a2 校验失守(回归)")
quit(2)
return
# 对照组:合法扩展行(带 effect_id)照常发射——校验只拦违约形态
oc._emit_row({"type": "extended", "source_class": "fx_reveal", "origin_cell": Vector2i.ZERO}, 1, "合法对照", 0, {"effect_id": "fx_reveal"})
if hits.size() != 1 or String(hits[0].get("type", "")) != "extended":
push_error("[extended_row_violation_test] 合法扩展行未发射——校验误拦(回归)")
quit(2)
return
print("[extended_row_violation_test] 违约零发射+合法照发(a2 校验在位)")
quit(1)