codegen / assets /train /deepcoder_primeintellect /deepcoder_primeintellect_079b66524812b34a /test_solution.py
| import subprocess | |
| import sys | |
| from pathlib import Path | |
| cases = [{'input': '3 3\n><>\nv^v\n', 'output': 'NO\n'}, {'input': '4 6\n<><>\nv^v^v^\n', 'output': 'YES\n'}, {'input': '2 2\n<>\nv^\n', 'output': 'YES\n'}, {'input': '2 2\n>>\n^v\n', 'output': 'NO\n'}, {'input': '3 3\n>><\n^^v\n', 'output': 'YES\n'}, {'input': '3 4\n>><\n^v^v\n', 'output': 'YES\n'}, {'input': '3 8\n>><\nv^^^^^^^\n', 'output': 'NO\n'}, {'input': '7 2\n<><<<<>\n^^\n', 'output': 'NO\n'}, {'input': '4 5\n><<<\n^^^^v\n', 'output': 'YES\n'}, {'input': '2 20\n><\n^v^^v^^v^^^v^vv^vv^^\n', 'output': 'NO\n'}, {'input': '2 20\n<>\nv^vv^v^^vvv^^^v^vvv^\n', 'output': 'YES\n'}, {'input': '20 2\n<><<><<>><<<>><><<<<\n^^\n', 'output': 'NO\n'}, {'input': '20 2\n><>><>><>><<<><<><><\n^v\n', 'output': 'YES\n'}, {'input': '11 12\n><<<><><<>>\nvv^^^^vvvvv^\n', 'output': 'NO\n'}, {'input': '4 18\n<<>>\nv^v^v^^vvvv^v^^vv^\n', 'output': 'YES\n'}, {'input': '16 11\n<<<<>><><<<<<><<\nvv^v^vvvv^v\n', 'output': 'NO\n'}, {'input': '14 7\n><<<<>>>>>>><<\nvv^^^vv\n', 'output': 'NO\n'}, {'input': '5 14\n<<><>\nv^vv^^vv^v^^^v\n', 'output': 'NO\n'}, {'input': '8 18\n>>>><>>>\nv^vv^v^^^^^vvv^^vv\n', 'output': 'NO\n'}, {'input': '18 18\n<<><>><<>><>><><<<\n^^v^v^vvvv^v^vv^vv\n', 'output': 'NO\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') | |