Commit 8e117e4a authored by Adam Blank's avatar Adam Blank
Browse files

Update test_get_hits.py

parent 8081863a
No related merge requests found
Pipeline #118945 canceled with stage
Showing with 10 additions and 10 deletions
+10 -10
...@@ -3,18 +3,18 @@ from src.harder_computer import get_hits ...@@ -3,18 +3,18 @@ from src.harder_computer import get_hits
from src.shot import HIT, MISS, SUNK from src.shot import HIT, MISS, SUNK
from tests.helpers.naming import apply_names from tests.helpers.naming import apply_names
@pytest.mark.parametrize('inputs, expected', apply_names('get_hits', [True, False], [ @pytest.mark.parametrize('inputs, expected', apply_names('get_hits', [True, False], [
([], []), ([], []),
([((0,0), HIT)], [(0,0)]), ([((0, 0), HIT)], [(0, 0)]),
([((1,1), MISS)], []), ([((1, 1), MISS)], []),
([((1,2), SUNK)], []), ([((1, 2), SUNK)], []),
([((0,0), HIT), ((0,1), MISS), ((1,1), HIT), ((2,1), SUNK)], [(0,0), (1,1)]), ([((0, 0), HIT), ((0, 1), MISS), ((1, 1), HIT), ((2, 1), SUNK)], [(0, 0), (1, 1)]),
([((0,0), HIT), ((0,1), HIT), ((1,1), HIT), ((2,1), HIT)], [(0,0), (0,1), (1,1), (2,1)]), ([((0, 0), HIT), ((0, 1), HIT), ((1, 1), HIT),
([((0,0), MISS), ((0,1), SUNK), ((1,1), MISS), ((2,1), HIT)], [(2,1)]), ((2, 1), HIT)], [(0, 0), (0, 1), (1, 1), (2, 1)]),
([((0, 0), MISS), ((0, 1), SUNK), ((1, 1), MISS), ((2, 1), HIT)], [(2, 1)]),
])) ]))
def test_get_hits(inputs, expected): def test_get_hits(inputs, expected):
result = get_hits(inputs) result = get_hits(inputs)
assert expected == result, (f"On an 8x8 board, the following inputs to the get_hits function:" assert expected == result, (f"On an 8x8 board, the following inputs to the get_hits "
f"\n{inputs}\nlead to the following output:\n{result}\nwhen we " f"function:\n {inputs}\n lead to the expected output:\n {expected}.")
f"expect:\n{expected}.")
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment