Xnhyacinth's picture
Upload HarnessMix codegen train and held-out eval data
01a492e verified
Raw
History Blame Contribute Delete
1.96 kB
import subprocess
import sys
from pathlib import Path
cases = [{'input': '4 2\n2 3 2 3\n', 'output': '160\n'}, {'input': '5 2\n1 2 3 4 5\n', 'output': '645\n'}, {'input': '1 1\n1\n', 'output': '1\n'}, {'input': '1 1\n1000000000\n', 'output': '1000000000\n'}, {'input': '2 1\n6042 8885\n', 'output': '29854\n'}, {'input': '2 2\n8224 8138\n', 'output': '16362\n'}, {'input': '3 1\n2403 4573 3678\n', 'output': '31962\n'}, {'input': '3 2\n1880 3827 5158\n', 'output': '54325\n'}, {'input': '3 3\n4062 8888 5423\n', 'output': '18373\n'}, {'input': '4 1\n1867 5670 374 4815\n', 'output': '50904\n'}, {'input': '4 2\n4049 2220 6447 3695\n', 'output': '262576\n'}, {'input': '4 3\n3526 1473 9416 2974\n', 'output': '156501\n'}, {'input': '4 4\n9900 6535 5489 1853\n', 'output': '23777\n'}, {'input': '5 1\n6740 1359 1663 8074 5686\n', 'output': '117610\n'}, {'input': '5 2\n3113 612 440 2761 6970\n', 'output': '597528\n'}, {'input': '5 3\n9887 7162 3409 8937 3662\n', 'output': '1619793\n'}, {'input': '5 4\n9364 2224 2185 920 7650\n', 'output': '312802\n'}, {'input': '5 5\n1546 1477 962 7095 8934\n', 'output': '20014\n'}, {'input': '6 1\n3100 7048 8360 9845 7229 5331\n', 'output': '245478\n'}, {'input': '6 2\n2578 6301 8624 6020 8513 9486\n', 'output': '4401332\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')