mirror of
https://github.com/Anuken/Mindustry.git
synced 2026-01-27 23:11:12 -08:00
Bugfixes
This commit is contained in:
commit
7e781d9ff8
21 changed files with 120 additions and 90 deletions
|
|
@ -38,6 +38,7 @@ public class ItemLiquidGeneratorTests extends PowerTestFixture{
|
|||
powerProduction = 0.1f;
|
||||
itemDuration = fakeItemDuration;
|
||||
maxLiquidGenerate = maximumLiquidUsage;
|
||||
entityType = ItemLiquidGeneratorEntity::new;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -85,13 +86,13 @@ public class ItemLiquidGeneratorTests extends PowerTestFixture{
|
|||
final float expectedRemainingLiquidAmount = Math.max(0.0f, availableLiquidAmount - expectedConsumptionPerTick * Time.delta());
|
||||
|
||||
createGenerator(inputType);
|
||||
assertTrue(generator.acceptLiquid(tile, null, liquid, availableLiquidAmount), inputType + " | " + parameterDescription + ": Liquids which will be declined by the generator don't need to be tested - The code won't be called for those cases.");
|
||||
assertTrue(entity.acceptLiquid(null, liquid, availableLiquidAmount), inputType + " | " + parameterDescription + ": Liquids which will be declined by the generator don't need to be tested - The code won't be called for those cases.");
|
||||
|
||||
entity.liquids().add(liquid, availableLiquidAmount);
|
||||
entity.cons().update();
|
||||
|
||||
// Perform an update on the generator once - This should use up any resource up to the maximum liquid usage
|
||||
generator.update(tile);
|
||||
entity.updateTile();
|
||||
|
||||
assertEquals(expectedRemainingLiquidAmount, entity.liquids().get(liquid), inputType + " | " + parameterDescription + ": Remaining liquid amount mismatch.");
|
||||
assertEquals(expectedEfficiency, entity.productionEfficiency, inputType + " | " + parameterDescription + ": Efficiency mismatch.");
|
||||
|
|
@ -127,7 +128,7 @@ public class ItemLiquidGeneratorTests extends PowerTestFixture{
|
|||
final float expectedRemainingItemAmount = Math.max(0, amount - 1);
|
||||
|
||||
createGenerator(inputType);
|
||||
assertTrue(generator.acceptItem(tile, null, item), inputType + " | " + parameterDescription + ": Items which will be declined by the generator don't need to be tested - The code won't be called for those cases.");
|
||||
assertTrue(entity.acceptItem(null, item), inputType + " | " + parameterDescription + ": Items which will be declined by the generator don't need to be tested - The code won't be called for those cases.");
|
||||
|
||||
if(amount > 0){
|
||||
entity.items().add(item, amount);
|
||||
|
|
@ -136,7 +137,7 @@ public class ItemLiquidGeneratorTests extends PowerTestFixture{
|
|||
|
||||
// Perform an update on the generator once - This should use up one or zero items - dependent on if the item is accepted and available or not.
|
||||
try{
|
||||
generator.update(tile);
|
||||
entity.updateTile();
|
||||
|
||||
assertEquals(expectedRemainingItemAmount, entity.items().get(item), inputType + " | " + parameterDescription + ": Remaining item amount mismatch.");
|
||||
assertEquals(expectedEfficiency, entity.productionEfficiency, inputType + " | " + parameterDescription + ": Efficiency mismatch.");
|
||||
|
|
@ -164,16 +165,16 @@ public class ItemLiquidGeneratorTests extends PowerTestFixture{
|
|||
// Burn a single coal and test for the duration
|
||||
entity.items().add(Items.coal, 1);
|
||||
entity.cons().update();
|
||||
generator.update(tile);
|
||||
entity.updateTile();
|
||||
|
||||
float expectedEfficiency = entity.productionEfficiency;
|
||||
|
||||
float currentDuration = 0.0f;
|
||||
while((currentDuration += Time.delta()) <= fakeItemDuration){
|
||||
generator.update(tile);
|
||||
entity.updateTile();
|
||||
assertEquals(expectedEfficiency, entity.productionEfficiency, "Duration: " + currentDuration);
|
||||
}
|
||||
generator.update(tile);
|
||||
entity.updateTile();
|
||||
assertEquals(0.0f, entity.productionEfficiency, "Duration: " + currentDuration);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue