X-Git-Url: https://git.ctpug.org.za/?a=blobdiff_plain;f=naja%2Ftests%2Ftest_actions.py;h=f590caa9e576adf99e6cb1ab9dbebd3dda15e498;hb=c100c349d722cd81b8aea015ae09b1627ca67883;hp=5cf4c76011958267a324087a7a5eae9706fe6b19;hpb=87f51eafe4495e6ca13cf1702e0c9dce4862dc49;p=naja.git diff --git a/naja/tests/test_actions.py b/naja/tests/test_actions.py index 5cf4c76..f590caa 100644 --- a/naja/tests/test_actions.py +++ b/naja/tests/test_actions.py @@ -1,6 +1,6 @@ from unittest import TestCase -from naja.constants import BITS +from naja.constants import BITS, MOVES from naja.gameboard import GameBoard, LocationCard from naja.player import Player from naja import actions @@ -77,10 +77,6 @@ class TestActions(TestCase): action_west = DirectionAction([], direction='WEST') self.assertEqual(action_west.get_text(), "foo WEST row") - def test_bits_translation(self): - action = actions.LocationAction(set([BITS.NORTH, 'MSB'])) - self.assertEqual(action.required_bits, set([BITS.NORTH, BITS.MSB])) - def test_DoNothing(self): board = self.make_board() state_before = board.export() @@ -191,3 +187,20 @@ class TestActions(TestCase): self.assert_state( state_before, state_after, exclude=['health'], player_exclude=['bits']) + + def test_AllowKnightMove(self): + board = self.make_board(player_bits=[BITS.RED, BITS.BLUE]) + actions.AllowChessMove(set([BITS.RED, BITS.BLUE]), chesspiece="KNIGHT").perform_action(board, None) + self.assertEqual(board.player.movement_mode, MOVES.KNIGHT) + + + def test_AllowBishopMove(self): + board = self.make_board(player_bits=[BITS.RED, BITS.BLUE]) + actions.AllowChessMove(set([BITS.RED, BITS.BLUE]), chesspiece="BISHOP").perform_action(board, None) + self.assertEqual(board.player.movement_mode, MOVES.BISHOP) + + + def test_AllowCastleMove(self): + board = self.make_board(player_bits=[BITS.RED, BITS.BLUE]) + actions.AllowChessMove(set([BITS.RED, BITS.BLUE]), chesspiece="CASTLE").perform_action(board, None) + self.assertEqual(board.player.movement_mode, MOVES.CASTLE)