Added new test

This commit is contained in:
Anuken 2018-10-04 17:59:16 -04:00
parent 7488a6d42b
commit 244eb91dfb
3 changed files with 19 additions and 1 deletions

View File

@ -31,7 +31,6 @@ import static io.anuke.mindustry.Vars.*;
public class Sectors{
private static final int sectorImageSize = 32;
private static final boolean checkExpansion = false;
private static final float sectorLargeChance = 0.24f;
private GridMap<Sector> grid = new GridMap<>();

View File

@ -101,6 +101,11 @@ public class Pump extends LiquidBlock{
tryDumpLiquid(tile, tile.entity.liquids.current());
}
@Override
public boolean acceptLiquid(Tile tile, Tile source, Liquid liquid, float amount){
return false;
}
protected boolean isValid(Tile tile){
return tile != null && tile.floor().liquidDrop != null && tier >= tile.floor().liquidDrop.tier;
}

View File

@ -1,6 +1,7 @@
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.backends.headless.HeadlessApplication;
import com.badlogic.gdx.backends.headless.HeadlessApplicationConfiguration;
import com.badlogic.gdx.math.GridPoint2;
import io.anuke.mindustry.Vars;
import io.anuke.mindustry.content.Items;
import io.anuke.mindustry.content.blocks.Blocks;
@ -14,6 +15,7 @@ import io.anuke.mindustry.game.Team;
import io.anuke.mindustry.io.BundleLoader;
import io.anuke.mindustry.io.SaveIO;
import io.anuke.mindustry.maps.Map;
import io.anuke.mindustry.world.Edges;
import io.anuke.mindustry.world.Tile;
import io.anuke.ucore.core.Timers;
import io.anuke.ucore.modules.ModuleCore;
@ -201,4 +203,16 @@ public class ApplicationTests{
assertTrue(world.width() == map.meta.width);
assertTrue(world.height() == map.meta.height);
}
@Test
void edgeTest(){
GridPoint2[] edges = Edges.getEdges(1);
assertTrue(edges[0].equals(new GridPoint2(1, 0)));
assertTrue(edges[1].equals(new GridPoint2(0, 1)));
assertTrue(edges[2].equals(new GridPoint2(-1, 0)));
assertTrue(edges[3].equals(new GridPoint2(0, -1)));
GridPoint2[] edges2 = Edges.getEdges(2);
assertTrue(edges2.length == 8);
}
}