"""Run the agent post gate test cases: python test_gate.py"""
import json
from agent_post_gate import check

data = json.load(open("gate-test-cases.json", encoding="utf-8"))
failed = 0
for c in data["cases"]:
    got = check(c["proposal"], data["policies"][c["policy"]], c["state"])
    if got != c["expected"]:
        failed += 1
        print("FAIL case", c["id"], got, "expected", c["expected"])
print(f"{len(data['cases']) - failed} of {len(data['cases'])} cases pass")
raise SystemExit(1 if failed else 0)
