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 /test/ch/epfl | |
parent | b25cee830238c64c08a2e3733bbed0730d20a734 (diff) | |
download | xblast-80143bb3522007a903f2a34967e0cf5b0d6b20e0.tar.gz |
Add the test related to the blockAt() method
Diffstat (limited to 'test/ch/epfl')
-rw-r--r-- | test/ch/epfl/xblast/server/BoardTest.java | 19 |
1 files changed, 19 insertions, 0 deletions
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 | } |