File size: 1,730 Bytes
01a492e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26

import subprocess
import sys
from pathlib import Path

cases = [{'input': '5 1 1\n*...*\n', 'output': '2\n'}, {'input': '6 2 3\n*...*.\n', 'output': '4\n'}, {'input': '11 3 10\n.*....**.*.\n', 'output': '7\n'}, {'input': '3 2 3\n***\n', 'output': '0\n'}, {'input': '9 5 3\n*...*...*\n', 'output': '6\n'}, {'input': '9 2 4\n*...*...*\n', 'output': '6\n'}, {'input': '9 2 200000\n*...*...*\n', 'output': '6\n'}, {'input': '1 0 1\n.\n', 'output': '1\n'}, {'input': '20 5 5\n.*.*.........*......\n', 'output': '10\n'}, {'input': '14 3 7\n.*.......*..*.\n', 'output': '10\n'}, {'input': '6 1 3\n*....*\n', 'output': '3\n'}, {'input': '9 2 4\n..*.*....\n', 'output': '6\n'}, {'input': '5 1 2\n...*.\n', 'output': '3\n'}, {'input': '2 2 0\n..\n', 'output': '1\n'}, {'input': '2 0 2\n..\n', 'output': '1\n'}, {'input': '10 1 1\n..........\n', 'output': '2\n'}, {'input': '4 0 1\n....\n', 'output': '1\n'}, {'input': '5 3 3\n...**\n', 'output': '3\n'}, {'input': '3 0 1\n.*.\n', 'output': '1\n'}, {'input': '4 2 2\n....\n', 'output': '4\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')