summaryrefslogtreecommitdiffstats
path: root/test/jrummikub/model
diff options
context:
space:
mode:
authorJannis Harder <harder@informatik.uni-luebeck.de>2011-05-16 19:07:46 +0200
committerJannis Harder <harder@informatik.uni-luebeck.de>2011-05-16 19:07:46 +0200
commitedf4197c1644f22f29ec4135fc6cbee4eb37d056 (patch)
treea1aa65b5b915c47c3466b0c435defdae38bed567 /test/jrummikub/model
parentf7f47d0072fa425eb99d27933868f6bc895f9ec8 (diff)
downloadJRummikub-edf4197c1644f22f29ec4135fc6cbee4eb37d056.tar
JRummikub-edf4197c1644f22f29ec4135fc6cbee4eb37d056.zip
Tests for new hand wrapping
git-svn-id: svn://sunsvr01.isp.uni-luebeck.de/swproj13/trunk@239 72836036-5685-4462-b002-a69064685172
Diffstat (limited to 'test/jrummikub/model')
-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)));
}
}