Tests for new hand wrapping
git-svn-id: svn://sunsvr01.isp.uni-luebeck.de/swproj13/trunk@239 72836036-5685-4462-b002-a69064685172
This commit is contained in:
parent
f7f47d0072
commit
edf4197c16
1 changed files with 19 additions and 22 deletions
|
@ -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)));
|
||||
}
|
||||
}
|
||||
|
|
Reference in a new issue