X-Git-Url: https://git.ctpug.org.za/?a=blobdiff_plain;f=naja%2Ftests%2Ftest_player.py;h=cbae8cc23c03580a14f26f9f9043a90ba124b680;hb=2e101a5b1f6b271358fc2dbb56fc1fe6d0d53f37;hp=9939f58b31c4118953f0c0b6e5f5b6cc07dd4b66;hpb=692a111f56f0e0edd19376e447b530ff4cb21521;p=naja.git diff --git a/naja/tests/test_player.py b/naja/tests/test_player.py index 9939f58..cbae8cc 100644 --- a/naja/tests/test_player.py +++ b/naja/tests/test_player.py @@ -157,3 +157,13 @@ class TestPlayer(TestCase): player = Player(0x0f, (4, 2)) self.assertEqual(player.move(BITS.EAST), False) self.assertEqual(player.position, (4, 2)) + + def test_legal_moves_all_available(self): + player = Player(0x0f, (2, 2)) + self.assertEqual( + player.legal_moves(), [(2, 1), (2, 3), (3, 2), (1, 2)]) + + def test_legal_moves_some_unavailable(self): + player = Player(0x0f, (0, 2)) + player.bits.clear_bit(BITS.NORTH) + self.assertEqual(player.legal_moves(), [(0, 3), (1, 2)])