mirror of
https://github.com/maoakeEnterprise/amazing.git
synced 2026-04-28 16:04:35 +02:00
fix some bug with my unit testing on the DFS
This commit is contained in:
+19
-3
@@ -11,7 +11,23 @@ class TestDepth:
|
||||
assert maze[0][0].value == cell.value
|
||||
|
||||
def test_rand_cells(self) -> None:
|
||||
maze = DepthFirstSearch.init_maze(10, 10)
|
||||
lst = DepthFirstSearch.add_cell_visited(maze[0][0])
|
||||
rand_cells = DepthFirstSearch.random_cells(lst, maze, 0, 1)
|
||||
w_h = (10, 10)
|
||||
lst = DepthFirstSearch.add_cell_visited((0, 0))
|
||||
rand_cells = DepthFirstSearch.random_cells(lst, (0, 1), w_h)
|
||||
assert len(rand_cells) == 2
|
||||
|
||||
def test_next_cell(self) -> None:
|
||||
coord = (5, 4)
|
||||
x, y = coord
|
||||
assert DepthFirstSearch.next_cell(x, y, "N") == (5, 3)
|
||||
|
||||
def test_reverse_path(self) -> None:
|
||||
assert DepthFirstSearch.reverse_path("N") == "S"
|
||||
|
||||
def test_last(self) -> None:
|
||||
lst = [(0, 0), (1, 1)]
|
||||
assert DepthFirstSearch.last(lst) == (1, 1)
|
||||
|
||||
def test_BOS(self) -> None:
|
||||
path = [(0, 0), (0, 2), (1, 1)]
|
||||
assert len(DepthFirstSearch.random_cells(path, (0, 1), (10, 10))) == 0
|
||||
|
||||
Reference in New Issue
Block a user