Fixed unit tests

This commit is contained in:
Anuken
2019-11-16 12:40:26 -05:00
parent edfe58cb38
commit 94cf054312

View File

@@ -111,14 +111,10 @@ public class ApplicationTests{
@Test @Test
void createMap(){ void createMap(){
Tile[][] tiles = world.resize(8, 8); Tiles tiles = world.resize(8, 8);
world.beginMapLoad(); world.beginMapLoad();
for(int x = 0; x < tiles.length; x++){ tiles.fill();
for(int y = 0; y < tiles[0].length; y++){
tiles[x][y] = new Tile(x, y);
}
}
world.endMapLoad(); world.endMapLoad();
} }
@@ -329,29 +325,29 @@ public class ApplicationTests{
@Test @Test
void allBlockTest(){ void allBlockTest(){
Tile[][] tiles = world.resize(256*2 + 20, 10); Tiles tiles = world.resize(256*2 + 20, 10);
world.beginMapLoad(); world.beginMapLoad();
for(int x = 0; x < tiles.length; x++){ for(int x = 0; x < tiles.width(); x++){
for(int y = 0; y < tiles[0].length; y++){ for(int y = 0; y < tiles.height(); y++){
tiles[x][y] = new Tile(x, y, Blocks.stone.id, (byte)0, (byte)0); tiles.set(x, y, new Tile(x, y, Blocks.stone.id, (byte)0, (byte)0));
} }
} }
int i = 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++); Block block = content.block(i++);
if(block.isBuildable()){ if(block.isBuildable()){
x += block.size; x += block.size;
tiles[x][5].setBlock(block); tiles.get(x, 5).setBlock(block);
x += block.size; x += block.size;
} }
} }
world.endMapLoad(); world.endMapLoad();
for(int x = 0; x < tiles.length; x++){ for(int x = 0; x < tiles.width(); x++){
for(int y = 0; y < tiles[0].length; y++){ for(int y = 0; y < tiles.height(); y++){
Tile tile = world.tile(x, y); Tile tile = world.rawTile(x, y);
if(tile.entity != null){ if(tile.entity != null){
try{ try{
tile.entity.update(); tile.entity.update();