diff options
author | Timothée Floure | 2016-03-01 16:59:56 +0100 |
---|---|---|
committer | Timothée Floure | 2016-03-01 16:59:56 +0100 |
commit | 80143bb3522007a903f2a34967e0cf5b0d6b20e0 (patch) | |
tree | 0298e8a94a67f6c0b992ea50deb70fbfbbf230eb | |
parent | b25cee830238c64c08a2e3733bbed0730d20a734 (diff) | |
download | xblast-80143bb3522007a903f2a34967e0cf5b0d6b20e0.tar.gz |
Add the test related to the blockAt() method
-rw-r--r-- | src/ch/epfl/xblast/Direction.java | 2 | ||||
-rw-r--r-- | test/ch/epfl/xblast/server/BoardTest.java | 19 |
2 files changed, 20 insertions, 1 deletions
diff --git a/src/ch/epfl/xblast/Direction.java b/src/ch/epfl/xblast/Direction.java index 700f9be..030038b 100644 --- a/src/ch/epfl/xblast/Direction.java +++ b/src/ch/epfl/xblast/Direction.java | |||
@@ -2,7 +2,7 @@ package ch.epfl.xblast; | |||
2 | 2 | ||
3 | /** | 3 | /** |
4 | * A Direction. | 4 | * A Direction. |
5 | * | 5 | * |
6 | * @author Pacien TRAN-GIRARD (261948) | 6 | * @author Pacien TRAN-GIRARD (261948) |
7 | * @author Timothée FLOURE (257420) | 7 | * @author Timothée FLOURE (257420) |
8 | */ | 8 | */ |
diff --git a/test/ch/epfl/xblast/server/BoardTest.java b/test/ch/epfl/xblast/server/BoardTest.java index 673ab3b..b23ac06 100644 --- a/test/ch/epfl/xblast/server/BoardTest.java +++ b/test/ch/epfl/xblast/server/BoardTest.java | |||
@@ -4,6 +4,7 @@ import java.util.List; | |||
4 | import java.util.ArrayList; | 4 | import java.util.ArrayList; |
5 | import org.junit.Test; | 5 | import org.junit.Test; |
6 | import ch.epfl.cs108.Sq; | 6 | import ch.epfl.cs108.Sq; |
7 | import ch.epfl.xblast.Cell; | ||
7 | 8 | ||
8 | import static org.junit.Assert.*; | 9 | import static org.junit.Assert.*; |
9 | 10 | ||
@@ -132,4 +133,22 @@ public class BoardTest { | |||
132 | 133 | ||
133 | assertTrue(Board.ofQuadrantNWBlocksWalled(rowsList) instanceof Board); | 134 | assertTrue(Board.ofQuadrantNWBlocksWalled(rowsList) instanceof Board); |
134 | } | 135 | } |
136 | |||
137 | @Test | ||
138 | public void isBlockAtReturningTheRightBlock() { | ||
139 | Cell sampleCell = new Cell(0,0); | ||
140 | Cell sampleCell2 = new Cell(3,4); | ||
141 | |||
142 | List<Sq<Block>> blocksList = new ArrayList<>(); | ||
143 | |||
144 | blocksList.add(Sq.constant(Block.INDESTRUCTIBLE_WALL)); | ||
145 | for (int i = 0; i < 194; i++) { | ||
146 | blocksList.add(Sq.constant(Block.FREE)); | ||
147 | } | ||
148 | Board sampleBoard = new Board(blocksList); | ||
149 | |||
150 | assertTrue(sampleBoard.blockAt(sampleCell) == Block.INDESTRUCTIBLE_WALL); | ||
151 | assertTrue(sampleBoard.blockAt(sampleCell2) == Block.FREE); | ||
152 | } | ||
153 | |||
135 | } | 154 | } |