summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorAineopintojen-harjoitustyo-Algoritmit-j <github-hy-tiralabra@v.hix.fi>2024-01-11 20:28:20 +0200
committerAineopintojen-harjoitustyo-Algoritmit-j <github-hy-tiralabra@v.hix.fi>2024-01-11 20:28:20 +0200
commit134a7d0960ceb2ab29d60f939a491d6a2d3461e5 (patch)
treeb2cb4d26162d7387e30ef93694097ab12f8a4ada /tests
parent350db68b68498fc12b7b6a749583314e1ec0cfbe (diff)
Adding initial version of Board class.
Diffstat (limited to 'tests')
-rw-r--r--tests/test_board.py30
1 files changed, 30 insertions, 0 deletions
diff --git a/tests/test_board.py b/tests/test_board.py
new file mode 100644
index 0000000..8fa2fa3
--- /dev/null
+++ b/tests/test_board.py
@@ -0,0 +1,30 @@
+import unittest
+from board.board import Board
+
+class TestBoardClass(unittest.TestCase):
+ def test_init(self):
+ b = Board()
+ self.assertTrue(b.size>0)
+
+ def test_init_with_size(self):
+ b = Board(15)
+ self.assertEqual(b.size, 15)
+
+ def test_get_view_and_make_guess(self):
+ b = Board(3)
+ b.tiles=[[0,0,0],[0,1,1],[0,1,9]]
+
+ v = b.get_view()
+ t = [[10,10,10],[10,10,10],[10,10,10]]
+ for i in range(3):
+ self.assertEqual(v[i],t[i])
+
+ self.assertTrue(b.make_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))
+
+ \ No newline at end of file