TODO cleanup / Test fixes

This commit is contained in:
Anuken
2019-02-08 16:29:10 -05:00
parent 66c27fab13
commit adf5189541
18 changed files with 43 additions and 71 deletions

View File

@@ -105,8 +105,6 @@ public class ApplicationTests{
@Test
void playMap(){
assertTrue(world.maps.all().size > 0);
world.loadMap(testMap);
}
@@ -125,8 +123,6 @@ public class ApplicationTests{
@Test
void createMap(){
assertTrue(world.maps.all().size > 0);
Tile[][] tiles = world.createTiles(8, 8);
world.beginMapLoad();
@@ -181,16 +177,12 @@ public class ApplicationTests{
@Test
void save(){
assertTrue(world.maps.all().size > 0);
world.loadMap(testMap);
SaveIO.saveToSlot(0);
}
@Test
void load(){
assertTrue(world.maps.all().size > 0);
world.loadMap(testMap);
Map map = world.getMap();
@@ -198,7 +190,6 @@ public class ApplicationTests{
resetWorld();
SaveIO.loadFromSlot(0);
assertEquals(world.getMap().name, map.name);
assertEquals(world.width(), map.meta.width);
assertEquals(world.height(), map.meta.height);
}

View File

@@ -41,7 +41,7 @@ public class DirectConsumerTests extends PowerTestFixture{
consumerTile.entity.items.add(Items.lead, leadAmount);
Tile producerTile = createFakeTile(2, 0, createFakeProducerBlock(producedPower));
producerTile.<PowerGenerator.GeneratorEntity>entity().productionEfficiency = 0.5f; // 100%
producerTile.<PowerGenerator.GeneratorEntity>entity().productionEfficiency = 1f;
PowerGraph graph = new PowerGraph();
graph.add(producerTile);

View File

@@ -38,9 +38,8 @@ public class PowerTestFixture{
}
protected static PowerGenerator createFakeProducerBlock(float producedPower){
// Multiply produced power by 2 since production efficiency is defined to be 0.5 = 100%
return new PowerGenerator("fakegen"){{
powerProduction = producedPower * 2.0f;
powerProduction = producedPower;
}};
}

View File

@@ -51,7 +51,6 @@ public class PowerTests extends PowerTestFixture{
}
void simulateDirectConsumption(float producedPower, float requiredPower, float expectedSatisfaction, String parameterDescription){
Tile producerTile = createFakeTile(0, 0, createFakeProducerBlock(producedPower));
producerTile.<PowerGenerator.GeneratorEntity>entity().productionEfficiency = 0.5f; // Currently, 0.5f = 100%
Tile directConsumerTile = createFakeTile(0, 1, createFakeDirectConsumer(requiredPower));
PowerGraph powerGraph = new PowerGraph();
@@ -91,7 +90,6 @@ public class PowerTests extends PowerTestFixture{
}
void simulateBufferedConsumption(float producedPower, float maxBuffer, float powerConsumedPerTick, float initialSatisfaction, float expectedSatisfaction, String parameterDescription){
Tile producerTile = createFakeTile(0, 0, createFakeProducerBlock(producedPower));
producerTile.<PowerGenerator.GeneratorEntity>entity().productionEfficiency = 0.5f; // Currently, 0.5 = 100%
Tile bufferedConsumerTile = createFakeTile(0, 1, createFakeBufferedConsumer(maxBuffer, maxBuffer > 0.0f ? maxBuffer/powerConsumedPerTick : 1.0f));
bufferedConsumerTile.entity.power.satisfaction = initialSatisfaction;
@@ -136,7 +134,6 @@ public class PowerTests extends PowerTestFixture{
if(producedPower > 0.0f){
Tile producerTile = createFakeTile(0, 0, createFakeProducerBlock(producedPower));
producerTile.<PowerGenerator.GeneratorEntity>entity().productionEfficiency = 0.5f;
powerGraph.add(producerTile);
}
Tile directConsumerTile = null;