summaryrefslogtreecommitdiffstats
path: root/test/jrummikub
diff options
context:
space:
mode:
Diffstat (limited to 'test/jrummikub')
-rw-r--r--test/jrummikub/model/HandTest.java41
1 files changed, 19 insertions, 22 deletions
diff --git a/test/jrummikub/model/HandTest.java b/test/jrummikub/model/HandTest.java
index 46aa978..fbe694b 100644
--- a/test/jrummikub/model/HandTest.java
+++ b/test/jrummikub/model/HandTest.java
@@ -3,8 +3,12 @@ package jrummikub.model;
import static jrummikub.model.StoneColor.*;
import static org.junit.Assert.assertEquals;
+import java.util.ArrayList;
+import java.util.List;
+
import org.junit.Before;
import org.junit.Test;
+
/**
* Test class for {@link Hand}
*/
@@ -91,27 +95,20 @@ public class HandTest {
/** */
@Test
- public void testRightWrapDrop() {
- Stone stone1 = new Stone(12, ORANGE);
- Stone stone2 = new Stone(13, ORANGE);
-
- hand.drop(stone1, new Position(13, 0));
- hand.drop(stone2, new Position(12.5f, 0));
-
- assertEquals(new Position(0, 1), hand.getPosition(stone1));
- assertEquals(new Position(12.5f, 0), hand.getPosition(stone2));
- }
-
- /** */
- @Test
- public void testLeftWrapDrop() {
- Stone stone1 = new Stone(1, ORANGE);
- Stone stone2 = new Stone(2, ORANGE);
-
- hand.drop(stone1, new Position(0, 1));
- hand.drop(stone2, new Position(0.25f, 1));
-
- assertEquals(new Position(13, 0), hand.getPosition(stone1));
- assertEquals(new Position(0.25f, 1), hand.getPosition(stone2));
+ public void testFullWrapDrop() {
+ List<Stone> rowStones = new ArrayList<Stone>();
+ for (int i = 0; i < 14; i++) {
+ Stone stone = new Stone(i % 9, BLUE);
+ rowStones.add(stone);
+ hand.drop(stone, new Position(i, 1));
+ }
+ Stone newStone = new Stone(RED);
+ hand.drop(newStone, new Position(12.5f, 1));
+
+ for (int i = 0; i < 13; i++) {
+ assertEquals(new Position(i, 1), hand.getPosition(rowStones.get(i)));
+ }
+ assertEquals(new Position(13, 1), hand.getPosition(newStone));
+ assertEquals(new Position(0, 2), hand.getPosition(rowStones.get(13)));
}
}