Xnhyacinth's picture
Upload HarnessMix codegen train and held-out eval data
01a492e verified
Raw
History Blame Contribute Delete
1.23 kB
import subprocess
import sys
from pathlib import Path
cases = [{'input': '3\n1 2 0\n', 'output': '4'}, {'input': '10\n1 2 3 4 5 6 1 2 9 10\n', 'output': '11'}, {'input': '1\n123\n', 'output': '1'}, {'input': '10\n6 8 4 5 1 9 10 2 3 7\n', 'output': '15'}, {'input': '7\n1 2 4 8 16 32 64\n', 'output': '28'}, {'input': '10\n375813 659427 484038 348181 432640 368050 271089 721588 345312 630771\n', 'output': '29'}, {'input': '5\n0 1 2 0 4\n', 'output': '7'}, {'input': '1\n0\n', 'output': '1'}, {'input': '1\n1000000\n', 'output': '1'}]
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')