summaryrefslogtreecommitdiff
path: root/tests/test_board.py
diff options
context:
space:
mode:
authorAineopintojen-harjoitustyo-Algoritmit-j <github-hy-tiralabra@v.hix.fi>2024-01-17 13:16:56 +0200
committerAineopintojen-harjoitustyo-Algoritmit-j <github-hy-tiralabra@v.hix.fi>2024-01-17 13:16:56 +0200
commit9acab08eeede3a3c065057d4466ccaef2035b55d (patch)
tree9145cf28a8dfe2e4dc5eb0aea587bdd35c7ac1ca /tests/test_board.py
parent823877510422f6ce2952de5cc40edd0d62d813e4 (diff)
Making board compatible with non square playing areas like expert 30x16.
Diffstat (limited to 'tests/test_board.py')
-rw-r--r--tests/test_board.py21
1 files changed, 11 insertions, 10 deletions
diff --git a/tests/test_board.py b/tests/test_board.py
index 1bbd079..a74be9a 100644
--- a/tests/test_board.py
+++ b/tests/test_board.py
@@ -8,16 +8,17 @@ class TestBoardClass(unittest.TestCase):
def test_init(self):
""" olion luominen onnistuu """
b = Board()
- self.assertTrue(b.size>0)
+ self.assertTrue(b.get_width()>0)
def test_init_with_size(self):
""" olion luominen onnistuu tietyllä koolla"""
- b = Board(15)
- self.assertEqual(b.size, 15)
+ b = Board(30, 15)
+ self.assertEqual(b.get_width(), 30)
+ self.assertEqual(b.get_height(), 15)
def test_get_view_and_guess(self):
""" laudan näkymä on oikein senkin jälkeen kun on arvattu"""
- b = Board(3)
+ b = Board(3,3)
b.tiles=[[0,0,0],[0,1,1],[0,1,9]]
v = b.get_view()
@@ -35,7 +36,7 @@ class TestBoardClass(unittest.TestCase):
def test_is_winning(self):
""" toimiiko voittotilanteen tunnistus """
- b = Board(2)
+ b = Board(2,2)
b.tiles=[[1,9],[9,9]]
b.masked=[[12,12],[12,12]]
self.assertFalse(b.is_winning())
@@ -46,7 +47,7 @@ class TestBoardClass(unittest.TestCase):
def test_error_conditions_in_guess(self):
""" ruudun avaus alueen ulkopuolelta tai avatussa ruudussa ei onnistu"""
- b = Board(2)
+ b = Board(2,2)
b.tiles=[[1,9],[9,9]]
self.assertFalse(b.guess(2,2))
self.assertTrue(b.guess(0,0))
@@ -54,13 +55,13 @@ class TestBoardClass(unittest.TestCase):
def test_get_mask(self):
""" maski annetaan oikein """
- b = Board(2)
+ b = Board(2,2)
b.tiles=[[1,9],[9,9]]
self.assertEqual(b.get_mask(0,0), 12)
def test_flag(self):
""" ruudun liputus toimii """
- b = Board(2)
+ b = Board(2,2)
b.tiles=[[1,9],[9,9]]
self.assertEqual(b.get_mask(0,0), 12)
self.assertTrue(b.flag(0,0))
@@ -76,7 +77,7 @@ class TestBoardClass(unittest.TestCase):
def test_flag_error_conditions(self):
""" liputus ei onnistu jos avattu, alueen ulkopuolella, outo arvo """
- b = Board(2)
+ b = Board(2,2)
b.tiles=[[1,9],[9,9]]
b.masked[0][0]=6
self.assertFalse(b.flag(0,0))
@@ -88,7 +89,7 @@ class TestBoardClass(unittest.TestCase):
def test_reveal(self):
""" paljastuksen jälkeen näkyy laatat sellaisenaan """
- b = Board(2)
+ b = Board(2,2)
b.reveal()
t = b.tiles
v = b.get_view()