bc1d56d1a4
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>
43 lines
1.3 KiB
Python
43 lines
1.3 KiB
Python
"""ST-01~04: Storage — DiskCache / ReportStore / TestDataBundle"""
|
|
|
|
import sys, os, tempfile, json
|
|
from pathlib import Path
|
|
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), "..")))
|
|
from storage.store import DiskCache, ReportStore
|
|
from storage.bundle import TestDataBundle
|
|
|
|
|
|
def test_disk_cache_set_get():
|
|
"""ST-01: set/get 一致"""
|
|
with tempfile.TemporaryDirectory() as tmp:
|
|
c = DiskCache(d=tmp)
|
|
c.set("key1", {"val": 42})
|
|
assert c.get("key1") == {"val": 42}
|
|
|
|
|
|
def test_disk_cache_get_missing():
|
|
"""ST-02: 未缓存 → None"""
|
|
with tempfile.TemporaryDirectory() as tmp:
|
|
c = DiskCache(d=tmp)
|
|
assert c.get("unknown") is None
|
|
|
|
|
|
def test_report_store_save():
|
|
"""ST-03: save_history 写入"""
|
|
with tempfile.TemporaryDirectory() as tmp:
|
|
s = ReportStore(base=tmp)
|
|
s.save_history("TESTPGM", "PASS", 5, 0.5)
|
|
trend_dir = Path(tmp) / "trends"
|
|
assert trend_dir.exists()
|
|
files = list(trend_dir.glob("*.jsonl"))
|
|
assert len(files) >= 1
|
|
|
|
|
|
def test_bundle_paths():
|
|
"""ST-04: TestDataBundle 路径"""
|
|
with tempfile.TemporaryDirectory() as tmp:
|
|
b = TestDataBundle(base_path=Path(tmp))
|
|
assert "cobol" in str(b.cobol_input())
|
|
assert "spark" in str(b.spark_input_dir())
|
|
assert "native" in str(b.native_input())
|