def test_two_winner(self):
     clark = Player("Clark")
     lex = Player("Lex")
     game = HighLow([clark, lex])
     clark.set_points(1)
     lex.set_points(1)
     self.assertEqual([clark, lex], game.winners(), "Testing game.winners() method with two players having same points.")
 def test_one_winner(self):
     clark = Player("Clark")
     lex = Player("Lex")
     game = HighLow([clark, lex])
     clark.set_points(1)
     self.assertEqual([clark], game.winners(
     ), "Simple test for game.winners() method, which must return the player with the highest points so far."
                      )
 def test_two_winner(self):
     clark = Player("Clark")
     lex = Player("Lex")
     game = HighLow([clark, lex])
     clark.set_points(1)
     lex.set_points(1)
     self.assertEqual([clark, lex], game.winners(
     ), "Testing game.winners() method with two players having same points."
                      )
 def test_high_low_two_players_two_card_game(self):
     bruce = Player("Bruce")
     clark = Player("Clark")
     two_of_hearts = Card("Heart", 2)
     two_of_spades = Card("Spade", 2)
     game = HighLow([bruce, clark])
     game.get_deck().set_cards([])
     bruce.set_cards([two_of_hearts])
     clark.set_cards([two_of_spades])
     game.play_game()
     self.assertEqual([clark], game.winners(), "Testing game.winners() method in complex setting.")
 def test_high_low_two_players_two_card_game(self):
     bruce = Player("Bruce")
     clark = Player("Clark")
     two_of_hearts = Card("Heart", 2)
     two_of_spades = Card("Spade", 2)
     game = HighLow([bruce, clark])
     game.get_deck().set_cards([])
     bruce.set_cards([two_of_hearts])
     clark.set_cards([two_of_spades])
     game.play_game()
     self.assertEqual([clark], game.winners(),
                      "Testing game.winners() method in complex setting.")
 def test_deal_cards_many_players_full_deck_game(self):
     players = []
     for player_id in range(1, 53):
         players.append(Player(str(player_id)))
         game = HighLow(players)
         winners = game.winners()
         for player in players:
             self.assertEqual(player.get_cards(), [])
             if player not in winners:
                 self.assertTrue(
                     winners[0].get_points() > player.get_points(),
                     "Testing game.winners() method. Winners' points must be bigger than any non-winner's points.",
                 )
 def test_deal_cards_many_players_full_deck_game(self):
     players = []
     for player_id in range(1, 53):
         players.append(Player(str(player_id)))
         game = HighLow(players)
         winners = game.winners()
         for player in players:
             self.assertEqual(player.get_cards(), [])
             if player not in winners:
                 self.assertTrue(
                     winners[0].get_points() > player.get_points(),
                     "Testing game.winners() method. Winners' points must be bigger than any non-winner's points."
                 )
 def test_high_low_four_players_full_deck_game(self):
     bruce = Player("Bruce")
     clark = Player("Clark")
     jack = Player("Jack")
     lex = Player("Lex")
     players = [bruce, clark, lex, jack]
     game = HighLow(players)
     game.play_game()
     winners = game.winners()
     for player in players:
         self.assertEqual(player.get_cards(), [])
         if player not in winners:
             self.assertTrue(winners[0].get_points() > player.get_points(), "Testing game.winners() method in complex setting.")
 def test_high_low_four_players_full_deck_game(self):
     bruce = Player("Bruce")
     clark = Player("Clark")
     jack = Player("Jack")
     lex = Player("Lex")
     players = [bruce, clark, lex, jack]
     game = HighLow(players)
     game.play_game()
     winners = game.winners()
     for player in players:
         self.assertEqual(player.get_cards(), [])
         if player not in winners:
             self.assertTrue(
                 winners[0].get_points() > player.get_points(),
                 "Testing game.winners() method in complex setting.")
 def test_deal_cards_many_players_full_deck_total_point_value_game(self):
     players = []
     for player_id in range(1, 53):
         total_points = 0
         players.append(Player(str(player_id)))
         for player in players:
             player.set_points(0)
         game = HighLow(players)
         game.play_game()
         winners = game.winners()
         for player in players:
             self.assertEqual(player.get_cards(), [], "After playing game, players don't have any card in hands.")
             total_points += player.get_points()
             if player not in winners:
                 self.assertTrue(
                     winners[0].get_points() > player.get_points(),
                     "Testing game.winners() method. Winners' points must be bigger than any non-winner's points.",
                 )
         self.assertEqual(total_points, 52 / player_id, "The sum of points of all the players is 52.")
 def test_high_low_four_players_eight_cards_game(self):
     bruce = Player("Bruce")
     clark = Player("Clark")
     jack = Player("Jack")
     lex = Player("Lex")
     ace_of_hearts = Card("Heart", 1)
     two_of_hearts = Card("Heart", 2)
     three_of_hearts = Card("Heart", 3)
     four_of_hearts = Card("Heart", 4)
     five_of_hearts = Card("Heart", 5)
     six_of_hearts = Card("Heart", 6)
     seven_of_hearts = Card("Heart", 7)
     eight_of_hearts = Card("Heart", 8)
     game = HighLow([bruce, clark, lex, jack])
     jack.set_cards([ace_of_hearts, two_of_hearts])
     lex.set_cards([three_of_hearts, four_of_hearts])
     clark.set_cards([five_of_hearts, six_of_hearts])
     bruce.set_cards([seven_of_hearts, eight_of_hearts])
     game.get_deck().set_cards([])
     game.play_game()
     self.assertEqual([bruce], game.winners(), "Testing game.winners() method in complex setting..")
 def test_high_low_four_players_eight_cards_game(self):
     bruce = Player("Bruce")
     clark = Player("Clark")
     jack = Player("Jack")
     lex = Player("Lex")
     ace_of_hearts = Card("Heart", 1)
     two_of_hearts = Card("Heart", 2)
     three_of_hearts = Card("Heart", 3)
     four_of_hearts = Card("Heart", 4)
     five_of_hearts = Card("Heart", 5)
     six_of_hearts = Card("Heart", 6)
     seven_of_hearts = Card("Heart", 7)
     eight_of_hearts = Card("Heart", 8)
     game = HighLow([bruce, clark, lex, jack])
     jack.set_cards([ace_of_hearts, two_of_hearts])
     lex.set_cards([three_of_hearts, four_of_hearts])
     clark.set_cards([five_of_hearts, six_of_hearts])
     bruce.set_cards([seven_of_hearts, eight_of_hearts])
     game.get_deck().set_cards([])
     game.play_game()
     self.assertEqual([bruce], game.winners(),
                      "Testing game.winners() method in complex setting..")
 def test_deal_cards_many_players_full_deck_total_point_value_game(self):
     players = []
     for player_id in range(1, 53):
         total_points = 0
         players.append(Player(str(player_id)))
         for player in players:
             player.set_points(0)
         game = HighLow(players)
         game.play_game()
         winners = game.winners()
         for player in players:
             self.assertEqual(
                 player.get_cards(), [],
                 "After playing game, players don't have any card in hands."
             )
             total_points += player.get_points()
             if player not in winners:
                 self.assertTrue(
                     winners[0].get_points() > player.get_points(),
                     "Testing game.winners() method. Winners' points must be bigger than any non-winner's points."
                 )
         self.assertEqual(total_points, 52 / player_id,
                          "The sum of points of all the players is 52.")
 def test_one_winner(self):
     clark = Player("Clark")
     lex = Player("Lex")
     game = HighLow([clark, lex])
     clark.set_points(1)
     self.assertEqual([clark], game.winners(), "Simple test for game.winners() method, which must return the player with the highest points so far.")