From 80143bb3522007a903f2a34967e0cf5b0d6b20e0 Mon Sep 17 00:00:00 2001 From: Timothée Floure Date: Tue, 1 Mar 2016 16:59:56 +0100 Subject: Add the test related to the blockAt() method --- test/ch/epfl/xblast/server/BoardTest.java | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'test/ch/epfl') 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; import java.util.ArrayList; import org.junit.Test; import ch.epfl.cs108.Sq; +import ch.epfl.xblast.Cell; import static org.junit.Assert.*; @@ -132,4 +133,22 @@ public class BoardTest { assertTrue(Board.ofQuadrantNWBlocksWalled(rowsList) instanceof Board); } + + @Test + public void isBlockAtReturningTheRightBlock() { + Cell sampleCell = new Cell(0,0); + Cell sampleCell2 = new Cell(3,4); + + List> blocksList = new ArrayList<>(); + + blocksList.add(Sq.constant(Block.INDESTRUCTIBLE_WALL)); + for (int i = 0; i < 194; i++) { + blocksList.add(Sq.constant(Block.FREE)); + } + Board sampleBoard = new Board(blocksList); + + assertTrue(sampleBoard.blockAt(sampleCell) == Block.INDESTRUCTIBLE_WALL); + assertTrue(sampleBoard.blockAt(sampleCell2) == Block.FREE); + } + } -- cgit v1.2.3