Source reformat

This commit is contained in:
Anuken 2019-04-08 09:03:18 -04:00
parent 4a96b9bb00
commit b40beb0d1d
331 changed files with 2822 additions and 3274 deletions

View file

@ -2,26 +2,24 @@ import io.anuke.arc.util.Time;
import io.anuke.mindustry.content.Blocks;
import io.anuke.mindustry.core.GameState.State;
import io.anuke.mindustry.world.Tile;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.*;
import static io.anuke.mindustry.Vars.*;
import static org.junit.jupiter.api.Assertions.assertEquals;
public class WorldTests {
public class WorldTests{
static Tile[][] tiles;
@BeforeAll
static void launchApplication(){
ApplicationTests.launchApplication();
world.createTiles(10,10);
ApplicationTests.launchApplication();
world.createTiles(10, 10);
tiles = world.getTiles();
}
@BeforeEach
void resetWorld(){
Time.setDeltaProvider(() -> 1f);
Time.setDeltaProvider(() -> 1f);
logic.reset();
state.set(State.menu);
}
@ -31,8 +29,8 @@ public class WorldTests {
fillWith(Blocks.rocks.id);
world.addDarkness(tiles);
for(int x = 0; x < tiles.length; x++) {
for (int y = 0; y < tiles[0].length; y++) {
for(int x = 0; x < tiles.length; x++){
for(int y = 0; y < tiles[0].length; y++){
assertEquals(4, tiles[x][y].getRotation());
}
}
@ -43,8 +41,8 @@ public class WorldTests {
fillWith(Blocks.copperWall.id);
world.addDarkness(tiles);
for(int x = 0; x < tiles.length; x++) {
for (int y = 0; y < tiles[0].length; y++) {
for(int x = 0; x < tiles.length; x++){
for(int y = 0; y < tiles[0].length; y++){
assertEquals(0, tiles[x][y].getRotation());
}
}
@ -55,8 +53,8 @@ public class WorldTests {
fillWith(Blocks.air.id);
world.addDarkness(tiles);
for(int x = 0; x < tiles.length; x++) {
for (int y = 0; y < tiles[0].length; y++) {
for(int x = 0; x < tiles.length; x++){
for(int y = 0; y < tiles[0].length; y++){
assertEquals(0, tiles[x][y].getRotation());
}
}
@ -67,8 +65,8 @@ public class WorldTests {
fillWith(Blocks.cliffs.id);
world.addDarkness(tiles);
for(int x = 0; x < tiles.length; x++) {
for (int y = 0; y < tiles[0].length; y++) {
for(int x = 0; x < tiles.length; x++){
for(int y = 0; y < tiles[0].length; y++){
assertEquals(0, tiles[x][y].getRotation());
}
}
@ -80,8 +78,8 @@ public class WorldTests {
tiles[5][5] = new Tile(5, 5, (byte)0, Blocks.copperWall.id, (byte)0, (byte)0);
world.addDarkness(tiles);
for(int x = 0; x < tiles.length; x++) {
for (int y = 0; y < tiles[0].length; y++) {
for(int x = 0; x < tiles.length; x++){
for(int y = 0; y < tiles[0].length; y++){
byte darkness = tiles[x][y].getRotation();
int distance = Math.abs(x - 5) + Math.abs(y - 5);
assertEquals(Math.min(Math.max(distance - 1, 0), 4), darkness);
@ -95,8 +93,8 @@ public class WorldTests {
tiles[7][7] = new Tile(5, 5, (byte)0, Blocks.copperWall.id, (byte)0, (byte)0);
world.addDarkness(tiles);
for(int x = 0; x < tiles.length; x++) {
for (int y = 0; y < tiles[0].length; y++) {
for(int x = 0; x < tiles.length; x++){
for(int y = 0; y < tiles[0].length; y++){
byte darkness = tiles[x][y].getRotation();
int distance = Math.abs(x - 7) + Math.abs(y - 7);
assertEquals(Math.min(Math.max(distance - 1, 0), 4), darkness);
@ -105,8 +103,8 @@ public class WorldTests {
}
private static void fillWith(byte tileID){
for(int x = 0; x < tiles.length; x++) {
for (int y = 0; y < tiles[0].length; y++) {
for(int x = 0; x < tiles.length; x++){
for(int y = 0; y < tiles[0].length; y++){
tiles[x][y] = new Tile(x, y, (byte)0, tileID, (byte)0, (byte)0);
}
}