Volver al índice
src/main/java/ar/com/companeros/runtime/DecisionProgressTests.java
package ar.com.companeros.runtime;
import ar.com.companeros.Companeros;
import ar.com.companeros.decision.ObservationSnapshot;
import java.util.List;
import java.util.Map;
import java.util.UUID;
import net.minecraft.gametest.framework.GameTest;
import net.minecraft.gametest.framework.GameTestHelper;
import net.minecraftforge.gametest.GameTestHolder;
import net.minecraftforge.gametest.PrefixGameTestTemplate;
@GameTestHolder(Companeros.ID)
@PrefixGameTestTemplate(false)
public final class DecisionProgressTests {
@GameTest(template = "empty")
public void inspectionAndChangingGoalsCannotConcealStagnation(GameTestHelper helper) {
DecisionProgress progress = new DecisionProgress(); UUID world = UUID.randomUUID();
helper.assertTrue(progress.observe(snapshot(world, 0, Map.of(), "Explorar", "day_time=1", "recent=inspect:SUCCEEDED")) == 0,
"La primera observación establece la referencia");
helper.assertTrue(progress.observe(snapshot(world, 0, Map.of(), "Revisar", "day_time=40", "recent=inspect:SUCCEEDED")) == 1
&& progress.observe(snapshot(world, 0, Map.of(), "Volver a mirar", "day_time=80", "recent=inspect:SUCCEEDED")) == 2,
"Ni el reloj ni reescribir el objetivo ni inspeccionar cuentan como progreso");
helper.assertTrue(progress.observe(snapshot(world, 2, Map.of(), "Explorar")) == 0
&& progress.observe(snapshot(world, 2, Map.of("minecraft:oak_log", 1), "Recolectar")) == 0
&& progress.observe(snapshot(world, 2, Map.of("minecraft:oak_log", 1), "Observar", "visible_block=minecraft:coal_ore pos=3,0,0")) == 0,
"Movimiento, inventario y nuevos recursos observados reinician el contador");
helper.succeed();
}
private static ObservationSnapshot snapshot(UUID world, int x, Map<String, Integer> inventory, String goal, String... facts) {
return new ObservationSnapshot(world, "minecraft:overworld", x, 0, 0, 20, 20, inventory, goal,
List.of(facts), List.of(), List.of());
}
}