codegen / assets /train /deepcoder_primeintellect /deepcoder_primeintellect_0beedf8aa04dc1a4 /test_solution.py
| import subprocess | |
| import sys | |
| from pathlib import Path | |
| cases = [{'input': '2 2 2\n', 'output': '0.333333333333 0.333333333333 0.333333333333\n'}, {'input': '2 1 2\n', 'output': '0.150000000000 0.300000000000 0.550000000000\n'}, {'input': '1 1 3\n', 'output': '0.057142857143 0.657142857143 0.285714285714\n'}, {'input': '3 2 1\n', 'output': '0.487662337662 0.072077922078 0.440259740260\n'}, {'input': '100 100 100\n', 'output': '0.333333333333 0.333333333333 0.333333333333\n'}, {'input': '1 100 100\n', 'output': '0.366003713151 0.633996286849 0.000000000000\n'}, {'input': '100 1 100\n', 'output': '0.000000000000 0.366003713151 0.633996286849\n'}, {'input': '100 100 1\n', 'output': '0.633996286849 0.000000000000 0.366003713151\n'}, {'input': '1 100 99\n', 'output': '0.369700913626 0.630299086374 0.000000000000\n'}, {'input': '99 1 100\n', 'output': '0.000000000000 0.369700913626 0.630299086374\n'}, {'input': '100 99 1\n', 'output': '0.630299086374 0.000000000000 0.369700913626\n'}, {'input': '100 1 99\n', 'output': '0.000000000000 0.362287378787 0.637712621213\n'}, {'input': '1 99 100\n', 'output': '0.362287378787 0.637712621213 0.000000000000\n'}, {'input': '99 100 1\n', 'output': '0.637712621213 0.000000000000 0.362287378787\n'}, {'input': '1 1 1\n', 'output': '0.333333333333 0.333333333333 0.333333333333\n'}, {'input': '100 100 2\n', 'output': '0.405362332237 0.000000000000 0.594637667763\n'}, {'input': '100 2 100\n', 'output': '0.000000000000 0.594637667763 0.405362332237\n'}, {'input': '2 100 100\n', 'output': '0.594637667763 0.405362332237 0.000000000000\n'}, {'input': '3 3 3\n', 'output': '0.333333333333 0.333333333333 0.333333333333\n'}, {'input': '44 54 32\n', 'output': '0.106782618787 0.143399200449 0.749818180764\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') | |