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:
hangshuo652
2026-06-19 23:51:55 +08:00
parent 63b5284715
commit bc1d56d1a4
129 changed files with 19378 additions and 261 deletions
+33
View File
@@ -0,0 +1,33 @@
"""QL-01~04: Quality — L1OffsetValidator / L2RoundtripValidator"""
import sys, os
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), "..")))
from quality.l1_offset_validate import L1OffsetValidator
from quality.l2_value_roundtrip import L2RoundtripValidator
from data.field_tree import FieldTree, Field
def test_l1_validate():
"""QL-01: L1 validate runs (可能无 cobc)"""
v = L1OffsetValidator()
tree = FieldTree(fields=[Field(name="WS-A", level=5, pic="9(4)")])
result = v.validate(tree, "/tmp/test.cbl")
assert "score" in result or "mismatches" in result
def test_l2_no_comp3():
"""QL-03: 无 COMP-3 → pass=True"""
v = L2RoundtripValidator()
tree = FieldTree(fields=[Field(name="WS-A", level=5, pic="9(4)")])
result = v.validate(tree)
assert result["pass"] is True
def test_l2_with_comp3():
"""QL-04: 有 COMP-3 → 字段值正确"""
v = L2RoundtripValidator()
tree = FieldTree(fields=[Field(name="WS-AMT", level=5, pic="S9(7)V99",
usage="COMP-3", length=5)])
result = v.validate(tree)
assert result["pass"] is True
assert len(result["results"]) >= 1