Xnhyacinth's picture
Upload HarnessMix codegen train and held-out eval data
01a492e verified
Raw
History Blame Contribute Delete
2.09 kB
import subprocess
import sys
from pathlib import Path
cases = [{'input': '2\n0 1\n1 0\n', 'output': '2 1\n'}, {'input': '5\n0 2 2 1 2\n2 0 4 1 3\n2 4 0 1 3\n1 1 1 0 1\n2 3 3 1 0\n', 'output': '2 5 4 1 3\n'}, {'input': '10\n0 1 5 2 5 3 4 5 5 5\n1 0 1 1 1 1 1 1 1 1\n5 1 0 2 6 3 4 6 6 6\n2 1 2 0 2 2 2 2 2 2\n5 1 6 2 0 3 4 8 8 7\n3 1 3 2 3 0 3 3 3 3\n4 1 4 2 4 3 0 4 4 4\n5 1 6 2 8 3 4 0 9 7\n5 1 6 2 8 3 4 9 0 7\n5 1 6 2 7 3 4 7 7 0\n', 'output': '5 1 6 2 8 3 4 10 9 7\n'}, {'input': '4\n0 1 3 2\n1 0 1 1\n3 1 0 2\n2 1 2 0\n', 'output': '4 1 3 2\n'}, {'input': '7\n0 3 2 4 1 4 4\n3 0 2 3 1 3 3\n2 2 0 2 1 2 2\n4 3 2 0 1 5 5\n1 1 1 1 0 1 1\n4 3 2 5 1 0 6\n4 3 2 5 1 6 0\n', 'output': '4 3 2 5 1 7 6\n'}, {'input': '10\n0 4 4 1 4 4 4 2 3 4\n4 0 5 1 6 8 9 2 3 7\n4 5 0 1 5 5 5 2 3 5\n1 1 1 0 1 1 1 1 1 1\n4 6 5 1 0 6 6 2 3 6\n4 8 5 1 6 0 8 2 3 7\n4 9 5 1 6 8 0 2 3 7\n2 2 2 1 2 2 2 0 2 2\n3 3 3 1 3 3 3 2 0 3\n4 7 5 1 6 7 7 2 3 0\n', 'output': '4 10 5 1 6 8 9 2 3 7\n'}, {'input': '13\n0 5 5 2 5 4 5 5 3 5 5 5 1\n5 0 6 2 6 4 6 6 3 6 6 6 1\n5 6 0 2 10 4 7 10 3 8 10 9 1\n2 2 2 0 2 2 2 2 2 2 2 2 1\n5 6 10 2 0 4 7 12 3 8 11 9 1\n4 4 4 2 4 0 4 4 3 4 4 4 1\n5 6 7 2 7 4 0 7 3 7 7 7 1\n5 6 10 2 12 4 7 0 3 8 11 9 1\n3 3 3 2 3 3 3 3 0 3 3 3 1\n5 6 8 2 8 4 7 8 3 0 8 8 1\n5 6 10 2 11 4 7 11 3 8 0 9 1\n5 6 9 2 9 4 7 9 3 8 9 0 1\n1 1 1 1 1 1 1 1 1 1 1 1 0\n', 'output': '5 6 10 2 13 4 7 12 3 8 11 9 1\n'}]
solution = Path(__file__).with_name("solution.py")
for index, case in enumerate(cases):
proc = subprocess.run(
[sys.executable, str(solution)],
input=case["input"],
text=True,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
timeout=10,
)
if proc.returncode != 0:
raise AssertionError(f"case {index} exited {proc.returncode}: {proc.stderr}")
got = proc.stdout.strip()
expected = case["output"].strip()
if got.split() != expected.split():
raise AssertionError(
f"case {index} output mismatch\nexpected={expected!r}\ngot={got!r}\nstderr={proc.stderr}"
)
print('deepcoder_primeintellect_io')