Start of some game board stuff.
[naja.git] / naja / tests / test_gameboard.py
1 from unittest import TestCase
2
3 from naja.constants import BITS
4 from naja.gameboard import LocationCard
5
6
7 class TestLocationCard(TestCase):
8     def test_generate_bitwise_operand(self):
9         # This is testing a random process, so it may fail occasionally.
10         operand_sets = []
11         for _ in range(100):
12             operand_sets.append(LocationCard.generate_bitwise_operand())
13         sizes = {2: 0, 3: 0}
14         bits = set()
15         for operand_set in operand_sets:
16             sizes[len(operand_set)] += 1
17             bits.update(operand_set)
18             # TODO: Test that there's at least one condition and one direction.
19         self.assertTrue(sizes[2] > 0)
20         self.assertTrue(sizes[3] > 0)
21         self.assertTrue(sizes[2] > sizes[3])
22         self.assertEqual(bits, set(BITS.values()))