feat: Phase 2 complete — 13 Phases of COBOL type classification and test benchmark
P0.6: gcov infrastructure P1: extract_structure output expansion (11 new feature fields) P2: Confusion group rule engine (8 pairs + contradiction + backtrack) P3: 4-factor confidence calculation + quality gate update P4: 33+2 COBOL program type test samples (22 files, 7 categories) P5: parametrized/ test data generation engine P6: japanese_data.py lookup tables P7-10: Type-specific test suites (~159 parametrized tests) P11: Full classification pipeline (classify_program) + orchestrator integration P12: Documentation (module-interfaces, test-plan v3.0, coverage-matrix) Architecture decisions: - classification_pipeline/ merged to hina/pipeline/ - parametrized/ as independent module - japanese_data.py as root-level file - hina/__all__ only exports classify_program() Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
"""PP-01~03: CopybookPreprocessor"""
|
||||
|
||||
import sys, os, tempfile
|
||||
from pathlib import Path
|
||||
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), "..")))
|
||||
from preprocessor import CopybookPreprocessor
|
||||
|
||||
|
||||
def test_expand_found():
|
||||
"""PP-01: COPY 文件存在时展开"""
|
||||
with tempfile.TemporaryDirectory() as tmp:
|
||||
cpy = Path(tmp) / "MYCPY.cpy"
|
||||
cpy.write_text("01 WS-FIELD PIC 9.")
|
||||
p = CopybookPreprocessor(paths=[tmp])
|
||||
text = p.expand(" COPY MYCPY.\n")
|
||||
assert "WS-FIELD" in text
|
||||
|
||||
|
||||
def test_expand_not_found():
|
||||
"""PP-02: COPY 不存在 → NOT FOUND"""
|
||||
with tempfile.TemporaryDirectory() as tmp:
|
||||
p = CopybookPreprocessor(paths=[tmp])
|
||||
text = p.expand(" COPY NOTEXIST.\n")
|
||||
assert "NOT FOUND" in text
|
||||
|
||||
|
||||
def test_expand_no_copy():
|
||||
"""PP-03: 无 COPY → 原文"""
|
||||
p = CopybookPreprocessor()
|
||||
text = p.expand(" MOVE 1 TO A.\n")
|
||||
assert "MOVE 1 TO A" in text
|
||||
Reference in New Issue
Block a user