def test_check_winner_empty_active(self): """ Tests the get_winner method for empty central deck. In this case the game ends and the winner should be identified. """ deck_game = Game() deck_game.player_1 = Player('Nikos') deck_game.player_pc = Player('Computer') self.assertTrue(deck_game.check_winner(),\ 'False expected. Players\' health > 0 and central.active.size() = 0')
def test_check_winner_player_pc(self): """ Tests the get_winner method where the winner is player_pc. """ deck_game = Game() deck_game.player_1 = Player('Nikos') deck_game.player_pc = Player('Computer') deck_game.player_pc._health = 0 self.assertTrue(deck_game.check_winner(), 'True expected. Player PC wins.')
def test_check_no_winner(self): """ Tests the get_winner method where no winner found (and the game continues). """ deck_game = Game() deck_game.player_1 = Player('Nikos') deck_game.player_pc = Player('Computer') deck_game.central['active'].push(Card('Archer', 3, 1, 5)) deck_game.central['active'].push(Card('Test1', 1, 3, 3)) deck_game.central['active'].push(Card('Test2', 0, 3, 2)) self.assertFalse(deck_game.check_winner(),\ 'False expected. Players\' health > 0 and central.active.size() > 0')