-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtests.py
38 lines (32 loc) · 911 Bytes
/
tests.py
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
27
28
29
30
31
32
33
34
35
36
37
38
import unittest
from window import Window
from maze import Maze
from cell import Cell
class TestMaze(unittest.TestCase):
def setUp(self):
win = Window("Maze Solver - Tests", 800, 600)
# Pass win to Maze and Cell class so they can use it to draw themselves
Maze.set_win(win)
Cell.set_win(win)
def test_maze_create_cells(self):
num_cols = 12
num_rows = 10
m1 = Maze(2, 2, num_rows, num_cols)
self.assertEqual(
len(m1.get_cells()),
num_cols,
)
self.assertEqual(
len(m1.get_cells()[0]),
num_rows,
)
visited = False
for cols in m1.get_cells():
for cell in cols:
visited = cell.is_visited() or visited
self.assertEqual(
visited,
False
)
if __name__ == "__main__":
unittest.main()