codegen / assets /train /deepcoder_primeintellect /deepcoder_primeintellect_07b3a8eb9e623e66 /test_solution.py
| import subprocess | |
| import sys | |
| from pathlib import Path | |
| cases = [{'input': '2\n-1 1\n', 'output': '2'}, {'input': '4\n0 0 0 0\n', 'output': '4'}, {'input': '5\n-5 -3 5 3 0\n', 'output': '13'}, {'input': '1\n-1000000000\n', 'output': '1000000001'}, {'input': '1\n1000000000\n', 'output': '999999999'}, {'input': '3\n-525187879 0 425880698\n', 'output': '951068576'}, {'input': '20\n459151683 279504854 500320491 715966379 484152147 179708763 -312314917 -468953627 -816236061 -171030930 902332207 -4832598 -28162448 239469235 -142309467 -836437664 -658075191 -748965205 483598661 348267125\n', 'output': '8779789633'}, {'input': '21\n-302243520 63294374 -424314405 -870258491 110759377 321300735 569988467 -852033606 -987112183 -475943648 -819355234 638293308 -994532751 429802893 835649195 87211677 777780027 -153917281 38936757 -554828220 -179853036\n', 'output': '10487409166'}, {'input': '22\n99039804 -580368436 -694542422 231508622 -490965348 958087037 -570157955 560902976 -840005981 -837792364 -708462966 468364483 443419189 -631099451 -154223559 102960509 -225552439 507250810 -712228569 989896753 965939784 0\n', 'output': '11772769437'}, {'input': '3\n-1 0 0\n', 'output': '2'}, {'input': '3\n0 0 -2\n', 'output': '3'}, {'input': '7\n0 0 -3 -4 -5 6 7\n', 'output': '22'}, {'input': '4\n1 -1 0 0\n', 'output': '2'}, {'input': '2\n-1 -1\n', 'output': '0'}, {'input': '5\n-2 -2 -2 -2 -2\n', 'output': '7'}, {'input': '4\n-1 0 0 0\n', 'output': '3'}, {'input': '10\n-2 -2 -2 0 0 0 0 2 2 2\n', 'output': '10'}, {'input': '5\n-1 -1 -1 0 0\n', 'output': '2'}, {'input': '3\n0 0 -1\n', 'output': '2'}, {'input': '4\n-3 -3 -3 1\n', 'output': '8'}] | |
| 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') | |