From 94cf054312a513b397aea4746f567f2de0c00f4c Mon Sep 17 00:00:00 2001 From: Anuken Date: Sat, 16 Nov 2019 12:40:26 -0500 Subject: [PATCH] Fixed unit tests --- tests/src/test/java/ApplicationTests.java | 26 ++++++++++------------- 1 file changed, 11 insertions(+), 15 deletions(-) diff --git a/tests/src/test/java/ApplicationTests.java b/tests/src/test/java/ApplicationTests.java index 619b3bd91e..801de1b495 100644 --- a/tests/src/test/java/ApplicationTests.java +++ b/tests/src/test/java/ApplicationTests.java @@ -111,14 +111,10 @@ public class ApplicationTests{ @Test void createMap(){ - Tile[][] tiles = world.resize(8, 8); + Tiles tiles = world.resize(8, 8); world.beginMapLoad(); - for(int x = 0; x < tiles.length; x++){ - for(int y = 0; y < tiles[0].length; y++){ - tiles[x][y] = new Tile(x, y); - } - } + tiles.fill(); world.endMapLoad(); } @@ -329,29 +325,29 @@ public class ApplicationTests{ @Test void allBlockTest(){ - Tile[][] tiles = world.resize(256*2 + 20, 10); + Tiles tiles = world.resize(256*2 + 20, 10); world.beginMapLoad(); - for(int x = 0; x < tiles.length; x++){ - for(int y = 0; y < tiles[0].length; y++){ - tiles[x][y] = new Tile(x, y, Blocks.stone.id, (byte)0, (byte)0); + for(int x = 0; x < tiles.width(); x++){ + for(int y = 0; y < tiles.height(); y++){ + tiles.set(x, y, new Tile(x, y, Blocks.stone.id, (byte)0, (byte)0)); } } int i = 0; - for(int x = 5; x < tiles.length && i < content.blocks().size; ){ + for(int x = 5; x < tiles.width() && i < content.blocks().size; ){ Block block = content.block(i++); if(block.isBuildable()){ x += block.size; - tiles[x][5].setBlock(block); + tiles.get(x, 5).setBlock(block); x += block.size; } } world.endMapLoad(); - for(int x = 0; x < tiles.length; x++){ - for(int y = 0; y < tiles[0].length; y++){ - Tile tile = world.tile(x, y); + for(int x = 0; x < tiles.width(); x++){ + for(int y = 0; y < tiles.height(); y++){ + Tile tile = world.rawTile(x, y); if(tile.entity != null){ try{ tile.entity.update();