From f22ff5f0f1d8f9838c30943bde658ca3f282bbc8 Mon Sep 17 00:00:00 2001 From: Ida Massow Date: Tue, 31 May 2011 00:58:46 +0200 Subject: =?UTF-8?q?Tests=20f=C3=BCr=20Sets=20mit=20mehr=20Farben,=20mehr?= =?UTF-8?q?=20Values,=20...?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: svn://sunsvr01.isp.uni-luebeck.de/swproj13/trunk@332 72836036-5685-4462-b002-a69064685172 --- test/jrummikub/control/RoundControlTest.java | 109 +++++++++++++++------------ 1 file changed, 59 insertions(+), 50 deletions(-) (limited to 'test/jrummikub/control/RoundControlTest.java') diff --git a/test/jrummikub/control/RoundControlTest.java b/test/jrummikub/control/RoundControlTest.java index fd2d3fb..f5afeea 100644 --- a/test/jrummikub/control/RoundControlTest.java +++ b/test/jrummikub/control/RoundControlTest.java @@ -70,8 +70,10 @@ public class RoundControlTest { gameSettings.getPlayerList().add(new PlayerSettings("Ida", Color.RED)); gameSettings.getPlayerList().add( new PlayerSettings("Matthias", Color.YELLOW)); - gameSettings.getPlayerList().add(new PlayerSettings("Jannis", Color.GREEN)); - gameSettings.getPlayerList().add(new PlayerSettings("Bennet", Color.BLACK)); + gameSettings.getPlayerList().add( + new PlayerSettings("Jannis", Color.GREEN)); + gameSettings.getPlayerList().add( + new PlayerSettings("Bennet", Color.BLACK)); roundState = new RoundState(gameSettings); roundControl = new RoundControl(roundState, view); } @@ -81,7 +83,8 @@ public class RoundControlTest { - testRoundState.table.getSize(), testRoundState.getGameHeap() .getSize()); for (int i = 0; i < testRoundState.getPlayerCount(); i++) { - assertEquals(14, testRoundState.getNthNextPlayer(i).getHand().getSize()); + assertEquals(14, testRoundState.getNthNextPlayer(i).getHand() + .getSize()); } } @@ -142,8 +145,8 @@ public class RoundControlTest { view.tablePanel.clickEvent.emit(new Position(0, 0)); view.playerPanel.endTurnEvent.emit(); - assertFalse(roundState.getNthNextPlayer(roundState.getPlayerCount() - 1) - .getLaidOut()); + assertFalse(roundState + .getNthNextPlayer(roundState.getPlayerCount() - 1).getLaidOut()); assertEquals(0, roundState.getTable().getSize()); assertEquals(14 + 6, hand.getSize()); } @@ -163,8 +166,8 @@ public class RoundControlTest { assertFalse(roundState.getActivePlayer().getLaidOut()); view.playerPanel.endTurnEvent.emit(); - assertFalse(roundState.getNthNextPlayer(roundState.getPlayerCount() - 1) - .getLaidOut()); + assertFalse(roundState + .getNthNextPlayer(roundState.getPlayerCount() - 1).getLaidOut()); assertEquals(0, roundState.getTable().getSize()); assertEquals(14 + 1, hand.getSize()); } @@ -211,8 +214,8 @@ public class RoundControlTest { view.tablePanel.clickEvent.emit(new Position(0, 0)); view.playerPanel.endTurnEvent.emit(); - assertFalse(roundState.getNthNextPlayer(roundState.getPlayerCount() - 1) - .getLaidOut()); + assertFalse(roundState + .getNthNextPlayer(roundState.getPlayerCount() - 1).getLaidOut()); assertEquals(0, roundState.getTable().getSize()); assertEquals(14 + 9, hand.getSize()); } @@ -282,8 +285,8 @@ public class RoundControlTest { view.tablePanel.clickEvent.emit(new Position(0, 0)); view.playerPanel.endTurnEvent.emit(); - assertFalse(roundState.getNthNextPlayer(roundState.getPlayerCount() - 1) - .getLaidOut()); + assertFalse(roundState + .getNthNextPlayer(roundState.getPlayerCount() - 1).getLaidOut()); assertEquals(2, roundState.getTable().getSize()); assertEquals(14 + 6, hand.getSize()); } @@ -356,8 +359,8 @@ public class RoundControlTest { view.tablePanel.clickEvent.emit(new Position(0, 0)); view.playerPanel.endTurnEvent.emit(); - assertFalse(roundState.getNthNextPlayer(roundState.getPlayerCount() - 1) - .getLaidOut()); + assertFalse(roundState + .getNthNextPlayer(roundState.getPlayerCount() - 1).getLaidOut()); assertEquals(2, roundState.getTable().getSize()); assertEquals(14 + 7, hand.getSize()); } @@ -420,8 +423,8 @@ public class RoundControlTest { view.tablePanel.clickEvent.emit(new Position(0, 0)); view.playerPanel.endTurnEvent.emit(); - assertFalse(roundState.getNthNextPlayer(roundState.getPlayerCount() - 1) - .getLaidOut()); + assertFalse(roundState + .getNthNextPlayer(roundState.getPlayerCount() - 1).getLaidOut()); assertEquals(2, roundState.getTable().getSize()); assertEquals(14 + 3, hand.getSize()); } @@ -679,12 +682,15 @@ public class RoundControlTest { Stone blueTwo = new Stone(2, BLUE); Stone blueThree = new Stone(3, BLUE); Stone blueFour = new Stone(4, BLUE); - StoneSet oldSet1 = new StoneSet(Arrays.asList(blueOne, redOne, blackOne)); + StoneSet oldSet1 = new StoneSet( + Arrays.asList(blueOne, redOne, blackOne)); StoneSet oldSet2 = new StoneSet(blueTwo); oldTable.drop(oldSet1, new Position(0, 0)); oldTable.drop(oldSet2, new Position(0, 0)); - StoneSet newSet1 = new StoneSet(Arrays.asList(blueOne, blueTwo, blueFour)); - StoneSet newSet2 = new StoneSet(Arrays.asList(redOne, blackOne, blueThree)); + StoneSet newSet1 = new StoneSet(Arrays.asList(blueOne, blueTwo, + blueFour)); + StoneSet newSet2 = new StoneSet(Arrays.asList(redOne, blackOne, + blueThree)); newTable.drop(newSet1, new Position(0, 0)); newTable.drop(newSet2, new Position(0, 0)); @@ -701,7 +707,7 @@ public class RoundControlTest { /** */ @Test public void testTableSetDifference() { - ITable oldTable = new Table(); + ITable oldTable = new Table(gameSettings); Stone blueOne = new Stone(1, BLUE); Stone redOne = new Stone(1, RED); Stone blackOne = new Stone(1, BLACK); @@ -709,14 +715,15 @@ public class RoundControlTest { Stone blueTwo = new Stone(2, BLUE); Stone blueThree = new Stone(3, BLUE); Stone blueFour = new Stone(4, BLUE); - StoneSet oldSet1 = new StoneSet(Arrays.asList(blueOne, redOne, blackOne, - orangeOne)); - StoneSet oldSet2 = new StoneSet(Arrays.asList(blueTwo, blueThree, blueFour)); + StoneSet oldSet1 = new StoneSet(Arrays.asList(blueOne, redOne, + blackOne, orangeOne)); + StoneSet oldSet2 = new StoneSet(Arrays.asList(blueTwo, blueThree, + blueFour)); oldTable.drop(oldSet1, new Position(0, 0)); oldTable.drop(oldSet2, new Position(0, 0)); ITable newTable = (Table) oldTable.clone(); - List newSets = RoundControl - .tableSetDifference(oldTable, newTable); + List newSets = RoundControl.tableSetDifference(oldTable, + newTable); List vanishedSets = RoundControl.tableSetDifference(newTable, oldTable); @@ -724,8 +731,8 @@ public class RoundControlTest { assertTrue(vanishedSets.isEmpty()); newTable.pickUp(oldSet2); - newTable.drop(oldSet2.join(new StoneSet(new Stone(5, BLUE))), new Position( - 0, 0)); + newTable.drop(oldSet2.join(new StoneSet(new Stone(5, BLUE))), + new Position(0, 0)); newSets = RoundControl.tableSetDifference(oldTable, newTable); vanishedSets = RoundControl.tableSetDifference(newTable, oldTable); @@ -737,7 +744,8 @@ public class RoundControlTest { Stone redTwo = new Stone(2, RED); Stone redThree = new Stone(3, RED); Stone redFour = new Stone(4, RED); - StoneSet oldSet3 = new StoneSet(Arrays.asList(redTwo, redThree, redFour)); + StoneSet oldSet3 = new StoneSet( + Arrays.asList(redTwo, redThree, redFour)); ITable newTable2 = (Table) oldTable.clone(); newTable2.drop(oldSet3, new Position(0, 0)); newSets = RoundControl.tableSetDifference(oldTable, newTable2); @@ -799,19 +807,20 @@ public class RoundControlTest { } testRoundState.players.get(0).laidOut = true; - testRoundState.players.get(0).hand.drop(new Stone(1, RED), new Position(0, - 0)); - testRoundState.players.get(0).hand.drop(new Stone(2, RED), new Position(0, - 0)); + testRoundState.players.get(0).hand.drop(new Stone(1, RED), + new Position(0, 0)); + testRoundState.players.get(0).hand.drop(new Stone(2, RED), + new Position(0, 0)); testRoundState.players.get(1).laidOut = true; - testRoundState.players.get(1).hand.drop(new Stone(RED), new Position(0, 0)); - testRoundState.players.get(2).laidOut = false; - testRoundState.players.get(2).hand.drop(new Stone(9, RED), new Position(0, - 0)); - testRoundState.players.get(2).hand.drop(new Stone(10, RED), new Position(0, - 0)); - testRoundState.players.get(2).hand.drop(new Stone(11, RED), new Position(0, + testRoundState.players.get(1).hand.drop(new Stone(RED), new Position(0, 0)); + testRoundState.players.get(2).laidOut = false; + testRoundState.players.get(2).hand.drop(new Stone(9, RED), + new Position(0, 0)); + testRoundState.players.get(2).hand.drop(new Stone(10, RED), + new Position(0, 0)); + testRoundState.players.get(2).hand.drop(new Stone(11, RED), + new Position(0, 0)); testRoundState.players.get(3).laidOut = true; testRound.endOfRound(); @@ -845,19 +854,19 @@ public class RoundControlTest { } testRoundState.players.get(0).laidOut = true; - testRoundState.players.get(0).hand.drop(new Stone(1, RED), new Position(0, - 0)); - testRoundState.players.get(0).hand.drop(new Stone(2, RED), new Position(0, - 0)); + testRoundState.players.get(0).hand.drop(new Stone(1, RED), + new Position(0, 0)); + testRoundState.players.get(0).hand.drop(new Stone(2, RED), + new Position(0, 0)); testRoundState.players.get(1).laidOut = true; - testRoundState.players.get(1).hand.drop(new Stone(3, RED), new Position(0, - 0)); + testRoundState.players.get(1).hand.drop(new Stone(3, RED), + new Position(0, 0)); testRoundState.players.get(2).laidOut = true; - testRoundState.players.get(2).hand.drop(new Stone(3, BLUE), new Position(0, - 0)); + testRoundState.players.get(2).hand.drop(new Stone(3, BLUE), + new Position(0, 0)); testRoundState.players.get(3).laidOut = false; - testRoundState.players.get(3).hand.drop(new Stone(13, RED), new Position(0, - 0)); + testRoundState.players.get(3).hand.drop(new Stone(13, RED), + new Position(0, 0)); testRound.endOfRound(); assertTrue(roundEnded); @@ -905,7 +914,7 @@ public class RoundControlTest { view.playerPanel.redealEvent.emit(); assertTrue(roundRestarted); } - + /** */ @Test public void testRedealDisallowed() { @@ -924,7 +933,7 @@ public class RoundControlTest { } assertFalse(view.playerPanel.inspectOnly); } - + /** */ @Test public void testRedealAllowed() { -- cgit v1.2.3