from pathlib import Path
import json
from evaluator import check_case,invariants
P=Path(__file__).parent/'fixtures/cases.json'
total=passed=0
for c in json.loads(P.read_text(encoding='utf-8'))['cases']:
    got,ok=check_case(c); total+=1; passed+=int(ok)
    inv=invariants(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)
