summaryrefslogtreecommitdiff
path: root/tests/test_board.py
diff options
context:
space:
mode:
authorAineopintojen-harjoitustyo-Algoritmit-j <github-hy-tiralabra@v.hix.fi>2024-01-14 13:47:35 +0200
committerAineopintojen-harjoitustyo-Algoritmit-j <github-hy-tiralabra@v.hix.fi>2024-01-14 13:47:35 +0200
commite56c2153add98361ea7909789b195d3a702f85bb (patch)
treefd7d9691a4b62f44b2c60f5cf62f006a9476124f /tests/test_board.py
parent822d89c50a70277186f5c845e4341236548c16b7 (diff)
Moving things around and adding fouth flag option for bot suggestions.
Diffstat (limited to 'tests/test_board.py')
-rw-r--r--tests/test_board.py32
1 files changed, 17 insertions, 15 deletions
diff --git a/tests/test_board.py b/tests/test_board.py
index d87e825..5fb36ad 100644
--- a/tests/test_board.py
+++ b/tests/test_board.py
@@ -15,7 +15,7 @@ class TestBoardClass(unittest.TestCase):
b = Board(15)
self.assertEqual(b.size, 15)
- def test_get_view_and_make_guess(self):
+ def test_get_view_and_guess(self):
""" laudan näkymä on oikein senkin jälkeen kun on arvattu"""
b = Board(3)
b.tiles=[[0,0,0],[0,1,1],[0,1,9]]
@@ -25,13 +25,13 @@ class TestBoardClass(unittest.TestCase):
for i in range(3):
self.assertEqual(v[i],t[i])
- self.assertTrue(b.make_guess(0,0))
+ self.assertTrue(b.guess(0,0))
v = b.get_view()
t = [[0,0,0],[0,1,1],[0,1,10]]
for i in range(3):
self.assertEqual(v[i],t[i])
- self.assertFalse(b.make_guess(2,2))
+ self.assertFalse(b.guess(2,2))
def test_is_winning(self):
""" toimiiko voittotilanteen tunnistus """
@@ -44,13 +44,13 @@ class TestBoardClass(unittest.TestCase):
b.masked=[[0,0],[10,10]]
self.assertFalse(b.is_winning())
- def test_error_conditions_in_make_guess(self):
+ def test_error_conditions_in_guess(self):
""" ruudun avaus alueen ulkopuolelta tai avatussa ruudussa ei onnistu"""
b = Board(2)
b.tiles=[[1,9],[9,9]]
- self.assertFalse(b.make_guess(2,2))
- self.assertTrue(b.make_guess(0,0))
- self.assertFalse(b.make_guess(0,0))
+ self.assertFalse(b.guess(2,2))
+ self.assertTrue(b.guess(0,0))
+ self.assertFalse(b.guess(0,0))
def test_get_mask(self):
""" maski annetaan oikein """
@@ -58,27 +58,29 @@ class TestBoardClass(unittest.TestCase):
b.tiles=[[1,9],[9,9]]
self.assertEqual(b.get_mask(0,0), 10)
- def test_flag_tile(self):
+ def test_flag(self):
""" ruudun liputus toimii """
b = Board(2)
b.tiles=[[1,9],[9,9]]
self.assertEqual(b.get_mask(0,0), 10)
- self.assertTrue(b.flag_tile(0,0))
+ self.assertTrue(b.flag(0,0))
self.assertEqual(b.get_mask(0,0), 11)
- self.assertTrue(b.flag_tile(0,0))
+ self.assertTrue(b.flag(0,0))
self.assertEqual(b.get_mask(0,0), 12)
- self.assertTrue(b.flag_tile(0,0))
+ self.assertTrue(b.flag(0,0))
+ self.assertEqual(b.get_mask(0,0), 13)
+ self.assertTrue(b.flag(0,0))
self.assertEqual(b.get_mask(0,0), 10)
- def test_flag_tile_error_conditions(self):
+ def test_flag_error_conditions(self):
""" liputus ei onnistu jos avattu, alueen ulkopuolella, outo arvo """
b = Board(2)
b.tiles=[[1,9],[9,9]]
b.masked[0][0]=14
- self.assertFalse(b.flag_tile(0,0))
+ self.assertFalse(b.flag(0,0))
b.masked[0][0]=0
- self.assertFalse(b.flag_tile(0,0))
- self.assertFalse(b.flag_tile(2,2))
+ self.assertFalse(b.flag(0,0))
+ self.assertFalse(b.flag(2,2))
def test_reveal(self):
""" paljastuksen jälkeen näkyy laatat sellaisenaan """