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 --- src/ch/epfl/xblast/Direction.java | 2 +- test/ch/epfl/xblast/server/BoardTest.java | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) 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; /** * A Direction. - * + * * @author Pacien TRAN-GIRARD (261948) * @author Timothée FLOURE (257420) */ 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