import json
from pathlib import Path

root = Path(__file__).parent
b, c = [json.loads((root / f"result-{lane}.json").read_text()) for lane in ("B", "C")]
assert b["failure"] == c["failure"] == ""
assert b["source_unchanged"] and c["source_unchanged"]
assert b["actor_writes"] == c["actor_writes"] == 0
for key, left in b["routes"].items():
    right = c["routes"][key]
    assert left["status"] == right["status"], key
    assert left["code"] == right["code"], key
    assert left["shape"] == right["shape"], key
    assert left["source_match"] and right["source_match"], key
for lane in (b, c):
    assert lane["routes"]["GET /api/cashRefund/detail"]["source_fields_checked"] == 29
    item = lane["routes"]["GET /api/finance/visitor/flows first"]
    assert item["rows"] == 3 and item["amount_string"]
    assert item["next_page_status"] == 200 and item["next_page_code"] == 0
    assert item["next_page_rows"] > 0 and item["next_page_disjoint"]
print(json.dumps({"interfaces": 3, "primary_and_error_scenarios": 6,
                  "pagination_scenarios": 1, "shapes_equal": True,
                  "individual_source_checks": True,
                  "full_business_values_equal_claimed": False,
                  "b_wide_query_performance_open": True}))
