summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2014-10-01 14:09:09 +0200
committerJérémy Zurcher <jeremy@asynk.ch>2014-10-01 14:09:09 +0200
commit92f494cfe43c5fd078a0d2843281f23b96862cdf (patch)
treef05faf8bafc92e9fa6396c0cf66fa5bd2d77f440
parent0ff51a456823af3a416f16d2bb92427a4c9f3d68 (diff)
downloadRustAndDust-92f494cfe43c5fd078a0d2843281f23b96862cdf.zip
RustAndDust-92f494cfe43c5fd078a0d2843281f23b96862cdf.tar.gz
add tests for Board.possiblePaths(...)
-rw-r--r--core/test/ch/asynk/tankontank/BoardUtils.java18
1 files changed, 16 insertions, 2 deletions
diff --git a/core/test/ch/asynk/tankontank/BoardUtils.java b/core/test/ch/asynk/tankontank/BoardUtils.java
index cea97ff..21a65be 100644
--- a/core/test/ch/asynk/tankontank/BoardUtils.java
+++ b/core/test/ch/asynk/tankontank/BoardUtils.java
@@ -2,10 +2,13 @@ package ch.asynk.tankontank;
import java.util.List;
import java.util.Vector;
+import java.util.HashSet;
import org.junit.Test;
import org.junit.Before;
+import com.badlogic.gdx.math.GridPoint2;
+
import ch.asynk.tankontank.engine.SearchBoard;
import static org.junit.Assert.assertTrue;
@@ -13,14 +16,15 @@ import static org.junit.Assert.assertTrue;
public class BoardUtils
{
private SearchBoard sb;
+ private Helpers.FakeBoard b;
@Before
public void initialize()
{
int cols = 10;
int rows = 9;
- Helpers.FakeBoard fakeBoard = new Helpers.FakeBoard(cols, rows);
- sb = new SearchBoard(fakeBoard, cols, rows);
+ b = new Helpers.FakeBoard(cols, rows);
+ sb = new SearchBoard(b, cols, rows);
}
@Test
@@ -99,6 +103,16 @@ public class BoardUtils
}
@Test
+ public void testPathSet()
+ {
+ Helpers.FakePawn p = new Helpers.FakePawn(3);
+ HashSet<GridPoint2> points = new HashSet<GridPoint2>();
+
+ b.possiblePaths(p, 2, 2, 4, 3, points);
+ assertTrue(points.size() == 8);
+ }
+
+ @Test
public void testDistance()
{