1 from unittest import TestCase
3 from naja.constants import BITS
4 from naja.gameboard import GameBoard, LocationCard
7 class TestGameBoard(TestCase):
8 def test_lose_health(self):
9 board = GameBoard(None, 4, 4, locations={}, state=None)
10 self.assertEqual(board.health, 4)
12 self.assertEqual(board.health, 3)
15 class TestLocationCard(TestCase):
16 def test_generate_bitwise_operand(self):
17 # This is testing a random process, so it may fail occasionally.
20 operand_sets.append(LocationCard.generate_bitwise_operand())
23 for operand_set in operand_sets:
24 sizes[len(operand_set)] += 1
25 bits.update(operand_set)
26 # TODO: Test that there's at least one condition and one direction.
27 self.assertTrue(sizes[2] > 0)
28 self.assertTrue(sizes[3] > 0)
29 self.assertTrue(sizes[2] > sizes[3])
30 self.assertEqual(bits, set(BITS.values()))