interplane.Get Omega
Read in your language

omnet

aien-dev/omnet

Brought by drakestapleton

branch main Branches Tags History

omnet / om / tka / test / check.py

24 lines · 1007 bytes Raw Blame History
1#!/usr/bin/env python3
2"""A mutant must complete normally with exactly the expected record count."""
3import pathlib
4import sys
5
6want = pathlib.Path(sys.argv[1]).read_text().splitlines()
7got = pathlib.Path(sys.argv[2]).read_text().splitlines()
8if len(want) != len(got):
9 for i, (a, b) in enumerate(zip(want, got)):
10 if a != b:
11 print(f"first difference record {i + 1}: expected {a[:240]}, got {b[:240]}")
12 break
13 raise SystemExit(f"FAIL record count: expected {len(want)}, got {len(got)}")
14bad = [i for i, pair in enumerate(zip(want, got)) if pair[0] != pair[1]]
15if sys.argv[3] == "mutant":
16 if not bad:
17 raise SystemExit("FAIL mutant survived")
18 print(f"PASS mutant: completed {len(got)} records, {len(bad)} differ")
19else:
20 if bad:
21 for i in bad[:10]:
22 print(f"record {i + 1}: expected {want[i][:240]}, got {got[i][:240]}")
23 raise SystemExit(f"FAIL {len(bad)} differing records")
24 print(f"PASS {len(got)} differential records")