use of mage.game.tournament.Round in project mage by magefree.
the class SwissPairingMinimalWeightMatchingTest method FivePlayersThirdRoundTest.
@Test
public void FivePlayersThirdRoundTest() {
// 1 > 2
// 3 > 4
// 5
//
// 1 > 5
// 2 > 3
// 4
TournamentPlayer player1 = new TournamentPlayer(new PlayerStub(), null);
TournamentPlayer player2 = new TournamentPlayer(new PlayerStub(), null);
TournamentPlayer player3 = new TournamentPlayer(new PlayerStub(), null);
TournamentPlayer player4 = new TournamentPlayer(new PlayerStub(), null);
TournamentPlayer player5 = new TournamentPlayer(new PlayerStub(), null);
List<TournamentPlayer> players = new ArrayList<>();
players.add(player4);
players.add(player2);
players.add(player5);
players.add(player3);
players.add(player1);
player1.setPoints(6);
player2.setPoints(3);
player3.setPoints(3);
player4.setPoints(3);
player5.setPoints(3);
List<Round> rounds = new ArrayList<>();
// first round
Round round = new Round(1, new TournamentStub());
TournamentPairing pair1 = new TournamentPairing(player1, player2);
round.addPairing(pair1);
TournamentPairing pair2 = new TournamentPairing(player3, player4);
round.addPairing(pair2);
round.getPlayerByes().add(player5);
rounds.add(round);
// second round
round = new Round(1, new TournamentStub());
pair1 = new TournamentPairing(player1, player5);
round.addPairing(pair1);
pair2 = new TournamentPairing(player2, player3);
round.addPairing(pair2);
round.getPlayerByes().add(player4);
rounds.add(round);
SwissPairingMinimalWeightMatching swissPairing = new SwissPairingMinimalWeightMatching(players, rounds, false);
RoundPairings roundPairings = swissPairing.getRoundPairings();
Assert.assertEquals(2, roundPairings.getPairings().size());
Assert.assertEquals(1, roundPairings.getPlayerByes().size());
CheckPair(roundPairings.getPairings(), player1, player4);
CheckPair(roundPairings.getPairings(), player2, player5);
Assert.assertTrue(roundPairings.getPlayerByes().contains(player3));
}
Aggregations