import json
from pathlib import Path
p = Path(__file__).parent
b,c = [json.loads((p/f"result-{lane}.json").read_text()) for lane in ("B","C")]
for result in (b,c):
    assert result["failure"] == "" and result["source_unchanged"]
    assert result["database_writes"] == 0
    assert result["boundary"]["business_constant"] == "BUSINESS_VALUE"
    assert not result["boundary"]["school_feature"]
    assert len(result["routes"]) == 6
    for name,row in result["routes"].items():
        assert row["method"] == "POST" and row["status"] == 200 and row["code"] == 0
        if name == "options":
            assert row["complete_source_values_and_order"] and row["rows"] > 0
        else:
            assert row["all_field_values_match"] and row["pagination_match"]
    assert result["routes"]["list_page1"]["field_count"] == 17
for name in ("list_page1","list_lower_clamp","list_name","list_empty","options"):
    assert b["routes"][name]["wire_shape"] == c["routes"][name]["wire_shape"],name
# page2 legitimately differs because B has 15 natural rows and C has only 4.
assert b["routes"]["list_page2"]["rows"] == 5 and c["routes"]["list_page2"]["rows"] == 0
print(json.dumps({"unique_post_keys":2,"scenarios_each_engine":6,
                  "all_17_area_row_fields_values_verified":True,
                  "complete_options_source_values_and_order_verified":True,
                  "compared_nonempty_or_equal_empty_wire_shapes":5,
                  "second_page_natural_cardinality_difference":True,
                  "cross_database_full_natural_values_equal_claimed":False}))
