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']
checks=[]
for case in cases:
    got,ok=check_case(case); inv=invariant_checks(case)
    print(f"{case['id']}: expected={case['expected']} got={got} {'PASS' if ok and all(inv) else 'FAIL'}")
    checks.extend(inv)
passed=sum(bool(x) for x in checks); total=len(checks)
print(f"CHECKS {passed}/{total} PASS")
raise SystemExit(0 if passed==total else 1)
