summaryrefslogtreecommitdiffstats
path: root/test/jrummikub/model
diff options
context:
space:
mode:
authorJannis Harder <harder@informatik.uni-luebeck.de>2011-05-25 17:27:18 +0200
committerJannis Harder <harder@informatik.uni-luebeck.de>2011-05-25 17:27:18 +0200
commit5e855398b9f7168dbc5c5827da19c7fcf4605b5b (patch)
treeaf268314b695c01bb4feaa1d9bf9793adcce9d11 /test/jrummikub/model
parenta1c0cb89f67386738fc59426fd68737a393e1827 (diff)
downloadJRummikub-5e855398b9f7168dbc5c5827da19c7fcf4605b5b.tar
JRummikub-5e855398b9f7168dbc5c5827da19c7fcf4605b5b.zip
Tests for counting of identical stone pairs
git-svn-id: svn://sunsvr01.isp.uni-luebeck.de/swproj13/trunk@274 72836036-5685-4462-b002-a69064685172
Diffstat (limited to 'test/jrummikub/model')
-rw-r--r--test/jrummikub/model/HandTest.java23
1 files changed, 22 insertions, 1 deletions
diff --git a/test/jrummikub/model/HandTest.java b/test/jrummikub/model/HandTest.java
index 5396bd8..abfa9ee 100644
--- a/test/jrummikub/model/HandTest.java
+++ b/test/jrummikub/model/HandTest.java
@@ -132,11 +132,15 @@ public class HandTest {
assertEquals(56, hand.getStonePoints());
}
- private void testInitialMeld(boolean possible, List<Stone> handStones) {
+ private void dropStoneList(List<Stone> handStones) {
hand = new Hand(new GameSettings());
for (Stone stone : handStones) {
hand.drop(stone, new Position(0, 0));
}
+ }
+
+ private void testInitialMeld(boolean possible, List<Stone> handStones) {
+ dropStoneList(handStones);
assertTrue(possible == hand.isInitialMeldPossible());
}
@@ -240,4 +244,21 @@ public class HandTest {
new Stone(11, BLUE), new Stone(RED)));
}
+ /** */
+ @Test
+ public void testCountIdenticalStones() {
+ dropStoneList(Arrays.asList(new Stone(1, RED), new Stone(2, RED), new Stone(1, BLUE)));
+ assertEquals(0, hand.getIdenticalStoneCount());
+ dropStoneList(Arrays.asList(new Stone(1, RED), new Stone(1, RED), new Stone(1, BLUE)));
+ assertEquals(1, hand.getIdenticalStoneCount());
+ dropStoneList(Arrays.asList(new Stone(1, RED), new Stone(1, RED), new Stone(1, BLUE), new Stone(1, BLUE)));
+ assertEquals(2, hand.getIdenticalStoneCount());
+ dropStoneList(Arrays.asList(new Stone(1, RED), new Stone(1, RED), new Stone(1, RED)));
+ assertEquals(1, hand.getIdenticalStoneCount());
+ dropStoneList(Arrays.asList(new Stone(1, RED), new Stone(1, RED), new Stone(1, RED), new Stone(1, RED)));
+ assertEquals(2, hand.getIdenticalStoneCount());
+ dropStoneList(Arrays.asList(new Stone(RED), new Stone(RED)));
+ assertEquals(0, hand.getIdenticalStoneCount());
+
+ }
}