Example #1
0
 def test_minus_circles(self):
     """Minus circles added on board"""
     game_board = a.GameBoard(8, 2, 3)
     start_count = str(game_board).count('0')
     game_board.add_circles(-1)
     game_board.stand_circles()
     self.assertTrue(start_count == str(game_board).count('0'))
Example #2
0
 def test_zero_circles(self):
     """Zero circles added on board"""
     game_board = a.GameBoard(8, 2, 3)
     start_count = str(game_board).count('0')
     game_board.add_circles(0)
     game_board.stand_circles()
     self.assertTrue(start_count == str(game_board).count('0'))
Example #3
0
 def test_full_field(self):
     """Testing on full field"""
     game_board = a.GameBoard(8, 2, 2)
     game_board.add_circles(64)
     game_board.stand_circles()
     str_field = str(game_board)
     self.assertTrue(str_field.count("0") == 0)
Example #4
0
 def test_correct_move(self):
     """Test move"""
     board = a.GameBoard(3, 2, 3)
     board._field = [[0, 1, 0], [1, 1, 1], [0, 0, 0]]
     self.assertTrue(board.make_move((1, 0), (2, 0)))
     self.assertFalse(board.make_move((1, 0), (2, 2)))
Example #5
0
 def test_correct_score(self):
     """Test getter of score"""
     board = a.GameBoard(8, 2, 3)
     self.assertEqual(board.get_score(), 0)
Example #6
0
 def test_correct_get(self):
     """Test getter of value"""
     board = a.GameBoard(8, 2, 3)
     self.assertTrue(board.get_value(5, 5) == 0 or board.get_value(5, 5))
     with self.assertRaises(IndexError):
         board.get_value(9, 9)
Example #7
0
 def test_many_circles(self):
     """Many circles added on board"""
     game_board = a.GameBoard(8, 2, 3)
     game_board.add_circles(66)
     game_board.stand_circles()
     self.assertTrue(0 == str(game_board).count('0'))
Example #8
0
 def test_correct_work(self):
     """Simple test of correct work"""
     game_board = a.GameBoard(8, 2, 2)
     str_field = str(game_board)
     leng = len(str_field)
     self.assertTrue(str_field[r.randint(0, leng - 1)])