- def test_LoseHealthOrMSB_check_available(self):
- player = self.make_player()
- action = actions.LoseHeathOrMSB(set())
- self.assertEqual(action.check_available(player), True)
+ check_available(set(), [], True)
+ check_available(set(), [BITS.MSB], True)
+ check_available(set([BITS.MSB]), [], False)
+ check_available(set([BITS.MSB]), [BITS.MSB], True)
+
+ def test_DoNothing(self):
+ board = GameBoard.new_game([])
+ state_before = board.export()
+ actions.DoNothing(set()).perform_action(board)
+ state_after = board.export()
+ self.assertEqual(state_before, state_after)
+
+ def test_LoseHealthOrMSB_MSB_clear(self):
+ board = GameBoard.new_game([])
+ state_before = board.export()
+ actions.LoseHeathOrMSB(set()).perform_action(board)
+ state_after = board.export()
+ self.assertEqual(state_after['health'], state_before['health'] - 1)
+
+ state_before.pop('health')
+ state_after.pop('health')
+ self.assertEqual(state_before, state_after)