Esempio n. 1
0
    def test_assign_players_5(self):
        player_list = []
        for i in sorted(range(0, 5)):
            interface = BasicPlayer()
            player_list.append((interface, i))

        manager = Manager(player_list)
        assignments = manager.assign_players(manager.player_pool)
        self.assertEqual(len(assignments[0]), 3)
        self.assertEqual(len(assignments[1]), 2)
Esempio n. 2
0
    def test_assign_players_under_max(self):
        """
        Purpose: Test assigning the players when the player pool is less than than maximum number of players per game
        Signature: Void -> Void
        """
        player_list = []
        for i in sorted(range(0, 2)):
            interface = BasicPlayer()
            player_list.append((interface, i))

        manager = Manager(player_list)
        assignments = manager.assign_players(manager.player_pool,
                                             max_players=4)
        self.assertEqual(len(assignments), 1)
Esempio n. 3
0
    def test_assign_players_non_default(self):
        """
        Purpose: Test assigning the players with less than the default (4) players allowed per a single game.
        Signature: Void -> Void
        """
        player_list = []
        for i in sorted(range(0, 4)):
            interface = BasicPlayer()
            player_list.append((interface, i))

        manager = Manager(player_list)
        assignments = manager.assign_players(manager.player_pool,
                                             max_players=2)
        for assignment in assignments:
            self.assertNotEqual(len(assignment), 1)
            self.assertNotEqual(len(assignment), 0)
Esempio n. 4
0
    def test_assign_players_max(self):
        """
        Purpose: Test assigning the players with the maximum number of players in a game, 4
        Signature: Void -> Void
        """
        player_list = []
        for i in sorted(range(0, 14)):
            interface = BasicPlayer()
            player_list.append((interface, i))

        manager = Manager(player_list)
        assignments = manager.assign_players(manager.player_pool)

        for assignment in assignments:
            self.assertNotEqual(len(assignment), 1)
            self.assertNotEqual(len(assignment), 0)

        self.assertEqual(len(assignments[0]), 4)
        self.assertEqual(len(assignments[len(assignments) - 1]), 2)