Files
cobol-java-v3/test-data/s26_regression_check.py
NB-076 50995d3335 chore: SETUP.md + 测试报告脚本 + 文档更新
- SETUP.md: 完整环境搭建指南(同事用)
- SETUP_QUICK.md: 快速搭环境(4步)
- s22~s26: TNA端到端、覆盖率报告、回归检查
- procedure_grammar.lark: 实验性Lark语法

Co-Authored-By: Claude <noreply@anthropic.com>
2026-06-25 08:50:17 +08:00

48 lines
2.1 KiB
Python

"""Quick test all 43 programs for regressions from the subscript fix"""
import sys, os, re
sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..'))
ROOT = "D:/cobol-java/cobol-test-programs/"
COPYBOOKS = os.path.join(ROOT, "common/copybooks")
TNA = "D:/cobol-java/cobol-tna-system/"
from cobol_testgen import extract_structure, generate_data
total_br = 0; total_cov = 0; errors = []; below = []
for d in sorted(os.listdir(ROOT)):
dp = os.path.join(ROOT, d)
if not os.path.isdir(dp) or d in ('common','docs','cross-cutting'): continue
cbls = [f for f in os.listdir(dp) if f.endswith('.cbl') and f.startswith('main')]
if not cbls: cbls = [f for f in os.listdir(dp) if f.endswith('.cbl')]
fpath = os.path.join(dp, sorted(cbls, key=lambda f: -os.path.getsize(os.path.join(dp,f)))[0])
try:
src = open(fpath, encoding='utf-8').read()
st = extract_structure(src)
generate_data(src, st, copybook_dirs=[COPYBOOKS])
cov = st.get('coverage', {})
t = cov.get('total', 0); c = cov.get('covered', 0)
total_br += t; total_cov += c
if t > 0 and c < t: below.append((d, c, t))
except Exception as e: errors.append((d, str(e)[:60]))
for f in ['ZAN01CHK','ZAN02CHK','ZAN03CHK','ZAN04MAT','ZAN05CAL','ZAN06UPD']:
fpath = os.path.join(TNA, 'src', f + '.cbl')
if not os.path.exists(fpath): continue
try:
src = open(fpath, encoding='utf-8-sig').read()
st = extract_structure(src)
generate_data(src, st, copybook_dirs=[os.path.join(TNA, 'cpy')])
cov = st.get('coverage', {})
t = cov.get('total', 0); c = cov.get('covered', 0)
total_br += t; total_cov += c
if t > 0 and c < t: below.append((f, c, t))
except Exception as e: errors.append((f, str(e)[:60]))
print(f"Total: {total_cov}/{total_br} = {total_cov/max(total_br,1)*100:.2f}%")
if errors:
for e in errors: print(f" ERROR: {e[0]}: {e[1]}")
if below:
for b in below: print(f" <100%: {b[0]}: {b[1]}/{b[2]}")
if not errors and not below:
print("✅ ALL 43/43 AT 100% — NO REGRESSIONS")