diff options
author | Adam NAILI | 2018-01-11 20:07:28 +0100 |
---|---|---|
committer | Adam NAILI | 2018-01-11 20:07:28 +0100 |
commit | 1347f30afbed7ee9c149f77534f5e75fbe819b98 (patch) | |
tree | 92d68934e527a2a9b7faa91e048d0ccd0bd65da3 /src/test/java/fr | |
parent | e5f4426230fc485feac96fd5db6151faad24591d (diff) | |
download | wallj-1347f30afbed7ee9c149f77534f5e75fbe819b98.tar.gz |
Implementing BoardConverter and test failed
Diffstat (limited to 'src/test/java/fr')
-rw-r--r-- | src/test/java/fr/umlv/java/wallj/board/BoardConverterTest.java | 46 |
1 files changed, 45 insertions, 1 deletions
diff --git a/src/test/java/fr/umlv/java/wallj/board/BoardConverterTest.java b/src/test/java/fr/umlv/java/wallj/board/BoardConverterTest.java index 1ed74d1..9574adf 100644 --- a/src/test/java/fr/umlv/java/wallj/board/BoardConverterTest.java +++ b/src/test/java/fr/umlv/java/wallj/board/BoardConverterTest.java | |||
@@ -1,4 +1,48 @@ | |||
1 | package fr.umlv.java.wallj.board; | 1 | package fr.umlv.java.wallj.board; |
2 | 2 | ||
3 | public class BoardConverterTest { | 3 | import fr.umlv.java.wallj.model.*; |
4 | import org.jbox2d.common.Vec2; | ||
5 | import org.junit.jupiter.api.Assertions; | ||
6 | import org.junit.jupiter.api.Test; | ||
7 | |||
8 | import java.util.ArrayList; | ||
9 | import java.util.LinkedList; | ||
10 | import java.util.List; | ||
11 | |||
12 | /** | ||
13 | * @author Adam NAILI | ||
14 | */ | ||
15 | final class BoardConverterTest { | ||
16 | |||
17 | @Test | ||
18 | void testWorldToBoard(){ | ||
19 | List<Block> blocks = new LinkedList<>(); | ||
20 | Board.Builder builder = new Board.Builder(5,1); | ||
21 | TileVec2 t0 = TileVec2.of(0,0); | ||
22 | TileVec2 t1 = TileVec2.of(1,0); | ||
23 | TileVec2 t2 = TileVec2.of(2,0); | ||
24 | TileVec2 t3 = TileVec2.of(3,0); | ||
25 | TileVec2 t4 = TileVec2.of(4,0); | ||
26 | |||
27 | builder.setBlockTypeAt(t0,BlockType.WALL); | ||
28 | builder.setBlockTypeAt(t1,BlockType.BOMB); | ||
29 | builder.setBlockTypeAt(t2,BlockType.GARBAGE); | ||
30 | builder.setBlockTypeAt(t3,BlockType.ROBOT); | ||
31 | builder.setBlockTypeAt(t4,BlockType.TRASH); | ||
32 | |||
33 | Board certifiedBoard = builder.build(); | ||
34 | |||
35 | blocks.add(BlockFactory.build(BlockType.WALL,t0)); | ||
36 | blocks.add(BlockFactory.build(BlockType.BOMB,t1)); | ||
37 | blocks.add(BlockFactory.build(BlockType.GARBAGE,t2)); | ||
38 | blocks.add(BlockFactory.build(BlockType.ROBOT,t3)); | ||
39 | blocks.add(BlockFactory.build(BlockType.TRASH,t4)); | ||
40 | |||
41 | Board board = BoardConverter.worldToBoard(blocks); | ||
42 | |||
43 | Assertions.assertEquals(certifiedBoard,board); | ||
44 | |||
45 | } | ||
46 | |||
4 | } | 47 | } |
48 | |||