Xnhyacinth's picture
Upload HarnessMix codegen train and held-out eval data
01a492e verified
Raw
History Blame Contribute Delete
1.55 kB
import subprocess
import sys
from pathlib import Path
cases = [{'input': '0 0\n', 'output': '0\n'}, {'input': '1 0\n', 'output': '0\n'}, {'input': '0 1\n', 'output': '2\n'}, {'input': '-1 -1\n', 'output': '3\n'}, {'input': '10 10\n', 'output': '37\n'}, {'input': '0 6\n', 'output': '22\n'}, {'input': '-7 -13\n', 'output': '52\n'}, {'input': '37 -100\n', 'output': '400\n'}, {'input': '99 100\n', 'output': '398\n'}, {'input': '16 -32\n', 'output': '128\n'}, {'input': '1 1\n', 'output': '1\n'}, {'input': '-1 1\n', 'output': '2\n'}, {'input': '-1 0\n', 'output': '3\n'}, {'input': '3 -5\n', 'output': '20\n'}, {'input': '0 -1\n', 'output': '4\n'}, {'input': '1 -1\n', 'output': '4\n'}, {'input': '100 100\n', 'output': '397\n'}, {'input': '0 99\n', 'output': '394\n'}, {'input': '-98 98\n', 'output': '390\n'}, {'input': '-97 0\n', 'output': '387\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')