summaryrefslogtreecommitdiffstats
path: root/core/test
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2015-01-15 23:52:05 +0100
committerJérémy Zurcher <jeremy@asynk.ch>2015-01-15 23:52:05 +0100
commitdeca688c17bacf8c57eee2f26564dbdec030b2c0 (patch)
tree984219000e2832bff8f1d5d2da02552f6ae1e861 /core/test
parentc66f5cd374a882466893b1c38ac7912490a79fcf (diff)
downloadRustAndDust-deca688c17bacf8c57eee2f26564dbdec030b2c0.zip
RustAndDust-deca688c17bacf8c57eee2f26564dbdec030b2c0.tar.gz
update tests
Diffstat (limited to 'core/test')
-rw-r--r--core/test/ch/asynk/tankontank/BoardUtils.java19
1 files changed, 11 insertions, 8 deletions
diff --git a/core/test/ch/asynk/tankontank/BoardUtils.java b/core/test/ch/asynk/tankontank/BoardUtils.java
index 55cdba8..d757861 100644
--- a/core/test/ch/asynk/tankontank/BoardUtils.java
+++ b/core/test/ch/asynk/tankontank/BoardUtils.java
@@ -8,6 +8,7 @@ import org.junit.Test;
import org.junit.Before;
import ch.asynk.tankontank.engine.Tile;
+import ch.asynk.tankontank.engine.PossiblePaths;
import static org.junit.Assert.assertTrue;
@@ -37,35 +38,37 @@ public class BoardUtils
{
int n = b.buildPossiblePaths(2, 2, 4, 3);
+ assertTrue(b.possiblePaths.distance == 2);
assertTrue(n == 8);
for(int p = 0; p < n; p++) {
- List<Tile> path = b.possiblePaths.getPath(p);
- int z = path.size();
+ PossiblePaths.Path path = b.possiblePaths.getPath(p);
+ int z = path.tiles.size();
+ assertTrue(path.cost == (z + 1));
Tile t;
int i = 0;
if (z == 1) {
- t = path.get(i);
+ t = path.tiles.get(i);
assertTrue(t.getCol() == 3);
assertTrue((t.getRow() == 2) || (t.getRow() == 3));;
} else if (z == 2) {
- t = path.get(i);
+ t = path.tiles.get(i);
if (t.getCol() == 2) {
i += 1;
if (t.getRow() == 1) {
- t = path.get(i);
+ t = path.tiles.get(i);
assertTile(t, 3, 2);
} else {
assert(t.getRow()== 3);
- t = path.get(i);
+ t = path.tiles.get(i);
assertTile(t, 3, 3);
}
} else if (t.getCol() == 3) {
i += 1;
if (t.getRow() == 2) {
- t = path.get(i);
+ t = path.tiles.get(i);
if (t.getCol() == 3)
assert(t.getRow()== 3);
else {
@@ -73,7 +76,7 @@ public class BoardUtils
}
} else {
assert(t.getRow() == 3);
- t = path.get(i);
+ t = path.tiles.get(i);
if (t.getCol() == 3)
assert(t.getRow() == 2);
else {