codegen / assets /train /deepcoder_primeintellect /deepcoder_primeintellect_0161872faf904c07 /test_solution.py
| import subprocess | |
| import sys | |
| from pathlib import Path | |
| cases = [{'input': '2\n0 0\n2 2\n', 'output': '4\n'}, {'input': '2\n0 0\n0 3\n', 'output': '9\n'}, {'input': '2\n0 1\n1 0\n', 'output': '1\n'}, {'input': '3\n2 2\n1 1\n3 3\n', 'output': '4\n'}, {'input': '3\n3 1\n1 3\n2 2\n', 'output': '4\n'}, {'input': '3\n0 1\n1 0\n2 2\n', 'output': '4\n'}, {'input': '2\n-1000000000 -1000000000\n1000000000 1000000000\n', 'output': '4000000000000000000\n'}, {'input': '2\n1000000000 -1000000000\n-1000000000 1000000000\n', 'output': '4000000000000000000\n'}, {'input': '5\n-851545463 -208880322\n-154983867 -781305244\n293363100 785256340\n833468900 -593065920\n-920692803 -637662144\n', 'output': '3077083280271860209\n'}, {'input': '10\n-260530833 169589238\n-681955770 -35391010\n223450511 24504262\n479795061 -26191863\n-291344265 21153856\n714700263 -328447419\n-858655942 161086142\n-270884153 462537328\n-501424901 977460517\n115284904 -151626824\n', 'output': '2475449747812002025\n'}, {'input': '10\n917139470 819990899\n-69828590 691215072\n-846815289 112372447\n560780737 -890423729\n243241705 284240970\n-47397355 -263709479\n759162072 709456353\n-330469400 -597545533\n436509256 728506920\n133368867 668789238\n', 'output': '3111536391798748081\n'}, {'input': '10\n-200157522 -824574736\n299208799 -287211553\n-160170880 148363130\n103709327 245344406\n482860382 547328085\n895537733 -545816336\n671947380 910981768\n-43209851 585461399\n-573679087 427675821\n151452830 27262384\n', 'output': '3012156378576702016\n'}, {'input': '2\n-2 -2\n-3 -3\n', 'output': '1\n'}, {'input': '2\n-1000 -1000\n-1100 -1100\n', 'output': '10000\n'}, {'input': '2\n-5 -5\n-4 -4\n', 'output': '1\n'}, {'input': '2\n-10 0\n-9 0\n', 'output': '1\n'}, {'input': '2\n-10 -10\n-20 -20\n', 'output': '100\n'}, {'input': '2\n-1000000 -1000000\n-100 -100\n', 'output': '999800010000\n'}, {'input': '2\n100000000 100000000\n200000000 200000000\n', 'output': '10000000000000000\n'}, {'input': '2\n-10 10\n-2 3\n', 'output': '64\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') | |