diff options
author | Aineopintojen-harjoitustyo-Algoritmit-j <github-hy-tiralabra@v.hix.fi> | 2024-02-03 12:19:51 +0200 |
---|---|---|
committer | Aineopintojen-harjoitustyo-Algoritmit-j <github-hy-tiralabra@v.hix.fi> | 2024-02-03 12:19:51 +0200 |
commit | b45017cdb4d9f723202b2f110e28029f974a7c86 (patch) | |
tree | 8114c9baa74b1d6b8b6166c1c58b1b548c8a6712 | |
parent | 5e257c3cd894e7fbe350f4e58b8c75824e755a42 (diff) |
Making tests for readymade board.
-rw-r--r-- | tests/test_board.py | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/test_board.py b/tests/test_board.py index 750e75f..f664e9c 100644 --- a/tests/test_board.py +++ b/tests/test_board.py @@ -111,3 +111,19 @@ class TestBoardClass(unittest.TestCase): self.assertIn(LevelSpecs[Level.INTERMEDIATE][3], b.get_level_name()) b = Board(level=Level.INTERMEDIATE, width=25, mines=2) self.assertIn("Mukautettu", b.get_level_name()) + + def test_board_invalid(self): + """ Yritetään luoda peli kelvottomalla laudalla """ + b = Board(board=[[0,0,0,0,0],[0,0,0,1],[0,0,0,0,0]]) + self.assertIn(LevelSpecs[Level.BEGINNER][3], b.get_level_name()) + b = Board(board=[[0,0,0,0,0]]) + self.assertIn(LevelSpecs[Level.BEGINNER][3], b.get_level_name()) + b = Board(board=[[0,0,0,0],[0,0,0,0],[0,0,0,0]]) + self.assertIn(LevelSpecs[Level.BEGINNER][3], b.get_level_name()) + + def test_board_valid(self): + """ Luodaan peli kelvollisella laudalla """ + b = Board(board=[[0,0,0,0],[0,0,0,1],[0,0,0,0]]) + self.assertEqual(b.get_width(), 4) + self.assertEqual(b.get_height(), 3) + self.assertEqual(b.get_mines(), 1) |