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:
@@ -82,6 +82,15 @@ def parse_single_condition(text, fields=None):
|
||||
if f.get('is_88') and text.upper().startswith('NOT ') and f['name'] == text[4:].strip().upper():
|
||||
return (f.get('parent', ''), '<>', f.get('value', ''))
|
||||
|
||||
# Strip OF qualifier: "STD-KEY OF MASTER-REC" → "STD-KEY"
|
||||
if ' OF ' in text.upper():
|
||||
text = text.split(' OF ')[0].strip()
|
||||
|
||||
# Bare field reference (no operator, no NOT): WS-EOF → WS-EOF = 'Y'
|
||||
# (88-level COBOL condition name test)
|
||||
if re.match(r'^[A-Z][A-Z0-9-]*(?:\([^)]*\))?\s*$', text, re.IGNORECASE):
|
||||
return (text, '=', 'Y')
|
||||
|
||||
# Bare NOT field reference (no operator): NOT WS-EOF → WS-EOF <> 'Y'
|
||||
if text.upper().startswith('NOT ') and not re.search(r'(>=|<=|<>|>|<|=)', text):
|
||||
fn = text[4:].strip()
|
||||
|
||||
Reference in New Issue
Block a user