Test für Änderung der StoneSet Anzahl fertig
git-svn-id: svn://sunsvr01.isp.uni-luebeck.de/swproj13/trunk@327 72836036-5685-4462-b002-a69064685172
This commit is contained in:
parent
ad2f226369
commit
c398c081ed
5 changed files with 85 additions and 24 deletions
|
@ -13,11 +13,20 @@ import static org.junit.Assert.*;
|
|||
*/
|
||||
public class StoneHeapTest {
|
||||
private StoneHeap testHeap;
|
||||
private GameSettings testSettings;
|
||||
|
||||
/** */
|
||||
@Before
|
||||
public void createHeap() {
|
||||
testHeap = new StoneHeap(new GameSettings());
|
||||
testHeap = new StoneHeap(testSettings = new GameSettings());
|
||||
}
|
||||
|
||||
private int calculateTotalNumberOfStones() {
|
||||
int totalStones = testSettings.getHighestCard()
|
||||
* testSettings.getStoneSetNumber()
|
||||
* testSettings.getStoneColors().size()
|
||||
+ testSettings.getJokerNumber();
|
||||
return totalStones;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -25,7 +34,7 @@ public class StoneHeapTest {
|
|||
*/
|
||||
@Test
|
||||
public void fullStoneHeap() {
|
||||
assertEquals(106, testHeap.heap.size());
|
||||
assertEquals(calculateTotalNumberOfStones(), testHeap.heap.size());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -33,6 +42,8 @@ public class StoneHeapTest {
|
|||
*/
|
||||
@Test
|
||||
public void fullColor() {
|
||||
int stonesOfAColor = testSettings.getHighestCard()
|
||||
* testSettings.getStoneSetNumber();
|
||||
Map<StoneColor, Integer> counters = new HashMap<StoneColor, Integer>();
|
||||
for (StoneColor c : EnumSet.allOf(StoneColor.class)) {
|
||||
counters.put(c, 0);
|
||||
|
@ -44,7 +55,7 @@ public class StoneHeapTest {
|
|||
counters.put(i.getColor(), count + 1);
|
||||
}
|
||||
for (StoneColor c : EnumSet.allOf(StoneColor.class)) {
|
||||
assertEquals(26, (long) counters.get(c));
|
||||
assertEquals(stonesOfAColor, (long) counters.get(c));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -58,14 +69,14 @@ public class StoneHeapTest {
|
|||
if (i.isJoker())
|
||||
countJoker++;
|
||||
}
|
||||
assertEquals(2, countJoker);
|
||||
assertEquals(testSettings.getJokerNumber(), countJoker);
|
||||
}
|
||||
|
||||
/** */
|
||||
@Test
|
||||
public void drawStoneTest() {
|
||||
assertNotNull(testHeap.drawStone());
|
||||
assertEquals(105, testHeap.heap.size());
|
||||
assertEquals(calculateTotalNumberOfStones() - 1, testHeap.heap.size());
|
||||
}
|
||||
|
||||
/** */
|
||||
|
@ -73,6 +84,6 @@ public class StoneHeapTest {
|
|||
public void drawStonesTest() {
|
||||
List<Stone> testStones = testHeap.drawStones(5);
|
||||
assertEquals(5, testStones.size());
|
||||
assertEquals(101, testHeap.heap.size());
|
||||
assertEquals(calculateTotalNumberOfStones() - 5, testHeap.heap.size());
|
||||
}
|
||||
}
|
||||
|
|
Reference in a new issue