add test case for #1
Values are calculated, however not present in plot. Further research neededmaster
parent
ebfcc51eeb
commit
261ab9c4f4
|
|
@ -122,10 +122,10 @@ public class Test {
|
||||||
planFor(Database.UraniumFuelRod, 1, "fuelrod");
|
planFor(Database.UraniumFuelRod, 1, "fuelrod");
|
||||||
|
|
||||||
planFor(Database.FusedModularFrame, 100, "fusedFrame");
|
planFor(Database.FusedModularFrame, 100, "fusedFrame");
|
||||||
planFor(Database.SteelIngot, 100, "steelIngot");
|
planFor(Database.SteelIngot, 81.75, "steelIngot");
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void planFor(Item item, int amount, String name) {
|
private static void planFor(Item item, double amount, String name) {
|
||||||
SumResult plan = SumResult.sum(new Production(item, amount));
|
SumResult plan = SumResult.sum(new Production(item, amount));
|
||||||
plot2(plan.getProduction(), name);
|
plot2(plan.getProduction(), name);
|
||||||
javaPlot(name);
|
javaPlot(name);
|
||||||
|
|
|
||||||
|
|
@ -2,9 +2,9 @@ package satisfactory.items;
|
||||||
|
|
||||||
public class Production {
|
public class Production {
|
||||||
private final Item item;
|
private final Item item;
|
||||||
private final int amount;
|
private final double amount;
|
||||||
|
|
||||||
public Production(Item item, int amount) {
|
public Production(Item item, double amount) {
|
||||||
this.item = item;
|
this.item = item;
|
||||||
this.amount = amount;
|
this.amount = amount;
|
||||||
}
|
}
|
||||||
|
|
@ -13,7 +13,7 @@ public class Production {
|
||||||
return item;
|
return item;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getAmount() {
|
public double getAmount() {
|
||||||
return amount;
|
return amount;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -176,7 +176,7 @@ public class Recipe {
|
||||||
return product.getRecipe().outputs.get(product) * runs;
|
return product.getRecipe().outputs.get(product) * runs;
|
||||||
}
|
}
|
||||||
|
|
||||||
public SumResult sum(Item target, int prodPerMinute) {
|
public SumResult sum(Item target, double prodPerMinute) {
|
||||||
Graph<Item, DefaultWeightedEdge> buildGraph = buildGraph(target);
|
Graph<Item, DefaultWeightedEdge> buildGraph = buildGraph(target);
|
||||||
Graph<Item, ProductionEdge> production = new DefaultDirectedWeightedGraph<>(ProductionEdge.class);
|
Graph<Item, ProductionEdge> production = new DefaultDirectedWeightedGraph<>(ProductionEdge.class);
|
||||||
Map<Item, Double> map = new HashMap<>();
|
Map<Item, Double> map = new HashMap<>();
|
||||||
|
|
|
||||||
|
|
@ -99,4 +99,21 @@ class ItemTest {
|
||||||
assertEquals(amount, calculations.get(item), 0.01, item.getName());
|
assertEquals(amount, calculations.get(item), 0.01, item.getName());
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@Test
|
||||||
|
void uraniumFuelRodWithSteelIngotParents(){
|
||||||
|
Map<Item, Double> ref = new HashMap<>();
|
||||||
|
ref.put(Database.SteelIngot, 81.75);
|
||||||
|
ref.put(Database.IronOre, 81.75);
|
||||||
|
ref.put(Database.Coal, 81.75);
|
||||||
|
compareProductions(Database.UraniumFuelRod, 1, ref);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void compareProductions(Item targetItem, int amount, Map<Item, Double> ref) {
|
||||||
|
Map<Item, Double> sum = SumResult.sum(new Production(targetItem, amount)).getMap();
|
||||||
|
|
||||||
|
ref.forEach((item, aDouble) -> {
|
||||||
|
assertTrue(sum.containsKey(item));
|
||||||
|
assertEquals(aDouble, sum.get(item));
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Loading…
Reference in New Issue