interplane.Get Omega
Read in your language

omega-feel

This project has not described itself yet.

Brought by drakestapleton

branch main Branches Tags History

omega-feel / tests / round40 / check.py

28 lines · 1740 bytes Raw Blame History
1"""Check real engine records against the unmodified engine, then build input for both decision oracles."""
2import sys
3from pathlib import Path
4
5folder = Path(sys.argv[1])
6for variant, steps, baseline in [("live", 68, "ollm-new-68"), ("broken", 35, "ollm-new-35")]:
7 def read_run(name):
8 lines = (folder / (name + ".log")).read_text().splitlines()
9 records = [line.split()[:-1] for line in lines if line.startswith(("KI ", "KF "))]
10 if len(records) != steps * 2 or lines[-1].split()[:3] != ["KVCMP", str(steps), "0"]:
11 sys.exit(f"{name}: expected {steps} incremental and full comparisons, all bits equal")
12 return records
13
14 if read_run(variant) != read_run(baseline):
15 sys.exit(f"{variant}: token/context records changed")
16 lines = (folder / (variant + ".events")).read_text().splitlines()
17 samples = [line for line in lines if line.startswith("t ")]
18 events = [line for line in lines if line.startswith("0 ")]
19 if len(samples) != 2 * steps or len(samples) + len(events) != len(lines):
20 sys.exit(f"{variant}: missing samples or unknown output")
21 if variant == "live":
22 if events[:1] != ["0 M 1 67"] or not any(line.split()[3] != "0" for line in samples):
23 sys.exit("The equal candidate did not enter timing")
24 elif events != ["0 B 1 65"] or any(line.split()[2:4] != ["0", "0"] for line in samples):
25 sys.exit("The wrong candidate must be banned on the first comparison, before timing")
26 (folder / (variant + ".trace")).write_text("c 0 2\n" + "\n".join(samples) + "\n")
27 (folder / (variant + ".decisions")).write_text("\n".join(events) + "\n")
28 print(f"PASS {variant}: {steps} tokens, {len(samples)} launches, decisions {events}")