fix: 覆盖率统计95.6% — __DP合成约束接入完整管道

## 修复

1. **__DP 约束被过滤掉** (__init__.py)
   - _resolve_field 对 '__DP' 直接穿透
   - fn.startswith('__') 绕过 fields_dict 检查
   - 导致 PERFORM/EVALUATE/IF 合成约束在 generate_data 内部丢失

2. **collect_all_dps DP ID 计数器** (design_mcdc.py)
   - 全局 _counter 替代局部 len(result)
   - IF/EVALUATE/PERFORM 统一用 _counter[0]
   - 递归调用传递 _counter

3. **__DP 匹配不依赖 DP ID** (coverage.py)
   - _mark_if / _mark_eval / _mark_perform 移除 id 检查
   - 直接通过 __DP label 识别分支方向

4. **PERFORM VARYING 条件提取** (design_mcdc.py)
   - VARYING UNTIL 从句自动提取 UNTIL 条件

5. **cond.py 增强**
   - OF 限定词剥离: STD-KEY OF MASTER-REC → STD-KEY
   - 裸字段引用: WS-EOF → (WS-EOF, '=', 'Y')
   - NOT 前缀: NOT WS-X > 50 → WS-X <= 50
   - not_map 添加 break

## 结果
- 分支覆盖率: 10.6% → 95.6% (3208中3068覆盖)
- S15回归: 17/17 PASS
- 程序数: 43/43有分支检测

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
NB-076
2026-06-24 21:47:10 +08:00
parent e2a8d53e60
commit e97e25165c
4 changed files with 114 additions and 31 deletions
+3 -1
View File
@@ -989,6 +989,8 @@ def generate_data(cobol_source: str, structure: dict = None) -> list[dict]:
_fdict_names = {f['name'] for f in fields_dict}
def _resolve_field(fn: str) -> str:
if fn == "__DP":
return fn
ufn = fn.upper()
if ' OF ' in ufn:
fn = fn.split(' OF ')[0].strip()
@@ -1002,7 +1004,7 @@ def generate_data(cobol_source: str, structure: dict = None) -> list[dict]:
for c in cons_list:
if len(c) >= 4:
fn = _resolve_field(str(c[0]))
if fn in _fdict_names:
if fn in _fdict_names or fn.startswith("__"):
c = list(c); c[0] = fn
clean.append(tuple(c))
else: