aboutsummaryrefslogtreecommitdiff
path: root/src/test/java/fr
diff options
context:
space:
mode:
authorAdam NAILI2018-01-12 00:21:27 +0100
committerAdam NAILI2018-01-12 00:21:27 +0100
commitaa1efc9c6e164226d1f47fcaecd5c7cf47040943 (patch)
tree8dd8bfbc5f8c65863f2b2f91c879210cf6c5d950 /src/test/java/fr
parente33c61d4a6dfba20c1dd69d1a22b55b23a9cf940 (diff)
downloadwallj-aa1efc9c6e164226d1f47fcaecd5c7cf47040943.tar.gz
Modifying BoardConverter method due to TileVec2 modification and successful tests
Diffstat (limited to 'src/test/java/fr')
-rw-r--r--src/test/java/fr/umlv/java/wallj/board/BoardConverterTest.java29
1 files changed, 27 insertions, 2 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 9574adf..ad96ea1 100644
--- a/src/test/java/fr/umlv/java/wallj/board/BoardConverterTest.java
+++ b/src/test/java/fr/umlv/java/wallj/board/BoardConverterTest.java
@@ -29,7 +29,6 @@ final class BoardConverterTest {
29 builder.setBlockTypeAt(t2,BlockType.GARBAGE); 29 builder.setBlockTypeAt(t2,BlockType.GARBAGE);
30 builder.setBlockTypeAt(t3,BlockType.ROBOT); 30 builder.setBlockTypeAt(t3,BlockType.ROBOT);
31 builder.setBlockTypeAt(t4,BlockType.TRASH); 31 builder.setBlockTypeAt(t4,BlockType.TRASH);
32
33 Board certifiedBoard = builder.build(); 32 Board certifiedBoard = builder.build();
34 33
35 blocks.add(BlockFactory.build(BlockType.WALL,t0)); 34 blocks.add(BlockFactory.build(BlockType.WALL,t0));
@@ -37,12 +36,38 @@ final class BoardConverterTest {
37 blocks.add(BlockFactory.build(BlockType.GARBAGE,t2)); 36 blocks.add(BlockFactory.build(BlockType.GARBAGE,t2));
38 blocks.add(BlockFactory.build(BlockType.ROBOT,t3)); 37 blocks.add(BlockFactory.build(BlockType.ROBOT,t3));
39 blocks.add(BlockFactory.build(BlockType.TRASH,t4)); 38 blocks.add(BlockFactory.build(BlockType.TRASH,t4));
40
41 Board board = BoardConverter.worldToBoard(blocks); 39 Board board = BoardConverter.worldToBoard(blocks);
42 40
43 Assertions.assertEquals(certifiedBoard,board); 41 Assertions.assertEquals(certifiedBoard,board);
42 }
43
44 @Test
45 void testBoardToWorld(){
46 Board.Builder builder = new Board.Builder(5,1);
47 TileVec2 t0 = TileVec2.of(0,0);
48 TileVec2 t1 = TileVec2.of(1,0);
49 TileVec2 t2 = TileVec2.of(2,0);
50 TileVec2 t3 = TileVec2.of(3,0);
51 TileVec2 t4 = TileVec2.of(4,0);
52
53 builder.setBlockTypeAt(t0,BlockType.WALL);
54 builder.setBlockTypeAt(t1,BlockType.BOMB);
55 builder.setBlockTypeAt(t2,BlockType.GARBAGE);
56 builder.setBlockTypeAt(t3,BlockType.ROBOT);
57 builder.setBlockTypeAt(t4,BlockType.TRASH);
58 Board board = builder.build();
59
60 List<Block> certifiedBlocks = new LinkedList<>();
44 61
62 certifiedBlocks.add(BlockFactory.build(BlockType.WALL,t0));
63 certifiedBlocks.add(BlockFactory.build(BlockType.BOMB,t1));
64 certifiedBlocks.add(BlockFactory.build(BlockType.GARBAGE,t2));
65 certifiedBlocks.add(BlockFactory.build(BlockType.ROBOT,t3));
66 certifiedBlocks.add(BlockFactory.build(BlockType.TRASH,t4));
67
68 List<Block> blocks = BoardConverter.boardToWorld(board);
45 } 69 }
46 70
71
47} 72}
48 73