1
0
mirror of https://github.com/Anuken/Mindustry.git synced 2024-11-10 15:05:23 +03:00

4 new Application Tests added (#5207)

This commit is contained in:
andrew3737 2021-05-18 13:44:30 -05:00 committed by GitHub
parent 5eb80ead93
commit 9a225d96ef
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -290,6 +290,115 @@ public class ApplicationTests{
assertTrue(tank.build.liquids.current() == Liquids.water, "Tank has no water");
}
@Test
void liquidRouterOutputAll() {
world.loadMap(testMap);
state.set(State.playing);
Tile source = world.rawTile(4,0), router = world.rawTile(4, 2), conduitUp1 = world.rawTile(4,1),
conduitLeft = world.rawTile(3,2), conduitUp2 = world.rawTile(4, 3), conduitRight = world.rawTile(5, 2),
leftTank = world.rawTile(1, 2), topTank = world.rawTile(4,5), rightTank = world.rawTile(7, 2);
source.setBlock(Blocks.liquidSource, Team.sharded);
source.build.configureAny(Liquids.water);
conduitUp1.setBlock(Blocks.conduit, Team.sharded, 1);
router.setBlock(Blocks.liquidRouter, Team.sharded);
conduitLeft.setBlock(Blocks.conduit, Team.sharded,2);
conduitUp2.setBlock(Blocks.conduit, Team.sharded, 1);
conduitRight.setBlock(Blocks.conduit, Team.sharded, 0);
leftTank.setBlock(Blocks.liquidTank, Team.sharded);
topTank.setBlock(Blocks.liquidTank, Team.sharded);
rightTank.setBlock(Blocks.liquidTank, Team.sharded);
updateBlocks(200);
assertTrue(rightTank.build.liquids.currentAmount() > 0, "Liquid router did not distribute to rightTank");
assertTrue(topTank.build.liquids.currentAmount() > 0, "Liquid router did not distribute to topTank");
assertTrue(leftTank.build.liquids.currentAmount() > 0, "Liquid router did not distribute to rightTank");
}
@Test
void sorterOutputCorrect() {
world.loadMap(testMap);
state.set(State.playing);
Tile source1 = world.rawTile(4, 0), source2 = world.rawTile(6, 0), s1conveyor = world.rawTile(4, 1),
s2conveyor = world.rawTile(6, 1), s1s2conveyor = world.rawTile(5, 1), sorter = world.rawTile(5, 2),
leftconveyor = world.rawTile(4, 2), rightconveyor = world.rawTile(6, 2), sortedconveyor = world.rawTile(5, 3),
leftVault = world.rawTile(2, 2), rightVault = world.rawTile(8, 2), topVault = world.rawTile(5, 5);
source1.setBlock(Blocks.itemSource, Team.sharded);
source1.build.configureAny(Items.coal);
source2.setBlock(Blocks.itemSource, Team.sharded);
source2.build.configureAny(Items.copper);
s1conveyor.setBlock(Blocks.conveyor, Team.sharded, 0);
s2conveyor.setBlock(Blocks.conveyor, Team.sharded, 2);
s1s2conveyor.setBlock(Blocks.conveyor, Team.sharded, 1);
sorter.setBlock(Blocks.sorter, Team.sharded);
sorter.build.configureAny(Items.copper);
leftconveyor.setBlock(Blocks.conveyor, Team.sharded, 2);
rightconveyor.setBlock(Blocks.conveyor, Team.sharded, 0);
sortedconveyor.setBlock(Blocks.conveyor, Team.sharded, 1);
leftVault.setBlock(Blocks.vault, Team.sharded);
rightVault.setBlock(Blocks.vault, Team.sharded);
topVault.setBlock(Blocks.vault, Team.sharded);
updateBlocks(200);
assertEquals(Items.coal, rightVault.build.items.first());
assertEquals(Items.copper, topVault.build.items.first());
assertEquals(Items.coal, leftVault.build.items.first());
}
@Test
void routerOutputAll() {
world.loadMap(testMap);
state.set(State.playing);
Tile source1 = world.rawTile(5, 0), conveyor = world.rawTile(5, 1),
router = world.rawTile(5, 2), leftconveyor = world.rawTile(4, 2), rightconveyor = world.rawTile(6, 2),
middleconveyor = world.rawTile(5, 3), leftVault = world.rawTile(2, 2),
rightVault = world.rawTile(8, 2), topVault = world.rawTile(5, 5);
source1.setBlock(Blocks.itemSource, Team.sharded);
source1.build.configureAny(Items.coal);
conveyor.setBlock(Blocks.conveyor, Team.sharded, 1);
router.setBlock(Blocks.router, Team.sharded);
router.build.configureAny(Items.coal);
leftconveyor.setBlock(Blocks.conveyor, Team.sharded, 2);
rightconveyor.setBlock(Blocks.conveyor, Team.sharded, 0);
middleconveyor.setBlock(Blocks.conveyor, Team.sharded, 1);
leftVault.setBlock(Blocks.vault, Team.sharded);
rightVault.setBlock(Blocks.vault, Team.sharded);
topVault.setBlock(Blocks.vault, Team.sharded);
updateBlocks(200);
assertEquals(Items.coal, rightVault.build.items.first());
assertEquals(Items.coal, topVault.build.items.first());
assertEquals(Items.coal, leftVault.build.items.first());
}
@Test
void junctionOutputCorrect() {
world.loadMap(testMap);
state.set(State.playing);
Tile source1 = world.rawTile(5,0),source2 = world.rawTile(7, 2), conveyor1 = world.rawTile(5, 1),
conveyor2 = world.rawTile(6,2), junction = world.rawTile(5, 2), conveyor3 = world.rawTile(5,3),
conveyor4 = world.rawTile(4,2), vault2 = world.rawTile(3, 1), vault1 = world.rawTile(5,5);
source1.setBlock(Blocks.itemSource, Team.sharded);
source1.build.configureAny(Items.coal);
source2.setBlock(Blocks.itemSource, Team.sharded);
source2.build.configureAny(Items.copper);
conveyor1.setBlock(Blocks.conveyor, Team.sharded, 1);
conveyor2.setBlock(Blocks.conveyor, Team.sharded, 2);
conveyor3.setBlock(Blocks.conveyor, Team.sharded, 1);
conveyor4.setBlock(Blocks.conveyor, Team.sharded, 2);
junction.setBlock(Blocks.junction, Team.sharded);
vault1.setBlock(Blocks.vault, Team.sharded);
vault2.setBlock(Blocks.vault, Team.sharded);
updateBlocks(200);
assertEquals(Items.coal, vault1.build.items.first());
assertEquals(Items.copper, vault2.build.items.first());
}
@Test
void blockOverlapRemoved(){
world.loadMap(testMap);