diff options
Diffstat (limited to 'test/ch/epfl/xblast/SubCellTest.java')
-rw-r--r-- | test/ch/epfl/xblast/SubCellTest.java | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/test/ch/epfl/xblast/SubCellTest.java b/test/ch/epfl/xblast/SubCellTest.java index 1c79791..b3450e1 100644 --- a/test/ch/epfl/xblast/SubCellTest.java +++ b/test/ch/epfl/xblast/SubCellTest.java | |||
@@ -1,11 +1,15 @@ | |||
1 | package ch.epfl.xblast; | 1 | package ch.epfl.xblast; |
2 | 2 | ||
3 | import org.junit.Test; | ||
4 | |||
3 | import static org.junit.Assert.assertEquals; | 5 | import static org.junit.Assert.assertEquals; |
4 | import static org.junit.Assert.assertTrue; | 6 | import static org.junit.Assert.assertTrue; |
5 | 7 | ||
6 | import org.junit.Test; | 8 | /** |
7 | 9 | * @author EPFL | |
10 | */ | ||
8 | public class SubCellTest { | 11 | public class SubCellTest { |
12 | |||
9 | @Test | 13 | @Test |
10 | public void centralSubCellOfKnowCellIsCorrect() { | 14 | public void centralSubCellOfKnowCellIsCorrect() { |
11 | SubCell c = SubCell.centralSubCellOf(new Cell(2, 1)); | 15 | SubCell c = SubCell.centralSubCellOf(new Cell(2, 1)); |
@@ -15,13 +19,13 @@ public class SubCellTest { | |||
15 | 19 | ||
16 | @Test | 20 | @Test |
17 | public void centralSubCellIsCentral() { | 21 | public void centralSubCellIsCentral() { |
18 | for (Cell c: Cell.ROW_MAJOR_ORDER) | 22 | for (Cell c : Cell.ROW_MAJOR_ORDER) |
19 | assertTrue(SubCell.centralSubCellOf(c).isCentral()); | 23 | assertTrue(SubCell.centralSubCellOf(c).isCentral()); |
20 | } | 24 | } |
21 | 25 | ||
22 | @Test | 26 | @Test |
23 | public void distanceToCentralOfCentralIsZero() { | 27 | public void distanceToCentralOfCentralIsZero() { |
24 | for (Cell c: Cell.ROW_MAJOR_ORDER) | 28 | for (Cell c : Cell.ROW_MAJOR_ORDER) |
25 | assertEquals(0, SubCell.centralSubCellOf(c).distanceToCentral()); | 29 | assertEquals(0, SubCell.centralSubCellOf(c).distanceToCentral()); |
26 | } | 30 | } |
27 | 31 | ||
@@ -43,18 +47,19 @@ public class SubCellTest { | |||
43 | @Test | 47 | @Test |
44 | public void neighborsOfOriginAreCorrect() { | 48 | public void neighborsOfOriginAreCorrect() { |
45 | SubCell c = new SubCell(0, 0); | 49 | SubCell c = new SubCell(0, 0); |
46 | assertEquals(new SubCell( 0, 207), c.neighbor(Direction.N)); | 50 | assertEquals(new SubCell(0, 207), c.neighbor(Direction.N)); |
47 | assertEquals(new SubCell( 1, 0), c.neighbor(Direction.E)); | 51 | assertEquals(new SubCell(1, 0), c.neighbor(Direction.E)); |
48 | assertEquals(new SubCell( 0, 1), c.neighbor(Direction.S)); | 52 | assertEquals(new SubCell(0, 1), c.neighbor(Direction.S)); |
49 | assertEquals(new SubCell(239, 0), c.neighbor(Direction.W)); | 53 | assertEquals(new SubCell(239, 0), c.neighbor(Direction.W)); |
50 | } | 54 | } |
51 | 55 | ||
52 | @Test | 56 | @Test |
53 | public void containingCellOfCentralsNeighborIsCorrect() { | 57 | public void containingCellOfCentralsNeighborIsCorrect() { |
54 | for (Cell c: Cell.ROW_MAJOR_ORDER) { | 58 | for (Cell c : Cell.ROW_MAJOR_ORDER) { |
55 | SubCell s = SubCell.centralSubCellOf(c); | 59 | SubCell s = SubCell.centralSubCellOf(c); |
56 | for (Direction d: Direction.values()) | 60 | for (Direction d : Direction.values()) |
57 | assertEquals(c, s.neighbor(d).containingCell()); | 61 | assertEquals(c, s.neighbor(d).containingCell()); |
58 | } | 62 | } |
59 | } | 63 | } |
64 | |||
60 | } | 65 | } |