from pathlib import Path
import json
from evaluator import check_case,invariant_checks
P=Path(__file__).parent/"fixtures/cases.json"
cases=json.loads(P.read_text(encoding="utf-8"))["cases"]
passed=0; total=0
for c in cases:
    got,ok=check_case(c); total+=1; passed+=int(ok)
    inv=invariant_checks(c); total+=len(inv); passed+=sum(bool(x) for x in inv)
    print(f"{c['id']}: expected={c['expected']} got={got} case={'PASS' if ok else 'FAIL'} invariants={sum(inv)}/{len(inv)}")
print(f"CHECKS {passed}/{total} PASS")
raise SystemExit(0 if passed==total else 1)
