codegen / assets /train /deepcoder_primeintellect /deepcoder_primeintellect_051e7631549cbf16 /test_solution.py
| import subprocess | |
| import sys | |
| from pathlib import Path | |
| cases = [{'input': '11\n-1 2\n', 'output': '3\n7 4\n2 10\n-1 2\n'}, {'input': '4600\n52 149\n', 'output': '-1\n'}, {'input': '4\n9 9\n', 'output': '5\n1 3\n4 2\n4 6\n6 8\n9 9\n'}, {'input': '9943\n-97653 -1777\n', 'output': '10\n'}, {'input': '411603622\n-1675 797\n', 'output': '2\n'}, {'input': '169842662\n42126 4592\n', 'output': '2\n'}, {'input': '64860\n-46171 -65442\n', 'output': '-1\n'}, {'input': '31399\n-23985 -64005\n', 'output': '4\n'}, {'input': '72515\n-1684 -2028\n', 'output': '2\n'}, {'input': '55545\n6440 3414\n', 'output': '2\n'}, {'input': '12\n-3387 14\n', 'output': '-1\n'}, {'input': '25\n360 440\n', 'output': '32\n'}, {'input': '137273866\n-75883 -100000\n', 'output': '-1\n'}, {'input': '162957408\n69008 -80583\n', 'output': '-1\n'}, {'input': '12896\n-7245 99955\n', 'output': '9\n'}, {'input': '89389\n91529 73854\n', 'output': '3\n'}, {'input': '49929\n26391 -29574\n', 'output': '3\n'}, {'input': '36023\n45523 20312\n', 'output': '3\n'}, {'input': '12\n1 20285\n', 'output': '1691\n'}, {'input': '59620\n-36256 82984\n', 'output': '2\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') | |