From 422f683c29d7ee9a9fb761ea223689bf56a7b17d Mon Sep 17 00:00:00 2001 From: DilithiumThoride Date: Fri, 29 May 2026 02:20:49 -0500 Subject: [PATCH 1/6] Extended Timeouts and added additional logging to Batch/Parallel Ranged Ingredient tests, to try to catch for spurious failures. --- .../IntProviderFluidIngredientTest.java | 30 ++++++++++++------- .../ingredient/IntProviderIngredientTest.java | 28 ++++++++++------- .../gtceu/gametest/util/TestUtils.java | 16 ++++++++++ 3 files changed, 54 insertions(+), 20 deletions(-) diff --git a/src/test/java/com/gregtechceu/gtceu/api/recipe/ingredient/IntProviderFluidIngredientTest.java b/src/test/java/com/gregtechceu/gtceu/api/recipe/ingredient/IntProviderFluidIngredientTest.java index c5969ab5b0d..e71b4d1ed05 100644 --- a/src/test/java/com/gregtechceu/gtceu/api/recipe/ingredient/IntProviderFluidIngredientTest.java +++ b/src/test/java/com/gregtechceu/gtceu/api/recipe/ingredient/IntProviderFluidIngredientTest.java @@ -595,7 +595,7 @@ public static void multiblockLCRRangedFluidOutput(GameTestHelper helper) { // test for multiblock machine with 16x Parallels with ranged fluid input @GameTest(template = "large_centrifuge_zpm_batch_parallel16", batch = "RangedFluidIngredients", - timeoutTicks = 200, + timeoutTicks = 2000, requiredSuccesses = 1, attempts = 10) public static void multiblockLCentRangedFluidInput16Parallel(GameTestHelper helper) { @@ -632,7 +632,8 @@ public static void multiblockLCentRangedFluidInput16Parallel(GameTestHelper help new FluidStack(REDSTONE, completed)), "Parallel LCent didn't complete correct number of recipes, completed [" + ((int) Math.round(fluidOut.getTotalContentAmount())) + "] not [" + - completed + "]"); + completed + "]. \nFailed recipes follow:\n" + + TestUtils.getFailures(busHolder.controller.recipeLogic)); helper.assertTrue(TestUtils.isFluidWithinRange(results, lowerLimit, upperLimit), "Parallel LCent didn't consume correct number of fluids, consumed " + (amount - results.getAmount()) + "] not [" + lowerLimit + "-" + upperLimit + "]"); @@ -669,7 +670,7 @@ public static void multiblockLCentRangedFluidInput16Parallel(GameTestHelper help // test for multiblock machine with 16x Parallels with ranged fluid output @GameTest(template = "large_centrifuge_zpm_batch_parallel16", batch = "RangedFluidIngredients", - timeoutTicks = 200, + timeoutTicks = 2000, requiredSuccesses = 1, attempts = 10) public static void multiblockLCentRangedFluidOutput16Parallel(GameTestHelper helper) { @@ -696,7 +697,9 @@ public static void multiblockLCentRangedFluidOutput16Parallel(GameTestHelper hel int runs = finalI * batches * parallels; helper.assertTrue(fluidIn.getFluidInTank(0).isEmpty(), "Parallel LCent didn't complete correct number of recipes, completed [" + - fluidIn.getFluidInTank(0).getAmount() + "] not [" + runs + "]"); + fluidIn.getFluidInTank(0).getAmount() + "] not [" + runs + + " \nFailed recipes follow:\n" + + TestUtils.getFailures(busHolder.controller.recipeLogic)); int resultCount = (int) Math.round(fluidOut.getTotalContentAmount()); int lowerLimit = runs * 0; int upperLimit = runs * 40; @@ -745,7 +748,7 @@ public static void multiblockLCentRangedFluidOutput16Parallel(GameTestHelper hel // test for multiblock machine with 16x Parallels with ranged fluid input @GameTest(template = "large_centrifuge_zpm_batch_parallel16", batch = "RangedFluidIngredients", - timeoutTicks = 200, + timeoutTicks = 2000, requiredSuccesses = 1, attempts = 10) public static void multiblockLCentRangedFluidInputBatched(GameTestHelper helper) { @@ -782,7 +785,8 @@ public static void multiblockLCentRangedFluidInputBatched(GameTestHelper helper) new FluidStack(REDSTONE, completed)), "Batched LCent didn't complete correct number of recipes, completed [" + ((int) Math.round(fluidOut.getTotalContentAmount())) + "] not [" + - completed + "]"); + completed + "]. \nFailed recipes follow:\n" + + TestUtils.getFailures(busHolder.controller.recipeLogic)); helper.assertTrue(TestUtils.isFluidWithinRange(results, lowerLimit, upperLimit), "Batched LCent didn't consume correct number of fluids, consumed " + (amount - results.getAmount()) + "] not [" + lowerLimit + "-" + upperLimit + "]"); @@ -819,7 +823,7 @@ public static void multiblockLCentRangedFluidInputBatched(GameTestHelper helper) // test for multiblock machine with 16x Parallels with ranged fluid output @GameTest(template = "large_centrifuge_zpm_batch_parallel16", batch = "RangedFluidIngredients", - timeoutTicks = 200, + timeoutTicks = 2000, requiredSuccesses = 1, attempts = 10) public static void multiblockLCentRangedFluidOutputBatched(GameTestHelper helper) { @@ -846,7 +850,9 @@ public static void multiblockLCentRangedFluidOutputBatched(GameTestHelper helper int runs = finalI * batches * parallels; helper.assertTrue(fluidIn.getFluidInTank(0).isEmpty(), "Batched LCent didn't complete correct number of recipes, completed [" + - fluidIn.getFluidInTank(0).getAmount() + "] not [" + runs + "]"); + fluidIn.getFluidInTank(0).getAmount() + "] not [" + runs + + "] \nFailed recipes follow:\n" + + TestUtils.getFailures(busHolder.controller.recipeLogic)); int resultCount = (int) Math.round(fluidOut.getTotalContentAmount()); int lowerLimit = runs * 0; int upperLimit = runs * 40; @@ -932,7 +938,9 @@ public static void multiblockLCentRangedFluidInput16ParallelBatched(GameTestHelp new FluidStack(fluidOut.getFluidInTank(0), fluidOut.getFluidInTank(0).getAmount()), new FluidStack(REDSTONE, completed)), "Batched Parallel LCent didn't complete correct number of recipes, completed [" + - (fluidOut.getFluidInTank(0).getAmount()) + "] not [" + completed + "]"); + (fluidOut.getFluidInTank(0).getAmount()) + "] not [" + completed + + "] \nFailed recipes follow:\n" + + TestUtils.getFailures(busHolder.controller.recipeLogic)); int upperLimit = amount - (batches * parallels * 0); int lowerLimit = amount - (batches * parallels * 40); helper.assertTrue(TestUtils.isFluidWithinRange(results, lowerLimit, upperLimit), @@ -1000,7 +1008,9 @@ public static void multiblockLCentRangedFluidOutput16ParallelBatched(GameTestHel int runs = finalI * batches * parallels; helper.assertTrue(fluidIn.isEmpty(), "Batched Parallel LCent didn't complete correct number of recipes, completed [" + - (runs - fluidIn.getFluidInTank(0).getAmount()) + "] not [" + runs + "]"); + (runs - fluidIn.getFluidInTank(0).getAmount()) + "] not [" + runs + + "] \nFailed recipes follow:\n" + + TestUtils.getFailures(busHolder.controller.recipeLogic)); int resultCount = fluidOut.getFluidInTank(0).getAmount(); int lowerLimit = runs * 0; int upperLimit = runs * 40; diff --git a/src/test/java/com/gregtechceu/gtceu/api/recipe/ingredient/IntProviderIngredientTest.java b/src/test/java/com/gregtechceu/gtceu/api/recipe/ingredient/IntProviderIngredientTest.java index f3b7bee123a..10f17d9270a 100644 --- a/src/test/java/com/gregtechceu/gtceu/api/recipe/ingredient/IntProviderIngredientTest.java +++ b/src/test/java/com/gregtechceu/gtceu/api/recipe/ingredient/IntProviderIngredientTest.java @@ -584,7 +584,7 @@ public static void multiblockLCRRangedItemOutput(GameTestHelper helper) { // test for multiblock machine with 16x Parallels with ranged item input @GameTest(template = "large_centrifuge_zpm_batch_parallel16", batch = "RangedIngredients", - timeoutTicks = 200, + timeoutTicks = 2000, requiredSuccesses = 1, attempts = 10) public static void multiblockLCentRangedItemInput16Parallel(GameTestHelper helper) { @@ -619,7 +619,8 @@ public static void multiblockLCentRangedItemInput16Parallel(GameTestHelper helpe STONE.copyWithCount(completed)), "Parallel LCent didn't complete correct number of recipes, completed [" + ((int) Math.round(itemOut.getTotalContentAmount())) + "] not [" + - completed + "]"); + completed + "] \nFailed recipes follow:\n" + + TestUtils.getFailures(busHolder.controller.recipeLogic)); helper.assertTrue(TestUtils.isItemWithinRange(results, lowerLimit, upperLimit), "Parallel LCent didn't consume correct number of items, consumed " + (64 - results.getCount()) + "] not [" + lowerLimit + "-" + upperLimit + "]"); @@ -656,7 +657,7 @@ public static void multiblockLCentRangedItemInput16Parallel(GameTestHelper helpe // test for multiblock machine with 16x Parallels with ranged item output @GameTest(template = "large_centrifuge_zpm_batch_parallel16", batch = "RangedIngredients", - timeoutTicks = 200, + timeoutTicks = 2000, requiredSuccesses = 1, attempts = 10) public static void multiblockLCentRangedItemOutput16Parallel(GameTestHelper helper) { @@ -683,7 +684,9 @@ public static void multiblockLCentRangedItemOutput16Parallel(GameTestHelper help int runs = finalI * batches * parallels; helper.assertTrue(itemIn.getStackInSlot(0).isEmpty(), "Parallel LCent didn't complete correct number of recipes, completed [" + - itemIn.getStackInSlot(0).getCount() + "] not [" + runs + "]"); + itemIn.getStackInSlot(0).getCount() + "] not [" + runs + + "] \nFailed recipes follow:\n" + + TestUtils.getFailures(busHolder.controller.recipeLogic)); int resultCount = (int) Math.round(itemOut.getTotalContentAmount()); int lowerLimit = runs * 0; int upperLimit = runs * 4; @@ -732,7 +735,7 @@ public static void multiblockLCentRangedItemOutput16Parallel(GameTestHelper help // test for multiblock machine with 16x Parallels with ranged item input @GameTest(template = "large_centrifuge_zpm_batch_parallel16", batch = "RangedIngredients", - timeoutTicks = 200, + timeoutTicks = 2000, requiredSuccesses = 1, attempts = 10) public static void multiblockLCentRangedItemInputBatched(GameTestHelper helper) { @@ -767,7 +770,8 @@ public static void multiblockLCentRangedItemInputBatched(GameTestHelper helper) STONE.copyWithCount(completed)), "Parallel LCent didn't complete correct number of recipes, completed [" + ((int) Math.round(itemOut.getTotalContentAmount())) + "] not [" + - completed + "]"); + completed + "] \nFailed recipes follow:\n" + + TestUtils.getFailures(busHolder.controller.recipeLogic)); helper.assertTrue(TestUtils.isItemWithinRange(results, lowerLimit, upperLimit), "Parallel LCent didn't consume correct number of items, consumed " + (64 - results.getCount()) + "] not [" + lowerLimit + "-" + upperLimit + "]"); @@ -804,7 +808,7 @@ public static void multiblockLCentRangedItemInputBatched(GameTestHelper helper) // test for multiblock machine with 16x Parallels with ranged item output @GameTest(template = "large_centrifuge_zpm_batch_parallel16", batch = "RangedIngredients", - timeoutTicks = 200, + timeoutTicks = 2000, requiredSuccesses = 1, attempts = 10) public static void multiblockLCentRangedItemOutputBatched(GameTestHelper helper) { @@ -831,7 +835,9 @@ public static void multiblockLCentRangedItemOutputBatched(GameTestHelper helper) int runs = finalI * batches * parallels; helper.assertTrue(itemIn.getStackInSlot(0).isEmpty(), "Batched LCent didn't complete correct number of recipes, completed [" + - itemIn.getStackInSlot(0).getCount() + "] not [" + runs + "]"); + itemIn.getStackInSlot(0).getCount() + "] not [" + runs + + "] \nFailed recipes follow:\n" + + TestUtils.getFailures(busHolder.controller.recipeLogic)); int resultCount = (int) Math.round(itemOut.getTotalContentAmount()); int lowerLimit = runs * 0; int upperLimit = runs * 4; @@ -921,7 +927,8 @@ public static void multiblockLCentRangedItemInput16ParallelBatched(GameTestHelpe STONE.copyWithCount(completed)), "Batched Parallel LCent didn't complete correct number of recipes, completed [" + ((int) Math.round(itemOut.getTotalContentAmount())) + "] not [" + - completed + "]"); + completed + "] \nFailed recipes follow:\n" + + TestUtils.getFailures(busHolder.controller.recipeLogic)); helper.assertTrue(TestUtils.isItemWithinRange(results, lowerLimit, upperLimit), "Batched Parallel LCent didn't consume correct number of items, consumed " + (64 - results.getCount()) + "] not [" + lowerLimit + "-" + upperLimit + "]"); @@ -993,7 +1000,8 @@ public static void multiblockLCentRangedItemOutput16ParallelBatched(GameTestHelp int runs = finalI * batches * parallels; helper.assertTrue(itemIn.isEmpty(), "Batched Parallel LCent didn't complete correct number of recipes, completed [" + - itemIn.getTotalContentAmount() + "] not [" + runs + "]"); + itemIn.getTotalContentAmount() + "] not [" + runs + "] \nFailed recipes follow:\n" + + TestUtils.getFailures(busHolder.controller.recipeLogic)); int resultCount = (int) Math.round(itemOut.getTotalContentAmount()); int lowerLimit = runs * 0; int upperLimit = runs * 4; diff --git a/src/test/java/com/gregtechceu/gtceu/gametest/util/TestUtils.java b/src/test/java/com/gregtechceu/gtceu/gametest/util/TestUtils.java index 0f33104c6de..8e48da0c4d2 100644 --- a/src/test/java/com/gregtechceu/gtceu/gametest/util/TestUtils.java +++ b/src/test/java/com/gregtechceu/gtceu/gametest/util/TestUtils.java @@ -12,6 +12,7 @@ import com.gregtechceu.gtceu.api.machine.MachineDefinition; import com.gregtechceu.gtceu.api.machine.MetaMachine; import com.gregtechceu.gtceu.api.machine.multiblock.MultiblockControllerMachine; +import com.gregtechceu.gtceu.api.machine.trait.RecipeLogic; import com.gregtechceu.gtceu.api.placeholder.MultiLineComponent; import com.gregtechceu.gtceu.api.recipe.GTRecipeType; import com.gregtechceu.gtceu.api.registry.GTRegistries; @@ -223,6 +224,21 @@ public static GTRecipeType createRecipeType(String name, int maxInputs, int maxO return type; } + /** + * Fetches the set of Failed Recipes and Reasons from a machine's {@link RecipeLogic} + * Returns a newline-separated string of all failed recipes and their failure reasons + */ + public static String getFailures(RecipeLogic recipeLogic) { + var reasons = recipeLogic.getFailureReasonMap(); + StringBuilder failures = new StringBuilder(); + if (!reasons.isEmpty()) { + for (var reason : reasons.entrySet()) { + failures.append(reason.getKey().id).append(" - ").append(reason.getValue().plainCopy()).append("\n"); + } + } + return failures.toString(); + } + public static CoverBehavior placeCover(GameTestHelper helper, MetaMachine machine, ItemStack stack, Direction direction) { return placeCover(helper, machine, stack, direction, false); From a574b575b35594ccccffe7470f9bfaeb2d93b71a Mon Sep 17 00:00:00 2001 From: DilithiumThoride Date: Fri, 29 May 2026 02:21:07 -0500 Subject: [PATCH 2/6] Fixed a logging error in AssemblyLineTests. --- .../multiblock/electric/AssemblyLineTests.java | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/test/java/com/gregtechceu/gtceu/common/machine/multiblock/electric/AssemblyLineTests.java b/src/test/java/com/gregtechceu/gtceu/common/machine/multiblock/electric/AssemblyLineTests.java index 2fb13dd1ca3..a9adbefdfb6 100644 --- a/src/test/java/com/gregtechceu/gtceu/common/machine/multiblock/electric/AssemblyLineTests.java +++ b/src/test/java/com/gregtechceu/gtceu/common/machine/multiblock/electric/AssemblyLineTests.java @@ -88,7 +88,7 @@ public static void AsslineRecipeRunsTest(GameTestHelper helper) { TestUtils.isItemStackEqual(busHolder.outputBus1.getInventory().getStackInSlot(0), new ItemStack(Blocks.STONE)), "Item didn't craft at the right tick with ok recipe" + - busHolder.outputBus1.getInventory().getStackInSlot(0).getDisplayName()); + busHolder.outputBus1.getInventory().getStackInSlot(0).getHoverName().getString()); }); } @@ -104,7 +104,7 @@ public static void AsslineRecipeDoesntRunWhenItemsMovedByOneTest(GameTestHelper TestUtils.isItemStackEqual(busHolder.outputBus1.getInventory().getStackInSlot(0), new ItemStack(Blocks.STONE)), "Item crafted with inputs moved" + - busHolder.outputBus1.getInventory().getStackInSlot(0).getDisplayName()); + busHolder.outputBus1.getInventory().getStackInSlot(0).getHoverName().getString()); }); TestUtils.succeedAfterTest(helper); } @@ -121,7 +121,7 @@ public static void AsslineRecipeDoesntRunWhenFluidsMovedByOneTest(GameTestHelper TestUtils.isItemStackEqual(busHolder.outputBus1.getInventory().getStackInSlot(0), new ItemStack(Blocks.STONE)), "Item crafted with inputs moved" + - busHolder.outputBus1.getInventory().getStackInSlot(0).getDisplayName()); + busHolder.outputBus1.getInventory().getStackInSlot(0).getHoverName().getString()); }); TestUtils.succeedAfterTest(helper); } @@ -138,7 +138,7 @@ public static void AsslineRecipeDoesntRunWhenBothMovedByOneTest(GameTestHelper h TestUtils.isItemStackEqual(busHolder.outputBus1.getInventory().getStackInSlot(0), new ItemStack(Blocks.STONE)), "Item crafted with inputs moved" + - busHolder.outputBus1.getInventory().getStackInSlot(0).getDisplayName()); + busHolder.outputBus1.getInventory().getStackInSlot(0).getHoverName().getString()); }); TestUtils.succeedAfterTest(helper); } @@ -175,7 +175,7 @@ public static void AsslineRecipeRunsAndOnlyConsumesOneTest(GameTestHelper helper TestUtils.isItemStackEqual(busHolder.outputBus1.getInventory().getStackInSlot(0), new ItemStack(Blocks.STONE)), "Item didn't craft at the right tick with ok recipe" + - busHolder.outputBus1.getInventory().getStackInSlot(0).getDisplayName()); + busHolder.outputBus1.getInventory().getStackInSlot(0).getHoverName().getString()); // All 4 inputs had the second one consumed helper.assertTrue( busHolder.inputBus1.getInventory().getStackInSlot(0).isEmpty(), @@ -196,7 +196,7 @@ public static void AsslineRecipeRunsAndOnlyConsumesOneTest(GameTestHelper helper TestUtils.isItemStackEqual(busHolder.outputBus1.getInventory().getStackInSlot(0), new ItemStack(Blocks.STONE, 2)), "Item didn't craft at the right tick with ok recipe" + - busHolder.outputBus1.getInventory().getStackInSlot(0).getDisplayName()); + busHolder.outputBus1.getInventory().getStackInSlot(0).getHoverName().getString()); }); TestUtils.succeedAfterTest(helper); } @@ -213,7 +213,7 @@ public static void AsslineRecipeDoesntRunWhenItemsSwappedTest(GameTestHelper hel TestUtils.isItemStackEqual(busHolder.outputBus1.getInventory().getStackInSlot(0), new ItemStack(Blocks.STONE)), "Item crafted with inputs moved" + - busHolder.outputBus1.getInventory().getStackInSlot(0).getDisplayName()); + busHolder.outputBus1.getInventory().getStackInSlot(0).getHoverName().getString()); }); TestUtils.succeedAfterTest(helper); } @@ -230,7 +230,7 @@ public static void AsslineRecipeDoesntRunWhenFluidsSwappedTest(GameTestHelper he TestUtils.isItemStackEqual(busHolder.outputBus1.getInventory().getStackInSlot(0), new ItemStack(Blocks.STONE)), "Item crafted with inputs moved" + - busHolder.outputBus1.getInventory().getStackInSlot(0).getDisplayName()); + busHolder.outputBus1.getInventory().getStackInSlot(0).getHoverName().getString()); }); TestUtils.succeedAfterTest(helper); } @@ -247,7 +247,7 @@ public static void AsslineRecipeDoesntRunWhenBothSwappedTest(GameTestHelper help TestUtils.isItemStackEqual(busHolder.outputBus1.getInventory().getStackInSlot(0), new ItemStack(Blocks.STONE)), "Item crafted with inputs moved" + - busHolder.outputBus1.getInventory().getStackInSlot(0).getDisplayName()); + busHolder.outputBus1.getInventory().getStackInSlot(0).getHoverName().getString()); }); TestUtils.succeedAfterTest(helper); } From 4573bac11c59ac3ea5d8948016b7c92f5ad08ce1 Mon Sep 17 00:00:00 2001 From: DilithiumThoride Date: Fri, 29 May 2026 02:39:48 -0500 Subject: [PATCH 3/6] Another bit more verbose --- .../IntProviderFluidIngredientTest.java | 28 +++++++++--------- .../ingredient/IntProviderIngredientTest.java | 29 ++++++++++--------- 2 files changed, 29 insertions(+), 28 deletions(-) diff --git a/src/test/java/com/gregtechceu/gtceu/api/recipe/ingredient/IntProviderFluidIngredientTest.java b/src/test/java/com/gregtechceu/gtceu/api/recipe/ingredient/IntProviderFluidIngredientTest.java index e71b4d1ed05..4df1ce3f773 100644 --- a/src/test/java/com/gregtechceu/gtceu/api/recipe/ingredient/IntProviderFluidIngredientTest.java +++ b/src/test/java/com/gregtechceu/gtceu/api/recipe/ingredient/IntProviderFluidIngredientTest.java @@ -631,9 +631,9 @@ public static void multiblockLCentRangedFluidInput16Parallel(GameTestHelper help ((int) Math.round(fluidOut.getTotalContentAmount()))), new FluidStack(REDSTONE, completed)), "Parallel LCent didn't complete correct number of recipes, completed [" + - ((int) Math.round(fluidOut.getTotalContentAmount())) + "] not [" + - completed + "]. \nFailed recipes follow:\n" + - TestUtils.getFailures(busHolder.controller.recipeLogic)); + ((int) Math.round(fluidOut.getTotalContentAmount())) + "] not [" + completed + + "].\n Current machine state: " + busHolder.controller.recipeLogic.getStatus() + + "\nFailed recipes follow:\n" + TestUtils.getFailures(busHolder.controller.recipeLogic)); helper.assertTrue(TestUtils.isFluidWithinRange(results, lowerLimit, upperLimit), "Parallel LCent didn't consume correct number of fluids, consumed " + (amount - results.getAmount()) + "] not [" + lowerLimit + "-" + upperLimit + "]"); @@ -698,8 +698,8 @@ public static void multiblockLCentRangedFluidOutput16Parallel(GameTestHelper hel helper.assertTrue(fluidIn.getFluidInTank(0).isEmpty(), "Parallel LCent didn't complete correct number of recipes, completed [" + fluidIn.getFluidInTank(0).getAmount() + "] not [" + runs + - " \nFailed recipes follow:\n" + - TestUtils.getFailures(busHolder.controller.recipeLogic)); + "]\n Current machine state: " + busHolder.controller.recipeLogic.getStatus() + + "\nFailed recipes follow:\n" + TestUtils.getFailures(busHolder.controller.recipeLogic)); int resultCount = (int) Math.round(fluidOut.getTotalContentAmount()); int lowerLimit = runs * 0; int upperLimit = runs * 40; @@ -784,9 +784,9 @@ public static void multiblockLCentRangedFluidInputBatched(GameTestHelper helper) ((int) Math.round(fluidOut.getTotalContentAmount()))), new FluidStack(REDSTONE, completed)), "Batched LCent didn't complete correct number of recipes, completed [" + - ((int) Math.round(fluidOut.getTotalContentAmount())) + "] not [" + - completed + "]. \nFailed recipes follow:\n" + - TestUtils.getFailures(busHolder.controller.recipeLogic)); + ((int) Math.round(fluidOut.getTotalContentAmount())) + "] not [" + completed + + "].\n Current machine state: " + busHolder.controller.recipeLogic.getStatus() + + "\nFailed recipes follow:\n" + TestUtils.getFailures(busHolder.controller.recipeLogic)); helper.assertTrue(TestUtils.isFluidWithinRange(results, lowerLimit, upperLimit), "Batched LCent didn't consume correct number of fluids, consumed " + (amount - results.getAmount()) + "] not [" + lowerLimit + "-" + upperLimit + "]"); @@ -851,8 +851,8 @@ public static void multiblockLCentRangedFluidOutputBatched(GameTestHelper helper helper.assertTrue(fluidIn.getFluidInTank(0).isEmpty(), "Batched LCent didn't complete correct number of recipes, completed [" + fluidIn.getFluidInTank(0).getAmount() + "] not [" + runs + - "] \nFailed recipes follow:\n" + - TestUtils.getFailures(busHolder.controller.recipeLogic)); + "]\n Current machine state: " + busHolder.controller.recipeLogic.getStatus() + + "\nFailed recipes follow:\n" + TestUtils.getFailures(busHolder.controller.recipeLogic)); int resultCount = (int) Math.round(fluidOut.getTotalContentAmount()); int lowerLimit = runs * 0; int upperLimit = runs * 40; @@ -939,8 +939,8 @@ public static void multiblockLCentRangedFluidInput16ParallelBatched(GameTestHelp new FluidStack(REDSTONE, completed)), "Batched Parallel LCent didn't complete correct number of recipes, completed [" + (fluidOut.getFluidInTank(0).getAmount()) + "] not [" + completed + - "] \nFailed recipes follow:\n" + - TestUtils.getFailures(busHolder.controller.recipeLogic)); + "]\n Current machine state: " + busHolder.controller.recipeLogic.getStatus() + + "\nFailed recipes follow:\n" + TestUtils.getFailures(busHolder.controller.recipeLogic)); int upperLimit = amount - (batches * parallels * 0); int lowerLimit = amount - (batches * parallels * 40); helper.assertTrue(TestUtils.isFluidWithinRange(results, lowerLimit, upperLimit), @@ -1009,8 +1009,8 @@ public static void multiblockLCentRangedFluidOutput16ParallelBatched(GameTestHel helper.assertTrue(fluidIn.isEmpty(), "Batched Parallel LCent didn't complete correct number of recipes, completed [" + (runs - fluidIn.getFluidInTank(0).getAmount()) + "] not [" + runs + - "] \nFailed recipes follow:\n" + - TestUtils.getFailures(busHolder.controller.recipeLogic)); + "]\n Current machine state: " + busHolder.controller.recipeLogic.getStatus() + + "\nFailed recipes follow:\n" + TestUtils.getFailures(busHolder.controller.recipeLogic)); int resultCount = fluidOut.getFluidInTank(0).getAmount(); int lowerLimit = runs * 0; int upperLimit = runs * 40; diff --git a/src/test/java/com/gregtechceu/gtceu/api/recipe/ingredient/IntProviderIngredientTest.java b/src/test/java/com/gregtechceu/gtceu/api/recipe/ingredient/IntProviderIngredientTest.java index 10f17d9270a..03d61713c60 100644 --- a/src/test/java/com/gregtechceu/gtceu/api/recipe/ingredient/IntProviderIngredientTest.java +++ b/src/test/java/com/gregtechceu/gtceu/api/recipe/ingredient/IntProviderIngredientTest.java @@ -618,9 +618,9 @@ public static void multiblockLCentRangedItemInput16Parallel(GameTestHelper helpe .copyWithCount((int) Math.round(itemOut.getTotalContentAmount())), STONE.copyWithCount(completed)), "Parallel LCent didn't complete correct number of recipes, completed [" + - ((int) Math.round(itemOut.getTotalContentAmount())) + "] not [" + - completed + "] \nFailed recipes follow:\n" + - TestUtils.getFailures(busHolder.controller.recipeLogic)); + ((int) Math.round(itemOut.getTotalContentAmount())) + "] not [" + completed + + "]\n Current machine state: " + busHolder.controller.recipeLogic.getStatus() + + "\nFailed recipes follow:\n" + TestUtils.getFailures(busHolder.controller.recipeLogic)); helper.assertTrue(TestUtils.isItemWithinRange(results, lowerLimit, upperLimit), "Parallel LCent didn't consume correct number of items, consumed " + (64 - results.getCount()) + "] not [" + lowerLimit + "-" + upperLimit + "]"); @@ -684,8 +684,8 @@ public static void multiblockLCentRangedItemOutput16Parallel(GameTestHelper help int runs = finalI * batches * parallels; helper.assertTrue(itemIn.getStackInSlot(0).isEmpty(), "Parallel LCent didn't complete correct number of recipes, completed [" + - itemIn.getStackInSlot(0).getCount() + "] not [" + runs + - "] \nFailed recipes follow:\n" + + itemIn.getStackInSlot(0).getCount() + "] not [" + runs + "]\n Current machine state: " + + busHolder.controller.recipeLogic.getStatus() + "\nFailed recipes follow:\n" + TestUtils.getFailures(busHolder.controller.recipeLogic)); int resultCount = (int) Math.round(itemOut.getTotalContentAmount()); int lowerLimit = runs * 0; @@ -769,9 +769,9 @@ public static void multiblockLCentRangedItemInputBatched(GameTestHelper helper) .copyWithCount((int) Math.round(itemOut.getTotalContentAmount())), STONE.copyWithCount(completed)), "Parallel LCent didn't complete correct number of recipes, completed [" + - ((int) Math.round(itemOut.getTotalContentAmount())) + "] not [" + - completed + "] \nFailed recipes follow:\n" + - TestUtils.getFailures(busHolder.controller.recipeLogic)); + ((int) Math.round(itemOut.getTotalContentAmount())) + "] not [" + completed + + "]\n Current machine state: " + busHolder.controller.recipeLogic.getStatus() + + "\nFailed recipes follow:\n" + TestUtils.getFailures(busHolder.controller.recipeLogic)); helper.assertTrue(TestUtils.isItemWithinRange(results, lowerLimit, upperLimit), "Parallel LCent didn't consume correct number of items, consumed " + (64 - results.getCount()) + "] not [" + lowerLimit + "-" + upperLimit + "]"); @@ -835,8 +835,8 @@ public static void multiblockLCentRangedItemOutputBatched(GameTestHelper helper) int runs = finalI * batches * parallels; helper.assertTrue(itemIn.getStackInSlot(0).isEmpty(), "Batched LCent didn't complete correct number of recipes, completed [" + - itemIn.getStackInSlot(0).getCount() + "] not [" + runs + - "] \nFailed recipes follow:\n" + + itemIn.getStackInSlot(0).getCount() + "] not [" + runs + "]\n Current machine state: " + + busHolder.controller.recipeLogic.getStatus() + "\nFailed recipes follow:\n" + TestUtils.getFailures(busHolder.controller.recipeLogic)); int resultCount = (int) Math.round(itemOut.getTotalContentAmount()); int lowerLimit = runs * 0; @@ -926,9 +926,9 @@ public static void multiblockLCentRangedItemInput16ParallelBatched(GameTestHelpe .copyWithCount((int) Math.round(itemOut.getTotalContentAmount())), STONE.copyWithCount(completed)), "Batched Parallel LCent didn't complete correct number of recipes, completed [" + - ((int) Math.round(itemOut.getTotalContentAmount())) + "] not [" + - completed + "] \nFailed recipes follow:\n" + - TestUtils.getFailures(busHolder.controller.recipeLogic)); + ((int) Math.round(itemOut.getTotalContentAmount())) + "] not [" + completed + + "]\n Current machine state: " + busHolder.controller.recipeLogic.getStatus() + + "\nFailed recipes follow:\n" + TestUtils.getFailures(busHolder.controller.recipeLogic)); helper.assertTrue(TestUtils.isItemWithinRange(results, lowerLimit, upperLimit), "Batched Parallel LCent didn't consume correct number of items, consumed " + (64 - results.getCount()) + "] not [" + lowerLimit + "-" + upperLimit + "]"); @@ -1000,7 +1000,8 @@ public static void multiblockLCentRangedItemOutput16ParallelBatched(GameTestHelp int runs = finalI * batches * parallels; helper.assertTrue(itemIn.isEmpty(), "Batched Parallel LCent didn't complete correct number of recipes, completed [" + - itemIn.getTotalContentAmount() + "] not [" + runs + "] \nFailed recipes follow:\n" + + itemIn.getTotalContentAmount() + "] not [" + runs + "]\nCurrent machine state: " + + busHolder.controller.recipeLogic.getStatus() + "\nFailed recipes follow:\n" + TestUtils.getFailures(busHolder.controller.recipeLogic)); int resultCount = (int) Math.round(itemOut.getTotalContentAmount()); int lowerLimit = runs * 0; From 34317bb6b49ca17a684d2c0ba423f8142eefd25f Mon Sep 17 00:00:00 2001 From: DilithiumThoride Date: Sat, 30 May 2026 10:19:37 -0500 Subject: [PATCH 4/6] Remove retry attempts from multiblock tests as we suspect they're hiding failure logging. Increase multiblock run count to compensate. Extend output check delay slightly. --- .../IntProviderFluidIngredientTest.java | 79 ++++++++--------- .../ingredient/IntProviderIngredientTest.java | 87 ++++++++----------- .../gtceu/gametest/util/TestUtils.java | 2 +- 3 files changed, 73 insertions(+), 95 deletions(-) diff --git a/src/test/java/com/gregtechceu/gtceu/api/recipe/ingredient/IntProviderFluidIngredientTest.java b/src/test/java/com/gregtechceu/gtceu/api/recipe/ingredient/IntProviderFluidIngredientTest.java index 4df1ce3f773..280bcf93337 100644 --- a/src/test/java/com/gregtechceu/gtceu/api/recipe/ingredient/IntProviderFluidIngredientTest.java +++ b/src/test/java/com/gregtechceu/gtceu/api/recipe/ingredient/IntProviderFluidIngredientTest.java @@ -65,9 +65,10 @@ public class IntProviderFluidIngredientTest { /** * How many times to repeat the Batch and Parallel random roll tests to avoid false positives * Currently set to 7, with singleblock recipes processing up to 9 fluids, allowing for stacks of up to 63 fluids. + * Entire test repeated 10 times for multiblocks */ - @Getter private static final int REPLICAS = 7; + private static final int MULTI_REPLICAS = 10; @BeforeBatch(batch = "RangedFluidIngredients") public static void prepare(ServerLevel level) { @@ -594,10 +595,8 @@ public static void multiblockLCRRangedFluidOutput(GameTestHelper helper) { // test for multiblock machine with 16x Parallels with ranged fluid input @GameTest(template = "large_centrifuge_zpm_batch_parallel16", - batch = "RangedFluidIngredients", - timeoutTicks = 2000, - requiredSuccesses = 1, - attempts = 10) + batch = "RangedFluidIngredients", + timeoutTicks = 2000) public static void multiblockLCentRangedFluidInput16Parallel(GameTestHelper helper) { BusHolderBatchParallel busHolder = getBussesAndFormLCENT(helper); @@ -614,21 +613,21 @@ public static void multiblockLCentRangedFluidInput16Parallel(GameTestHelper help itemIn.setStackInSlot(0, COBBLE.copyWithCount(batches * parallels)); fluidIn.setFluidInTank(0, new FluidStack(LCENT_IN, amount)); - // 1t to turn on, 4t per recipe run + // 1t to turn on, 1t per recipe run, 4t buffer for sanity // 16 parallels // check the results of all rolls together // repeat recipe REPLICAS times int[] rolls = new int[REPLICAS]; for (int i = 1; i <= REPLICAS; i++) { final int finalI = i; // lambda preserve you - helper.runAfterDelay(17 * finalI, () -> { + helper.runAfterDelay(21 * finalI, () -> { FluidStack results = fluidIn.getFluidInTank(0); int upperLimit = amount - (batches * parallels * 0); int lowerLimit = amount - (batches * parallels * 40); int completed = batches * parallels * finalI; helper.assertTrue( TestUtils.isFluidStackEqual(new FluidStack(fluidOut.getFluidInTank(0), - ((int) Math.round(fluidOut.getTotalContentAmount()))), + ((int) Math.round(fluidOut.getTotalContentAmount()))), new FluidStack(REDSTONE, completed)), "Parallel LCent didn't complete correct number of recipes, completed [" + ((int) Math.round(fluidOut.getTotalContentAmount())) + "] not [" + completed + @@ -646,7 +645,7 @@ public static void multiblockLCentRangedFluidInput16Parallel(GameTestHelper help }); } - helper.runAfterDelay(1 + 17 * REPLICAS, () -> { + helper.runAfterDelay(1 + 21 * REPLICAS, () -> { // check if each roll was a multiple of run count boolean sus = false; for (int i = 0; i < REPLICAS; i++) { @@ -669,10 +668,8 @@ public static void multiblockLCentRangedFluidInput16Parallel(GameTestHelper help // test for multiblock machine with 16x Parallels with ranged fluid output @GameTest(template = "large_centrifuge_zpm_batch_parallel16", - batch = "RangedFluidIngredients", - timeoutTicks = 2000, - requiredSuccesses = 1, - attempts = 10) + batch = "RangedFluidIngredients", + timeoutTicks = 2000) public static void multiblockLCentRangedFluidOutput16Parallel(GameTestHelper helper) { BusHolderBatchParallel busHolder = getBussesAndFormLCENT(helper); @@ -686,14 +683,14 @@ public static void multiblockLCentRangedFluidOutput16Parallel(GameTestHelper hel busHolder.controller.setBatchEnabled(false); busHolder.parallelHatch.setCurrentParallel(parallels); - // 1t to turn on, 1t per recipe run + // 1t to turn on, 1t per recipe run, 4t buffer for sanity // 16 parallels // check the results of all rolls together // repeat recipe REPLICAS times int[] addedRolls = new int[REPLICAS]; for (int i = 1; i <= REPLICAS; i++) { final int finalI = i; // lambda preserve you - helper.runAfterDelay(17 * finalI, () -> { + helper.runAfterDelay(21 * finalI, () -> { int runs = finalI * batches * parallels; helper.assertTrue(fluidIn.getFluidInTank(0).isEmpty(), "Parallel LCent didn't complete correct number of recipes, completed [" + @@ -714,7 +711,7 @@ public static void multiblockLCentRangedFluidOutput16Parallel(GameTestHelper hel }); } - helper.runAfterDelay(1 + 17 * REPLICAS, () -> { + helper.runAfterDelay(1 + 21 * REPLICAS, () -> { // check if each roll was a multiple of run count boolean sus = false; int[] rolls = new int[REPLICAS]; @@ -747,10 +744,8 @@ public static void multiblockLCentRangedFluidOutput16Parallel(GameTestHelper hel // test for multiblock machine with 16x Parallels with ranged fluid input @GameTest(template = "large_centrifuge_zpm_batch_parallel16", - batch = "RangedFluidIngredients", - timeoutTicks = 2000, - requiredSuccesses = 1, - attempts = 10) + batch = "RangedFluidIngredients", + timeoutTicks = 2000) public static void multiblockLCentRangedFluidInputBatched(GameTestHelper helper) { BusHolderBatchParallel busHolder = getBussesAndFormLCENT(helper); @@ -767,21 +762,21 @@ public static void multiblockLCentRangedFluidInputBatched(GameTestHelper helper) itemIn.setStackInSlot(0, COBBLE.copyWithCount(batches * parallels)); fluidIn.setFluidInTank(0, new FluidStack(LCENT_IN, amount)); - // 1t to turn on, 1t per recipe run + // 1t to turn on, 1t per recipe run, 4t buffer for sanity // 16 batches // check the results of all rolls together // repeat recipe REPLICAS times int[] rolls = new int[REPLICAS]; for (int i = 1; i <= REPLICAS; i++) { final int finalI = i; // lambda preserve you - helper.runAfterDelay(17 * finalI, () -> { + helper.runAfterDelay(21 * finalI, () -> { FluidStack results = fluidIn.getFluidInTank(0); int upperLimit = amount - (batches * parallels * 0); int lowerLimit = amount - (batches * parallels * 40); int completed = batches * parallels * finalI; helper.assertTrue( TestUtils.isFluidStackEqual(new FluidStack(fluidOut.getFluidInTank(0), - ((int) Math.round(fluidOut.getTotalContentAmount()))), + ((int) Math.round(fluidOut.getTotalContentAmount()))), new FluidStack(REDSTONE, completed)), "Batched LCent didn't complete correct number of recipes, completed [" + ((int) Math.round(fluidOut.getTotalContentAmount())) + "] not [" + completed + @@ -799,7 +794,7 @@ public static void multiblockLCentRangedFluidInputBatched(GameTestHelper helper) }); } - helper.runAfterDelay(1 + 17 * REPLICAS, () -> { + helper.runAfterDelay(1 + 21 * REPLICAS, () -> { // check if each roll was a multiple of run count boolean sus = false; for (int i = 0; i < REPLICAS; i++) { @@ -822,10 +817,8 @@ public static void multiblockLCentRangedFluidInputBatched(GameTestHelper helper) // test for multiblock machine with 16x Parallels with ranged fluid output @GameTest(template = "large_centrifuge_zpm_batch_parallel16", - batch = "RangedFluidIngredients", - timeoutTicks = 2000, - requiredSuccesses = 1, - attempts = 10) + batch = "RangedFluidIngredients", + timeoutTicks = 2000) public static void multiblockLCentRangedFluidOutputBatched(GameTestHelper helper) { BusHolderBatchParallel busHolder = getBussesAndFormLCENT(helper); @@ -839,14 +832,14 @@ public static void multiblockLCentRangedFluidOutputBatched(GameTestHelper helper busHolder.controller.setBatchEnabled(true); busHolder.parallelHatch.setCurrentParallel(parallels); - // 1t to turn on, 1t per recipe run + // 1t to turn on, 1t per recipe run, 4t buffer for sanity // 16 parallels // check the results of all rolls together // repeat recipe REPLICAS times int[] addedRolls = new int[REPLICAS]; for (int i = 1; i <= REPLICAS; i++) { final int finalI = i; // lambda preserve you - helper.runAfterDelay(17 * finalI, () -> { + helper.runAfterDelay(21 * finalI, () -> { int runs = finalI * batches * parallels; helper.assertTrue(fluidIn.getFluidInTank(0).isEmpty(), "Batched LCent didn't complete correct number of recipes, completed [" + @@ -867,7 +860,7 @@ public static void multiblockLCentRangedFluidOutputBatched(GameTestHelper helper }); } - helper.runAfterDelay(1 + 17 * REPLICAS, () -> { + helper.runAfterDelay(1 + 21 * REPLICAS, () -> { // check if each roll was a multiple of run count boolean sus = false; int[] rolls = new int[REPLICAS]; @@ -900,10 +893,8 @@ public static void multiblockLCentRangedFluidOutputBatched(GameTestHelper helper // test for multiblock machine with 16x Parallels with ranged fluid input @GameTest(template = "large_centrifuge_zpm_batch_parallel16", - batch = "RangedFluidIngredients", - timeoutTicks = 500, - requiredSuccesses = 1, - attempts = 10) + batch = "RangedFluidIngredients", + timeoutTicks = 2000) public static void multiblockLCentRangedFluidInput16ParallelBatched(GameTestHelper helper) { BusHolderBatchParallel busHolder = getBussesAndFormLCENT(helper); @@ -924,13 +915,13 @@ public static void multiblockLCentRangedFluidInput16ParallelBatched(GameTestHelp } fluidIn.setFluidInTank(0, new FluidStack(LCENT_IN, amount)); - // 1t to turn on, 64t per recipe run + // 1t to turn on, 64t per recipe run, 10t buffer for sanity // check the results of all rolls together // repeat recipe REPLICAS times int[] rolls = new int[REPLICAS]; for (int i = 1; i <= REPLICAS; i++) { final int finalI = i; // lambda preserve you - helper.runAfterDelay(65 * finalI, () -> { + helper.runAfterDelay(75 * finalI, () -> { FluidStack results = fluidIn.getFluidInTank(0); int completed = batches * parallels * finalI; helper.assertTrue( @@ -958,7 +949,7 @@ public static void multiblockLCentRangedFluidInput16ParallelBatched(GameTestHelp }); } - helper.runAfterDelay(1 + 65 * REPLICAS, () -> { + helper.runAfterDelay(1 + 75 * REPLICAS, () -> { // check if each roll was a multiple of run count boolean sus = false; for (int i = 0; i < REPLICAS; i++) { @@ -981,10 +972,8 @@ public static void multiblockLCentRangedFluidInput16ParallelBatched(GameTestHelp // test for multiblock machine with 16x Parallels with ranged fluid output @GameTest(template = "large_centrifuge_zpm_batch_parallel16", - batch = "RangedFluidIngredients", - timeoutTicks = 500, - requiredSuccesses = 1, - attempts = 10) + batch = "RangedFluidIngredients", + timeoutTicks = 2000) public static void multiblockLCentRangedFluidOutput16ParallelBatched(GameTestHelper helper) { BusHolderBatchParallel busHolder = getBussesAndFormLCENT(helper); @@ -998,13 +987,13 @@ public static void multiblockLCentRangedFluidOutput16ParallelBatched(GameTestHel fluidIn.setFluidInTank(0, new FluidStack(LCENT_OUT, batches * parallels)); - // 1t to turn on, 64t per recipe run + // 1t to turn on, 64t per recipe run, 10t buffer for sanity // check the results of all rolls together // repeat recipe REPLICAS times int[] addedRolls = new int[REPLICAS]; for (int i = 1; i <= REPLICAS; i++) { final int finalI = i; // lambda preserve you - helper.runAfterDelay(65 * finalI, () -> { + helper.runAfterDelay(75 * finalI, () -> { int runs = finalI * batches * parallels; helper.assertTrue(fluidIn.isEmpty(), "Batched Parallel LCent didn't complete correct number of recipes, completed [" + @@ -1025,7 +1014,7 @@ public static void multiblockLCentRangedFluidOutput16ParallelBatched(GameTestHel }); } - helper.runAfterDelay(1 + 65 * REPLICAS, () -> { + helper.runAfterDelay(1 + 75 * REPLICAS, () -> { // check if each roll was a multiple of run count boolean sus = false; int[] rolls = new int[REPLICAS]; diff --git a/src/test/java/com/gregtechceu/gtceu/api/recipe/ingredient/IntProviderIngredientTest.java b/src/test/java/com/gregtechceu/gtceu/api/recipe/ingredient/IntProviderIngredientTest.java index 03d61713c60..3123516fae3 100644 --- a/src/test/java/com/gregtechceu/gtceu/api/recipe/ingredient/IntProviderIngredientTest.java +++ b/src/test/java/com/gregtechceu/gtceu/api/recipe/ingredient/IntProviderIngredientTest.java @@ -60,9 +60,10 @@ public class IntProviderIngredientTest { /** * How many times to repeat the Batch and Parallel random roll tests to avoid false positives * Currently set to 7, with singleblock recipes processing up to 9 items, allowing for stacks of up to 63 items. + * Entire test repeated 10 times for multiblocks */ - @Getter private static final int REPLICAS = 7; + private static final int MULTI_REPLICAS = 10; @BeforeBatch(batch = "RangedIngredients") public static void prepare(ServerLevel level) { @@ -583,10 +584,8 @@ public static void multiblockLCRRangedItemOutput(GameTestHelper helper) { // test for multiblock machine with 16x Parallels with ranged item input @GameTest(template = "large_centrifuge_zpm_batch_parallel16", - batch = "RangedIngredients", - timeoutTicks = 2000, - requiredSuccesses = 1, - attempts = 10) + batch = "RangedIngredients", + timeoutTicks = 2000) public static void multiblockLCentRangedItemInput16Parallel(GameTestHelper helper) { BusHolderBatchParallel busHolder = getBussesAndFormLCENT(helper); @@ -601,21 +600,21 @@ public static void multiblockLCentRangedItemInput16Parallel(GameTestHelper helpe itemIn.setStackInSlot(0, LCENT_IN.copyWithCount(64)); itemIn.setStackInSlot(1, COBBLE.copyWithCount(parallels)); - // 1t to turn on, 4t per recipe run + // 1t to turn on, 1t per recipe run, 4t buffer for sanity // 16 parallels // check the results of all rolls together // repeat recipe REPLICAS times int[] rolls = new int[REPLICAS]; for (int i = 1; i <= REPLICAS; i++) { final int finalI = i; // lambda preserve you - helper.runAfterDelay(17 * finalI, () -> { + helper.runAfterDelay(21 * finalI, () -> { ItemStack results = itemIn.getStackInSlot(0); int upperLimit = 64 - (batches * parallels * 0); int lowerLimit = 64 - (batches * parallels * 4); int completed = batches * parallels * finalI; helper.assertTrue( TestUtils.isItemStackEqual(itemOut.getStackInSlot(0) - .copyWithCount((int) Math.round(itemOut.getTotalContentAmount())), + .copyWithCount((int) Math.round(itemOut.getTotalContentAmount())), STONE.copyWithCount(completed)), "Parallel LCent didn't complete correct number of recipes, completed [" + ((int) Math.round(itemOut.getTotalContentAmount())) + "] not [" + completed + @@ -633,7 +632,7 @@ public static void multiblockLCentRangedItemInput16Parallel(GameTestHelper helpe }); } - helper.runAfterDelay(1 + 17 * REPLICAS, () -> { + helper.runAfterDelay(1 + 21 * REPLICAS, () -> { // check if each roll was a multiple of run count boolean sus = false; for (int i = 0; i < REPLICAS; i++) { @@ -656,10 +655,8 @@ public static void multiblockLCentRangedItemInput16Parallel(GameTestHelper helpe // test for multiblock machine with 16x Parallels with ranged item output @GameTest(template = "large_centrifuge_zpm_batch_parallel16", - batch = "RangedIngredients", - timeoutTicks = 2000, - requiredSuccesses = 1, - attempts = 10) + batch = "RangedIngredients", + timeoutTicks = 2000) public static void multiblockLCentRangedItemOutput16Parallel(GameTestHelper helper) { BusHolderBatchParallel busHolder = getBussesAndFormLCENT(helper); @@ -673,18 +670,18 @@ public static void multiblockLCentRangedItemOutput16Parallel(GameTestHelper help busHolder.controller.setBatchEnabled(false); busHolder.parallelHatch.setCurrentParallel(parallels); - // 1t to turn on, 1t per recipe run + // 1t to turn on, 1t per recipe run, 4t buffer for sanity // 16 parallels // check the results of all rolls together // repeat recipe REPLICAS times int[] addedRolls = new int[REPLICAS]; for (int i = 1; i <= REPLICAS; i++) { final int finalI = i; // lambda preserve you - helper.runAfterDelay(17 * finalI, () -> { + helper.runAfterDelay(21 * finalI, () -> { int runs = finalI * batches * parallels; helper.assertTrue(itemIn.getStackInSlot(0).isEmpty(), "Parallel LCent didn't complete correct number of recipes, completed [" + - itemIn.getStackInSlot(0).getCount() + "] not [" + runs + "]\n Current machine state: " + + (int) Math.round(itemIn.getTotalContentAmount()) + "] not [" + runs + "]\n Current machine state: " + busHolder.controller.recipeLogic.getStatus() + "\nFailed recipes follow:\n" + TestUtils.getFailures(busHolder.controller.recipeLogic)); int resultCount = (int) Math.round(itemOut.getTotalContentAmount()); @@ -701,7 +698,7 @@ public static void multiblockLCentRangedItemOutput16Parallel(GameTestHelper help }); } - helper.runAfterDelay(1 + 17 * REPLICAS, () -> { + helper.runAfterDelay(1 + 21 * REPLICAS, () -> { // check if each roll was a multiple of run count boolean sus = false; int[] rolls = new int[REPLICAS]; @@ -734,10 +731,8 @@ public static void multiblockLCentRangedItemOutput16Parallel(GameTestHelper help // test for multiblock machine with 16x Parallels with ranged item input @GameTest(template = "large_centrifuge_zpm_batch_parallel16", - batch = "RangedIngredients", - timeoutTicks = 2000, - requiredSuccesses = 1, - attempts = 10) + batch = "RangedIngredients", + timeoutTicks = 2000) public static void multiblockLCentRangedItemInputBatched(GameTestHelper helper) { BusHolderBatchParallel busHolder = getBussesAndFormLCENT(helper); @@ -752,21 +747,21 @@ public static void multiblockLCentRangedItemInputBatched(GameTestHelper helper) itemIn.setStackInSlot(0, LCENT_IN.copyWithCount(64)); itemIn.setStackInSlot(1, COBBLE.copyWithCount(batches)); - // 1t to turn on, 1t per recipe run + // 1t to turn on, 1t per recipe run, 4t buffer for sanity // 16 batches // check the results of all rolls together // repeat recipe REPLICAS times int[] rolls = new int[REPLICAS]; for (int i = 1; i <= REPLICAS; i++) { final int finalI = i; // lambda preserve you - helper.runAfterDelay(17 * finalI, () -> { + helper.runAfterDelay(21 * finalI, () -> { ItemStack results = itemIn.getStackInSlot(0); int upperLimit = 64 - (batches * parallels * 0); int lowerLimit = 64 - (batches * parallels * 4); int completed = batches * parallels * finalI; helper.assertTrue( TestUtils.isItemStackEqual(itemOut.getStackInSlot(0) - .copyWithCount((int) Math.round(itemOut.getTotalContentAmount())), + .copyWithCount((int) Math.round(itemOut.getTotalContentAmount())), STONE.copyWithCount(completed)), "Parallel LCent didn't complete correct number of recipes, completed [" + ((int) Math.round(itemOut.getTotalContentAmount())) + "] not [" + completed + @@ -784,7 +779,7 @@ public static void multiblockLCentRangedItemInputBatched(GameTestHelper helper) }); } - helper.runAfterDelay(1 + 17 * REPLICAS, () -> { + helper.runAfterDelay(1 + 21 * REPLICAS, () -> { // check if each roll was a multiple of run count boolean sus = false; for (int i = 0; i < REPLICAS; i++) { @@ -807,10 +802,8 @@ public static void multiblockLCentRangedItemInputBatched(GameTestHelper helper) // test for multiblock machine with 16x Parallels with ranged item output @GameTest(template = "large_centrifuge_zpm_batch_parallel16", - batch = "RangedIngredients", - timeoutTicks = 2000, - requiredSuccesses = 1, - attempts = 10) + batch = "RangedIngredients", + timeoutTicks = 2000) public static void multiblockLCentRangedItemOutputBatched(GameTestHelper helper) { BusHolderBatchParallel busHolder = getBussesAndFormLCENT(helper); @@ -824,14 +817,14 @@ public static void multiblockLCentRangedItemOutputBatched(GameTestHelper helper) busHolder.controller.setBatchEnabled(true); busHolder.parallelHatch.setCurrentParallel(parallels); - // 1t to turn on, 1t per recipe run + // 1t to turn on, 1t per recipe run, 4t buffer for sanity // 16 parallels // check the results of all rolls together // repeat recipe REPLICAS times int[] addedRolls = new int[REPLICAS]; for (int i = 1; i <= REPLICAS; i++) { final int finalI = i; // lambda preserve you - helper.runAfterDelay(17 * finalI, () -> { + helper.runAfterDelay(21 * finalI, () -> { int runs = finalI * batches * parallels; helper.assertTrue(itemIn.getStackInSlot(0).isEmpty(), "Batched LCent didn't complete correct number of recipes, completed [" + @@ -852,7 +845,7 @@ public static void multiblockLCentRangedItemOutputBatched(GameTestHelper helper) }); } - helper.runAfterDelay(1 + 17 * REPLICAS, () -> { + helper.runAfterDelay(1 + 21 * REPLICAS, () -> { // check if each roll was a multiple of run count boolean sus = false; int[] rolls = new int[REPLICAS]; @@ -885,10 +878,8 @@ public static void multiblockLCentRangedItemOutputBatched(GameTestHelper helper) // test for multiblock machine with 16x Parallels with ranged item input @GameTest(template = "large_centrifuge_zpm_batch_parallel16", - batch = "RangedIngredients", - timeoutTicks = 500, - requiredSuccesses = 1, - attempts = 10) + batch = "RangedIngredients", + timeoutTicks = 2000) public static void multiblockLCentRangedItemInput16ParallelBatched(GameTestHelper helper) { BusHolderBatchParallel busHolder = getBussesAndFormLCENT(helper); @@ -910,21 +901,21 @@ public static void multiblockLCentRangedItemInput16ParallelBatched(GameTestHelpe itemIn.setStackInSlot(k, LCENT_IN.copyWithCount(64)); } - // 1t to turn on, 1t per recipe run + // 1t to turn on, 64t per recipe run, 10t buffer for sanity // 16 parallels // check the results of all rolls together // repeat recipe REPLICAS times int[] rolls = new int[REPLICAS]; for (int i = 1; i <= REPLICAS; i++) { final int finalI = i; // lambda preserve you - helper.runAfterDelay(65 * finalI, () -> { + helper.runAfterDelay(75 * finalI, () -> { ItemStack results = itemIn.getStackInSlot(0); int upperLimit = 64 - (batches * parallels * 0); int lowerLimit = 64 - (batches * parallels * 4); int completed = batches * parallels * finalI; helper.assertTrue(TestUtils.isItemStackEqual(itemOut.getStackInSlot(0) - .copyWithCount((int) Math.round(itemOut.getTotalContentAmount())), - STONE.copyWithCount(completed)), + .copyWithCount((int) Math.round(itemOut.getTotalContentAmount())), + STONE.copyWithCount(completed)), "Batched Parallel LCent didn't complete correct number of recipes, completed [" + ((int) Math.round(itemOut.getTotalContentAmount())) + "] not [" + completed + "]\n Current machine state: " + busHolder.controller.recipeLogic.getStatus() + @@ -947,7 +938,7 @@ public static void multiblockLCentRangedItemInput16ParallelBatched(GameTestHelpe }); } - helper.runAfterDelay(1 + 65 * REPLICAS, () -> { + helper.runAfterDelay(1 + 75 * REPLICAS, () -> { // check if each roll was a multiple of run count boolean sus = false; for (int i = 0; i < REPLICAS; i++) { @@ -970,10 +961,8 @@ public static void multiblockLCentRangedItemInput16ParallelBatched(GameTestHelpe // test for multiblock machine with 16x Parallels with ranged item output @GameTest(template = "large_centrifuge_zpm_batch_parallel16", - batch = "RangedIngredients", - timeoutTicks = 500, - requiredSuccesses = 1, - attempts = 10) + batch = "RangedIngredients", + timeoutTicks = 2000) public static void multiblockLCentRangedItemOutput16ParallelBatched(GameTestHelper helper) { BusHolderBatchParallel busHolder = getBussesAndFormLCENT(helper); @@ -989,18 +978,18 @@ public static void multiblockLCentRangedItemOutput16ParallelBatched(GameTestHelp itemIn.setStackInSlot(j, LCENT_OUT.copyWithCount(16)); } - // 1t to turn on, 1t per recipe run + // 1t to turn on, 64t per recipe run, 10t buffer for sanity // 16 parallels // check the results of all rolls together // repeat recipe REPLICAS times int[] addedRolls = new int[REPLICAS]; for (int i = 1; i <= REPLICAS; i++) { final int finalI = i; // lambda preserve you - helper.runAfterDelay(65 * finalI, () -> { + helper.runAfterDelay(75 * finalI, () -> { int runs = finalI * batches * parallels; helper.assertTrue(itemIn.isEmpty(), "Batched Parallel LCent didn't complete correct number of recipes, completed [" + - itemIn.getTotalContentAmount() + "] not [" + runs + "]\nCurrent machine state: " + + (runs - itemIn.getTotalContentAmount()) + "] not [" + runs + "]\nCurrent machine state: " + busHolder.controller.recipeLogic.getStatus() + "\nFailed recipes follow:\n" + TestUtils.getFailures(busHolder.controller.recipeLogic)); int resultCount = (int) Math.round(itemOut.getTotalContentAmount()); @@ -1019,7 +1008,7 @@ public static void multiblockLCentRangedItemOutput16ParallelBatched(GameTestHelp }); } - helper.runAfterDelay(1 + 65 * REPLICAS, () -> { + helper.runAfterDelay(1 + 75 * REPLICAS, () -> { // check if each roll was a multiple of run count boolean sus = false; int[] rolls = new int[REPLICAS]; diff --git a/src/test/java/com/gregtechceu/gtceu/gametest/util/TestUtils.java b/src/test/java/com/gregtechceu/gtceu/gametest/util/TestUtils.java index 8e48da0c4d2..1b3481957a9 100644 --- a/src/test/java/com/gregtechceu/gtceu/gametest/util/TestUtils.java +++ b/src/test/java/com/gregtechceu/gtceu/gametest/util/TestUtils.java @@ -233,7 +233,7 @@ public static String getFailures(RecipeLogic recipeLogic) { StringBuilder failures = new StringBuilder(); if (!reasons.isEmpty()) { for (var reason : reasons.entrySet()) { - failures.append(reason.getKey().id).append(" - ").append(reason.getValue().plainCopy()).append("\n"); + failures.append(reason.getKey().id).append(" - ").append(reason).append("\n"); } } return failures.toString(); From 9322c9a9be9355487792c2ba22886a5565c86c1b Mon Sep 17 00:00:00 2001 From: DilithiumThoride Date: Sat, 30 May 2026 11:24:50 -0500 Subject: [PATCH 5/6] repeat batch/parallel tests a bunch more --- .../IntProviderFluidIngredientTest.java | 70 ++++++++--------- .../ingredient/IntProviderIngredientTest.java | 78 ++++++++++--------- 2 files changed, 76 insertions(+), 72 deletions(-) diff --git a/src/test/java/com/gregtechceu/gtceu/api/recipe/ingredient/IntProviderFluidIngredientTest.java b/src/test/java/com/gregtechceu/gtceu/api/recipe/ingredient/IntProviderFluidIngredientTest.java index 280bcf93337..a2028c5d569 100644 --- a/src/test/java/com/gregtechceu/gtceu/api/recipe/ingredient/IntProviderFluidIngredientTest.java +++ b/src/test/java/com/gregtechceu/gtceu/api/recipe/ingredient/IntProviderFluidIngredientTest.java @@ -65,10 +65,10 @@ public class IntProviderFluidIngredientTest { /** * How many times to repeat the Batch and Parallel random roll tests to avoid false positives * Currently set to 7, with singleblock recipes processing up to 9 fluids, allowing for stacks of up to 63 fluids. - * Entire test repeated 10 times for multiblocks + * Set 20 times for Batch/Parallel multis */ private static final int REPLICAS = 7; - private static final int MULTI_REPLICAS = 10; + private static final int MULTI_REPLICAS = 20; @BeforeBatch(batch = "RangedFluidIngredients") public static void prepare(ServerLevel level) { @@ -616,9 +616,9 @@ public static void multiblockLCentRangedFluidInput16Parallel(GameTestHelper help // 1t to turn on, 1t per recipe run, 4t buffer for sanity // 16 parallels // check the results of all rolls together - // repeat recipe REPLICAS times - int[] rolls = new int[REPLICAS]; - for (int i = 1; i <= REPLICAS; i++) { + // repeat recipe MULTI_REPLICAS times + int[] rolls = new int[MULTI_REPLICAS]; + for (int i = 1; i <= MULTI_REPLICAS; i++) { final int finalI = i; // lambda preserve you helper.runAfterDelay(21 * finalI, () -> { FluidStack results = fluidIn.getFluidInTank(0); @@ -645,10 +645,10 @@ public static void multiblockLCentRangedFluidInput16Parallel(GameTestHelper help }); } - helper.runAfterDelay(1 + 21 * REPLICAS, () -> { + helper.runAfterDelay(1 + 21 * MULTI_REPLICAS, () -> { // check if each roll was a multiple of run count boolean sus = false; - for (int i = 0; i < REPLICAS; i++) { + for (int i = 0; i < MULTI_REPLICAS; i++) { if (TestUtils.isStackSizeExactlyEvenMultiple(rolls[i], batches, parallels, 1)) { sus = true; GTCEu.LOGGER.warn("Parallel LCent ranged fluid input test iteration " + i + " consumed [" + @@ -686,9 +686,9 @@ public static void multiblockLCentRangedFluidOutput16Parallel(GameTestHelper hel // 1t to turn on, 1t per recipe run, 4t buffer for sanity // 16 parallels // check the results of all rolls together - // repeat recipe REPLICAS times - int[] addedRolls = new int[REPLICAS]; - for (int i = 1; i <= REPLICAS; i++) { + // repeat recipe MULTI_REPLICAS times + int[] addedRolls = new int[MULTI_REPLICAS]; + for (int i = 1; i <= MULTI_REPLICAS; i++) { final int finalI = i; // lambda preserve you helper.runAfterDelay(21 * finalI, () -> { int runs = finalI * batches * parallels; @@ -711,10 +711,10 @@ public static void multiblockLCentRangedFluidOutput16Parallel(GameTestHelper hel }); } - helper.runAfterDelay(1 + 21 * REPLICAS, () -> { + helper.runAfterDelay(1 + 21 * MULTI_REPLICAS, () -> { // check if each roll was a multiple of run count boolean sus = false; - int[] rolls = new int[REPLICAS]; + int[] rolls = new int[MULTI_REPLICAS]; rolls[0] = addedRolls[0]; if (TestUtils.isStackSizeExactlyEvenMultiple(rolls[0], batches, parallels, 1)) { @@ -723,7 +723,7 @@ public static void multiblockLCentRangedFluidOutput16Parallel(GameTestHelper hel rolls[0] + "] fluids, a multiple of its Batch * Parallel count (" + (batches * parallels) + "). If this message only appears once, this is likely a false positive."); } - for (int i = 1; i < REPLICAS; i++) { + for (int i = 1; i < MULTI_REPLICAS; i++) { rolls[i] = addedRolls[i] - addedRolls[i - 1]; if (TestUtils.isStackSizeExactlyEvenMultiple(rolls[i], batches, parallels, 1)) { sus = true; @@ -765,9 +765,9 @@ public static void multiblockLCentRangedFluidInputBatched(GameTestHelper helper) // 1t to turn on, 1t per recipe run, 4t buffer for sanity // 16 batches // check the results of all rolls together - // repeat recipe REPLICAS times - int[] rolls = new int[REPLICAS]; - for (int i = 1; i <= REPLICAS; i++) { + // repeat recipe MULTI_REPLICAS times + int[] rolls = new int[MULTI_REPLICAS]; + for (int i = 1; i <= MULTI_REPLICAS; i++) { final int finalI = i; // lambda preserve you helper.runAfterDelay(21 * finalI, () -> { FluidStack results = fluidIn.getFluidInTank(0); @@ -794,10 +794,10 @@ public static void multiblockLCentRangedFluidInputBatched(GameTestHelper helper) }); } - helper.runAfterDelay(1 + 21 * REPLICAS, () -> { + helper.runAfterDelay(1 + 21 * MULTI_REPLICAS, () -> { // check if each roll was a multiple of run count boolean sus = false; - for (int i = 0; i < REPLICAS; i++) { + for (int i = 0; i < MULTI_REPLICAS; i++) { if (TestUtils.isStackSizeExactlyEvenMultiple(rolls[i], batches, parallels, 1)) { sus = true; GTCEu.LOGGER.warn("Batched LCent ranged fluid input test iteration " + i + " consumed [" + @@ -835,9 +835,9 @@ public static void multiblockLCentRangedFluidOutputBatched(GameTestHelper helper // 1t to turn on, 1t per recipe run, 4t buffer for sanity // 16 parallels // check the results of all rolls together - // repeat recipe REPLICAS times - int[] addedRolls = new int[REPLICAS]; - for (int i = 1; i <= REPLICAS; i++) { + // repeat recipe MULTI_REPLICAS times + int[] addedRolls = new int[MULTI_REPLICAS]; + for (int i = 1; i <= MULTI_REPLICAS; i++) { final int finalI = i; // lambda preserve you helper.runAfterDelay(21 * finalI, () -> { int runs = finalI * batches * parallels; @@ -860,10 +860,10 @@ public static void multiblockLCentRangedFluidOutputBatched(GameTestHelper helper }); } - helper.runAfterDelay(1 + 21 * REPLICAS, () -> { + helper.runAfterDelay(1 + 21 * MULTI_REPLICAS, () -> { // check if each roll was a multiple of run count boolean sus = false; - int[] rolls = new int[REPLICAS]; + int[] rolls = new int[MULTI_REPLICAS]; rolls[0] = addedRolls[0]; if (TestUtils.isStackSizeExactlyEvenMultiple(rolls[0], batches, parallels, 1)) { @@ -872,7 +872,7 @@ public static void multiblockLCentRangedFluidOutputBatched(GameTestHelper helper rolls[0] + "] fluids, a multiple of its Batch * Parallel count (" + batches + "). If this message only appears once, this is likely a false positive."); } - for (int i = 1; i < REPLICAS; i++) { + for (int i = 1; i < MULTI_REPLICAS; i++) { rolls[i] = addedRolls[i] - addedRolls[i - 1]; if (TestUtils.isStackSizeExactlyEvenMultiple(rolls[i], batches, parallels, 1)) { sus = true; @@ -917,9 +917,9 @@ public static void multiblockLCentRangedFluidInput16ParallelBatched(GameTestHelp // 1t to turn on, 64t per recipe run, 10t buffer for sanity // check the results of all rolls together - // repeat recipe REPLICAS times - int[] rolls = new int[REPLICAS]; - for (int i = 1; i <= REPLICAS; i++) { + // repeat recipe MULTI_REPLICAS times + int[] rolls = new int[MULTI_REPLICAS]; + for (int i = 1; i <= MULTI_REPLICAS; i++) { final int finalI = i; // lambda preserve you helper.runAfterDelay(75 * finalI, () -> { FluidStack results = fluidIn.getFluidInTank(0); @@ -949,10 +949,10 @@ public static void multiblockLCentRangedFluidInput16ParallelBatched(GameTestHelp }); } - helper.runAfterDelay(1 + 75 * REPLICAS, () -> { + helper.runAfterDelay(1 + 75 * MULTI_REPLICAS, () -> { // check if each roll was a multiple of run count boolean sus = false; - for (int i = 0; i < REPLICAS; i++) { + for (int i = 0; i < MULTI_REPLICAS; i++) { if (TestUtils.isStackSizeExactlyEvenMultiple(rolls[i], batches, parallels, 1)) { sus = true; GTCEu.LOGGER.warn("Batched Parallel LCent ranged fluid input test iteration " + i + " consumed [" + @@ -989,9 +989,9 @@ public static void multiblockLCentRangedFluidOutput16ParallelBatched(GameTestHel // 1t to turn on, 64t per recipe run, 10t buffer for sanity // check the results of all rolls together - // repeat recipe REPLICAS times - int[] addedRolls = new int[REPLICAS]; - for (int i = 1; i <= REPLICAS; i++) { + // repeat recipe MULTI_REPLICAS times + int[] addedRolls = new int[MULTI_REPLICAS]; + for (int i = 1; i <= MULTI_REPLICAS; i++) { final int finalI = i; // lambda preserve you helper.runAfterDelay(75 * finalI, () -> { int runs = finalI * batches * parallels; @@ -1014,10 +1014,10 @@ public static void multiblockLCentRangedFluidOutput16ParallelBatched(GameTestHel }); } - helper.runAfterDelay(1 + 75 * REPLICAS, () -> { + helper.runAfterDelay(1 + 75 * MULTI_REPLICAS, () -> { // check if each roll was a multiple of run count boolean sus = false; - int[] rolls = new int[REPLICAS]; + int[] rolls = new int[MULTI_REPLICAS]; rolls[0] = addedRolls[0]; if (TestUtils.isStackSizeExactlyEvenMultiple(rolls[0], batches, parallels, 1)) { @@ -1026,7 +1026,7 @@ public static void multiblockLCentRangedFluidOutput16ParallelBatched(GameTestHel rolls[0] + "] fluids, a multiple of its Batch * Parallel count (" + (batches * parallels) + "). If this message only appears once, this is likely a false positive."); } - for (int i = 1; i < REPLICAS; i++) { + for (int i = 1; i < MULTI_REPLICAS; i++) { rolls[i] = addedRolls[i] - addedRolls[i - 1]; if (TestUtils.isStackSizeExactlyEvenMultiple(rolls[i], batches, parallels, 1)) { sus = true; diff --git a/src/test/java/com/gregtechceu/gtceu/api/recipe/ingredient/IntProviderIngredientTest.java b/src/test/java/com/gregtechceu/gtceu/api/recipe/ingredient/IntProviderIngredientTest.java index 3123516fae3..a54ca77ba1c 100644 --- a/src/test/java/com/gregtechceu/gtceu/api/recipe/ingredient/IntProviderIngredientTest.java +++ b/src/test/java/com/gregtechceu/gtceu/api/recipe/ingredient/IntProviderIngredientTest.java @@ -60,10 +60,10 @@ public class IntProviderIngredientTest { /** * How many times to repeat the Batch and Parallel random roll tests to avoid false positives * Currently set to 7, with singleblock recipes processing up to 9 items, allowing for stacks of up to 63 items. - * Entire test repeated 10 times for multiblocks + * Set 20 times for Batch/Parallel multis */ private static final int REPLICAS = 7; - private static final int MULTI_REPLICAS = 10; + private static final int MULTI_REPLICAS = 20; @BeforeBatch(batch = "RangedIngredients") public static void prepare(ServerLevel level) { @@ -603,9 +603,9 @@ public static void multiblockLCentRangedItemInput16Parallel(GameTestHelper helpe // 1t to turn on, 1t per recipe run, 4t buffer for sanity // 16 parallels // check the results of all rolls together - // repeat recipe REPLICAS times - int[] rolls = new int[REPLICAS]; - for (int i = 1; i <= REPLICAS; i++) { + // repeat recipe MULTI_REPLICAS times + int[] rolls = new int[MULTI_REPLICAS]; + for (int i = 1; i <= MULTI_REPLICAS; i++) { final int finalI = i; // lambda preserve you helper.runAfterDelay(21 * finalI, () -> { ItemStack results = itemIn.getStackInSlot(0); @@ -632,10 +632,10 @@ public static void multiblockLCentRangedItemInput16Parallel(GameTestHelper helpe }); } - helper.runAfterDelay(1 + 21 * REPLICAS, () -> { + helper.runAfterDelay(1 + 21 * MULTI_REPLICAS, () -> { // check if each roll was a multiple of run count boolean sus = false; - for (int i = 0; i < REPLICAS; i++) { + for (int i = 0; i < MULTI_REPLICAS; i++) { if (TestUtils.isStackSizeExactlyEvenMultiple(rolls[i], batches, parallels, 1)) { sus = true; GTCEu.LOGGER.warn("Parallel LCent ranged item input test iteration " + i + " consumed [" + @@ -673,9 +673,9 @@ public static void multiblockLCentRangedItemOutput16Parallel(GameTestHelper help // 1t to turn on, 1t per recipe run, 4t buffer for sanity // 16 parallels // check the results of all rolls together - // repeat recipe REPLICAS times - int[] addedRolls = new int[REPLICAS]; - for (int i = 1; i <= REPLICAS; i++) { + // repeat recipe MULTI_REPLICAS times + int[] addedRolls = new int[MULTI_REPLICAS]; + for (int i = 1; i <= MULTI_REPLICAS; i++) { final int finalI = i; // lambda preserve you helper.runAfterDelay(21 * finalI, () -> { int runs = finalI * batches * parallels; @@ -698,10 +698,10 @@ public static void multiblockLCentRangedItemOutput16Parallel(GameTestHelper help }); } - helper.runAfterDelay(1 + 21 * REPLICAS, () -> { + helper.runAfterDelay(1 + 21 * MULTI_REPLICAS, () -> { // check if each roll was a multiple of run count boolean sus = false; - int[] rolls = new int[REPLICAS]; + int[] rolls = new int[MULTI_REPLICAS]; rolls[0] = addedRolls[0]; if (TestUtils.isStackSizeExactlyEvenMultiple(rolls[0], batches, parallels, 1)) { @@ -710,7 +710,7 @@ public static void multiblockLCentRangedItemOutput16Parallel(GameTestHelper help rolls[0] + "] items, a multiple of its Batch * Parallel count (" + (batches * parallels) + "). If this message only appears once, this is likely a false positive."); } - for (int i = 1; i < REPLICAS; i++) { + for (int i = 1; i < MULTI_REPLICAS; i++) { rolls[i] = addedRolls[i] - addedRolls[i - 1]; if (TestUtils.isStackSizeExactlyEvenMultiple(rolls[i], batches, parallels, 1)) { sus = true; @@ -750,9 +750,9 @@ public static void multiblockLCentRangedItemInputBatched(GameTestHelper helper) // 1t to turn on, 1t per recipe run, 4t buffer for sanity // 16 batches // check the results of all rolls together - // repeat recipe REPLICAS times - int[] rolls = new int[REPLICAS]; - for (int i = 1; i <= REPLICAS; i++) { + // repeat recipe MULTI_REPLICAS times + int[] rolls = new int[MULTI_REPLICAS]; + for (int i = 1; i <= MULTI_REPLICAS; i++) { final int finalI = i; // lambda preserve you helper.runAfterDelay(21 * finalI, () -> { ItemStack results = itemIn.getStackInSlot(0); @@ -779,10 +779,10 @@ public static void multiblockLCentRangedItemInputBatched(GameTestHelper helper) }); } - helper.runAfterDelay(1 + 21 * REPLICAS, () -> { + helper.runAfterDelay(1 + 21 * MULTI_REPLICAS, () -> { // check if each roll was a multiple of run count boolean sus = false; - for (int i = 0; i < REPLICAS; i++) { + for (int i = 0; i < MULTI_REPLICAS; i++) { if (TestUtils.isStackSizeExactlyEvenMultiple(rolls[i], batches, parallels, 1)) { sus = true; GTCEu.LOGGER.warn("Parallel LCent ranged item input test iteration " + i + " consumed [" + @@ -820,9 +820,9 @@ public static void multiblockLCentRangedItemOutputBatched(GameTestHelper helper) // 1t to turn on, 1t per recipe run, 4t buffer for sanity // 16 parallels // check the results of all rolls together - // repeat recipe REPLICAS times - int[] addedRolls = new int[REPLICAS]; - for (int i = 1; i <= REPLICAS; i++) { + // repeat recipe MULTI_REPLICAS times + int[] addedRolls = new int[MULTI_REPLICAS]; + for (int i = 1; i <= MULTI_REPLICAS; i++) { final int finalI = i; // lambda preserve you helper.runAfterDelay(21 * finalI, () -> { int runs = finalI * batches * parallels; @@ -845,10 +845,10 @@ public static void multiblockLCentRangedItemOutputBatched(GameTestHelper helper) }); } - helper.runAfterDelay(1 + 21 * REPLICAS, () -> { + helper.runAfterDelay(1 + 21 * MULTI_REPLICAS, () -> { // check if each roll was a multiple of run count boolean sus = false; - int[] rolls = new int[REPLICAS]; + int[] rolls = new int[MULTI_REPLICAS]; rolls[0] = addedRolls[0]; if (TestUtils.isStackSizeExactlyEvenMultiple(rolls[0], batches, parallels, 1)) { @@ -857,7 +857,7 @@ public static void multiblockLCentRangedItemOutputBatched(GameTestHelper helper) rolls[0] + "] items, a multiple of its Batch * Parallel count (" + batches + "). If this message only appears once, this is likely a false positive."); } - for (int i = 1; i < REPLICAS; i++) { + for (int i = 1; i < MULTI_REPLICAS; i++) { rolls[i] = addedRolls[i] - addedRolls[i - 1]; if (TestUtils.isStackSizeExactlyEvenMultiple(rolls[i], batches, parallels, 1)) { sus = true; @@ -904,9 +904,9 @@ public static void multiblockLCentRangedItemInput16ParallelBatched(GameTestHelpe // 1t to turn on, 64t per recipe run, 10t buffer for sanity // 16 parallels // check the results of all rolls together - // repeat recipe REPLICAS times - int[] rolls = new int[REPLICAS]; - for (int i = 1; i <= REPLICAS; i++) { + // repeat recipe MULTI_REPLICAS times + int[] rolls = new int[MULTI_REPLICAS]; + for (int i = 1; i <= MULTI_REPLICAS; i++) { final int finalI = i; // lambda preserve you helper.runAfterDelay(75 * finalI, () -> { ItemStack results = itemIn.getStackInSlot(0); @@ -938,10 +938,10 @@ public static void multiblockLCentRangedItemInput16ParallelBatched(GameTestHelpe }); } - helper.runAfterDelay(1 + 75 * REPLICAS, () -> { + helper.runAfterDelay(1 + 75 * MULTI_REPLICAS, () -> { // check if each roll was a multiple of run count boolean sus = false; - for (int i = 0; i < REPLICAS; i++) { + for (int i = 0; i < MULTI_REPLICAS; i++) { if (TestUtils.isStackSizeExactlyEvenMultiple(rolls[i], batches, parallels, 1)) { sus = true; GTCEu.LOGGER.warn("Batched Parallel LCent ranged item input test iteration " + i + " consumed [" + @@ -981,9 +981,9 @@ public static void multiblockLCentRangedItemOutput16ParallelBatched(GameTestHelp // 1t to turn on, 64t per recipe run, 10t buffer for sanity // 16 parallels // check the results of all rolls together - // repeat recipe REPLICAS times - int[] addedRolls = new int[REPLICAS]; - for (int i = 1; i <= REPLICAS; i++) { + // repeat recipe MULTI_REPLICAS times + int[] addedRolls = new int[MULTI_REPLICAS]; + for (int i = 1; i <= MULTI_REPLICAS; i++) { final int finalI = i; // lambda preserve you helper.runAfterDelay(75 * finalI, () -> { int runs = finalI * batches * parallels; @@ -993,8 +993,8 @@ public static void multiblockLCentRangedItemOutput16ParallelBatched(GameTestHelp busHolder.controller.recipeLogic.getStatus() + "\nFailed recipes follow:\n" + TestUtils.getFailures(busHolder.controller.recipeLogic)); int resultCount = (int) Math.round(itemOut.getTotalContentAmount()); - int lowerLimit = runs * 0; - int upperLimit = runs * 4; + int lowerLimit = batches * parallels * 0; + int upperLimit = batches * parallels * 4; helper.assertTrue(TestUtils.isCountWithinRange(resultCount, lowerLimit, upperLimit), "Batched Parallel LCent didn't produce correct number of items, produced [" + resultCount + "] not [" + lowerLimit + "-" + upperLimit + "]"); @@ -1005,13 +1005,17 @@ public static void multiblockLCentRangedItemOutput16ParallelBatched(GameTestHelp for (int j = 0; j < batches; j++) { itemIn.setStackInSlot(j, LCENT_OUT.copyWithCount(16)); } + // Don't overflow the output bus + for (int j = 0; j < itemOut.getSize(); j++){ + itemOut.setStackInSlot(j, ItemStack.EMPTY); + } }); } - helper.runAfterDelay(1 + 75 * REPLICAS, () -> { + helper.runAfterDelay(1 + 75 * MULTI_REPLICAS, () -> { // check if each roll was a multiple of run count boolean sus = false; - int[] rolls = new int[REPLICAS]; + int[] rolls = new int[MULTI_REPLICAS]; rolls[0] = addedRolls[0]; if (TestUtils.isStackSizeExactlyEvenMultiple(rolls[0], batches, parallels, 1)) { @@ -1020,7 +1024,7 @@ public static void multiblockLCentRangedItemOutput16ParallelBatched(GameTestHelp rolls[0] + "] items, a multiple of its Batch * Parallel count (" + (batches * parallels) + "). If this message only appears once, this is likely a false positive."); } - for (int i = 1; i < REPLICAS; i++) { + for (int i = 1; i < MULTI_REPLICAS; i++) { rolls[i] = addedRolls[i] - addedRolls[i - 1]; if (TestUtils.isStackSizeExactlyEvenMultiple(rolls[i], batches, parallels, 1)) { sus = true; From 10589478485f92f145b71e950fe809835439cf59 Mon Sep 17 00:00:00 2001 From: DilithiumThoride Date: Sat, 30 May 2026 11:28:02 -0500 Subject: [PATCH 6/6] spotless UNapply --- .../IntProviderFluidIngredientTest.java | 30 +++++++------ .../ingredient/IntProviderIngredientTest.java | 42 +++++++++---------- 2 files changed, 35 insertions(+), 37 deletions(-) diff --git a/src/test/java/com/gregtechceu/gtceu/api/recipe/ingredient/IntProviderFluidIngredientTest.java b/src/test/java/com/gregtechceu/gtceu/api/recipe/ingredient/IntProviderFluidIngredientTest.java index a2028c5d569..9c5b273f09f 100644 --- a/src/test/java/com/gregtechceu/gtceu/api/recipe/ingredient/IntProviderFluidIngredientTest.java +++ b/src/test/java/com/gregtechceu/gtceu/api/recipe/ingredient/IntProviderFluidIngredientTest.java @@ -32,8 +32,6 @@ import net.minecraftforge.gametest.GameTestHolder; import net.minecraftforge.gametest.PrefixGameTestTemplate; -import lombok.Getter; - /** * Test cases: * Do many passes of most tests as a safeguard against bad rolls @@ -595,8 +593,8 @@ public static void multiblockLCRRangedFluidOutput(GameTestHelper helper) { // test for multiblock machine with 16x Parallels with ranged fluid input @GameTest(template = "large_centrifuge_zpm_batch_parallel16", - batch = "RangedFluidIngredients", - timeoutTicks = 2000) + batch = "RangedFluidIngredients", + timeoutTicks = 2000) public static void multiblockLCentRangedFluidInput16Parallel(GameTestHelper helper) { BusHolderBatchParallel busHolder = getBussesAndFormLCENT(helper); @@ -627,7 +625,7 @@ public static void multiblockLCentRangedFluidInput16Parallel(GameTestHelper help int completed = batches * parallels * finalI; helper.assertTrue( TestUtils.isFluidStackEqual(new FluidStack(fluidOut.getFluidInTank(0), - ((int) Math.round(fluidOut.getTotalContentAmount()))), + ((int) Math.round(fluidOut.getTotalContentAmount()))), new FluidStack(REDSTONE, completed)), "Parallel LCent didn't complete correct number of recipes, completed [" + ((int) Math.round(fluidOut.getTotalContentAmount())) + "] not [" + completed + @@ -668,8 +666,8 @@ public static void multiblockLCentRangedFluidInput16Parallel(GameTestHelper help // test for multiblock machine with 16x Parallels with ranged fluid output @GameTest(template = "large_centrifuge_zpm_batch_parallel16", - batch = "RangedFluidIngredients", - timeoutTicks = 2000) + batch = "RangedFluidIngredients", + timeoutTicks = 2000) public static void multiblockLCentRangedFluidOutput16Parallel(GameTestHelper helper) { BusHolderBatchParallel busHolder = getBussesAndFormLCENT(helper); @@ -744,8 +742,8 @@ public static void multiblockLCentRangedFluidOutput16Parallel(GameTestHelper hel // test for multiblock machine with 16x Parallels with ranged fluid input @GameTest(template = "large_centrifuge_zpm_batch_parallel16", - batch = "RangedFluidIngredients", - timeoutTicks = 2000) + batch = "RangedFluidIngredients", + timeoutTicks = 2000) public static void multiblockLCentRangedFluidInputBatched(GameTestHelper helper) { BusHolderBatchParallel busHolder = getBussesAndFormLCENT(helper); @@ -776,7 +774,7 @@ public static void multiblockLCentRangedFluidInputBatched(GameTestHelper helper) int completed = batches * parallels * finalI; helper.assertTrue( TestUtils.isFluidStackEqual(new FluidStack(fluidOut.getFluidInTank(0), - ((int) Math.round(fluidOut.getTotalContentAmount()))), + ((int) Math.round(fluidOut.getTotalContentAmount()))), new FluidStack(REDSTONE, completed)), "Batched LCent didn't complete correct number of recipes, completed [" + ((int) Math.round(fluidOut.getTotalContentAmount())) + "] not [" + completed + @@ -817,8 +815,8 @@ public static void multiblockLCentRangedFluidInputBatched(GameTestHelper helper) // test for multiblock machine with 16x Parallels with ranged fluid output @GameTest(template = "large_centrifuge_zpm_batch_parallel16", - batch = "RangedFluidIngredients", - timeoutTicks = 2000) + batch = "RangedFluidIngredients", + timeoutTicks = 2000) public static void multiblockLCentRangedFluidOutputBatched(GameTestHelper helper) { BusHolderBatchParallel busHolder = getBussesAndFormLCENT(helper); @@ -893,8 +891,8 @@ public static void multiblockLCentRangedFluidOutputBatched(GameTestHelper helper // test for multiblock machine with 16x Parallels with ranged fluid input @GameTest(template = "large_centrifuge_zpm_batch_parallel16", - batch = "RangedFluidIngredients", - timeoutTicks = 2000) + batch = "RangedFluidIngredients", + timeoutTicks = 2000) public static void multiblockLCentRangedFluidInput16ParallelBatched(GameTestHelper helper) { BusHolderBatchParallel busHolder = getBussesAndFormLCENT(helper); @@ -972,8 +970,8 @@ public static void multiblockLCentRangedFluidInput16ParallelBatched(GameTestHelp // test for multiblock machine with 16x Parallels with ranged fluid output @GameTest(template = "large_centrifuge_zpm_batch_parallel16", - batch = "RangedFluidIngredients", - timeoutTicks = 2000) + batch = "RangedFluidIngredients", + timeoutTicks = 2000) public static void multiblockLCentRangedFluidOutput16ParallelBatched(GameTestHelper helper) { BusHolderBatchParallel busHolder = getBussesAndFormLCENT(helper); diff --git a/src/test/java/com/gregtechceu/gtceu/api/recipe/ingredient/IntProviderIngredientTest.java b/src/test/java/com/gregtechceu/gtceu/api/recipe/ingredient/IntProviderIngredientTest.java index a54ca77ba1c..83cff670fa8 100644 --- a/src/test/java/com/gregtechceu/gtceu/api/recipe/ingredient/IntProviderIngredientTest.java +++ b/src/test/java/com/gregtechceu/gtceu/api/recipe/ingredient/IntProviderIngredientTest.java @@ -28,8 +28,6 @@ import net.minecraftforge.gametest.GameTestHolder; import net.minecraftforge.gametest.PrefixGameTestTemplate; -import lombok.Getter; - /** * Test cases: * do many passes of most tests as a safeguard against bad rolls @@ -584,8 +582,8 @@ public static void multiblockLCRRangedItemOutput(GameTestHelper helper) { // test for multiblock machine with 16x Parallels with ranged item input @GameTest(template = "large_centrifuge_zpm_batch_parallel16", - batch = "RangedIngredients", - timeoutTicks = 2000) + batch = "RangedIngredients", + timeoutTicks = 2000) public static void multiblockLCentRangedItemInput16Parallel(GameTestHelper helper) { BusHolderBatchParallel busHolder = getBussesAndFormLCENT(helper); @@ -614,7 +612,7 @@ public static void multiblockLCentRangedItemInput16Parallel(GameTestHelper helpe int completed = batches * parallels * finalI; helper.assertTrue( TestUtils.isItemStackEqual(itemOut.getStackInSlot(0) - .copyWithCount((int) Math.round(itemOut.getTotalContentAmount())), + .copyWithCount((int) Math.round(itemOut.getTotalContentAmount())), STONE.copyWithCount(completed)), "Parallel LCent didn't complete correct number of recipes, completed [" + ((int) Math.round(itemOut.getTotalContentAmount())) + "] not [" + completed + @@ -655,8 +653,8 @@ public static void multiblockLCentRangedItemInput16Parallel(GameTestHelper helpe // test for multiblock machine with 16x Parallels with ranged item output @GameTest(template = "large_centrifuge_zpm_batch_parallel16", - batch = "RangedIngredients", - timeoutTicks = 2000) + batch = "RangedIngredients", + timeoutTicks = 2000) public static void multiblockLCentRangedItemOutput16Parallel(GameTestHelper helper) { BusHolderBatchParallel busHolder = getBussesAndFormLCENT(helper); @@ -681,7 +679,8 @@ public static void multiblockLCentRangedItemOutput16Parallel(GameTestHelper help int runs = finalI * batches * parallels; helper.assertTrue(itemIn.getStackInSlot(0).isEmpty(), "Parallel LCent didn't complete correct number of recipes, completed [" + - (int) Math.round(itemIn.getTotalContentAmount()) + "] not [" + runs + "]\n Current machine state: " + + (int) Math.round(itemIn.getTotalContentAmount()) + "] not [" + runs + + "]\n Current machine state: " + busHolder.controller.recipeLogic.getStatus() + "\nFailed recipes follow:\n" + TestUtils.getFailures(busHolder.controller.recipeLogic)); int resultCount = (int) Math.round(itemOut.getTotalContentAmount()); @@ -731,8 +730,8 @@ public static void multiblockLCentRangedItemOutput16Parallel(GameTestHelper help // test for multiblock machine with 16x Parallels with ranged item input @GameTest(template = "large_centrifuge_zpm_batch_parallel16", - batch = "RangedIngredients", - timeoutTicks = 2000) + batch = "RangedIngredients", + timeoutTicks = 2000) public static void multiblockLCentRangedItemInputBatched(GameTestHelper helper) { BusHolderBatchParallel busHolder = getBussesAndFormLCENT(helper); @@ -761,7 +760,7 @@ public static void multiblockLCentRangedItemInputBatched(GameTestHelper helper) int completed = batches * parallels * finalI; helper.assertTrue( TestUtils.isItemStackEqual(itemOut.getStackInSlot(0) - .copyWithCount((int) Math.round(itemOut.getTotalContentAmount())), + .copyWithCount((int) Math.round(itemOut.getTotalContentAmount())), STONE.copyWithCount(completed)), "Parallel LCent didn't complete correct number of recipes, completed [" + ((int) Math.round(itemOut.getTotalContentAmount())) + "] not [" + completed + @@ -802,8 +801,8 @@ public static void multiblockLCentRangedItemInputBatched(GameTestHelper helper) // test for multiblock machine with 16x Parallels with ranged item output @GameTest(template = "large_centrifuge_zpm_batch_parallel16", - batch = "RangedIngredients", - timeoutTicks = 2000) + batch = "RangedIngredients", + timeoutTicks = 2000) public static void multiblockLCentRangedItemOutputBatched(GameTestHelper helper) { BusHolderBatchParallel busHolder = getBussesAndFormLCENT(helper); @@ -878,8 +877,8 @@ public static void multiblockLCentRangedItemOutputBatched(GameTestHelper helper) // test for multiblock machine with 16x Parallels with ranged item input @GameTest(template = "large_centrifuge_zpm_batch_parallel16", - batch = "RangedIngredients", - timeoutTicks = 2000) + batch = "RangedIngredients", + timeoutTicks = 2000) public static void multiblockLCentRangedItemInput16ParallelBatched(GameTestHelper helper) { BusHolderBatchParallel busHolder = getBussesAndFormLCENT(helper); @@ -914,8 +913,8 @@ public static void multiblockLCentRangedItemInput16ParallelBatched(GameTestHelpe int lowerLimit = 64 - (batches * parallels * 4); int completed = batches * parallels * finalI; helper.assertTrue(TestUtils.isItemStackEqual(itemOut.getStackInSlot(0) - .copyWithCount((int) Math.round(itemOut.getTotalContentAmount())), - STONE.copyWithCount(completed)), + .copyWithCount((int) Math.round(itemOut.getTotalContentAmount())), + STONE.copyWithCount(completed)), "Batched Parallel LCent didn't complete correct number of recipes, completed [" + ((int) Math.round(itemOut.getTotalContentAmount())) + "] not [" + completed + "]\n Current machine state: " + busHolder.controller.recipeLogic.getStatus() + @@ -961,8 +960,8 @@ public static void multiblockLCentRangedItemInput16ParallelBatched(GameTestHelpe // test for multiblock machine with 16x Parallels with ranged item output @GameTest(template = "large_centrifuge_zpm_batch_parallel16", - batch = "RangedIngredients", - timeoutTicks = 2000) + batch = "RangedIngredients", + timeoutTicks = 2000) public static void multiblockLCentRangedItemOutput16ParallelBatched(GameTestHelper helper) { BusHolderBatchParallel busHolder = getBussesAndFormLCENT(helper); @@ -989,7 +988,8 @@ public static void multiblockLCentRangedItemOutput16ParallelBatched(GameTestHelp int runs = finalI * batches * parallels; helper.assertTrue(itemIn.isEmpty(), "Batched Parallel LCent didn't complete correct number of recipes, completed [" + - (runs - itemIn.getTotalContentAmount()) + "] not [" + runs + "]\nCurrent machine state: " + + (runs - itemIn.getTotalContentAmount()) + "] not [" + runs + + "]\nCurrent machine state: " + busHolder.controller.recipeLogic.getStatus() + "\nFailed recipes follow:\n" + TestUtils.getFailures(busHolder.controller.recipeLogic)); int resultCount = (int) Math.round(itemOut.getTotalContentAmount()); @@ -1006,7 +1006,7 @@ public static void multiblockLCentRangedItemOutput16ParallelBatched(GameTestHelp itemIn.setStackInSlot(j, LCENT_OUT.copyWithCount(16)); } // Don't overflow the output bus - for (int j = 0; j < itemOut.getSize(); j++){ + for (int j = 0; j < itemOut.getSize(); j++) { itemOut.setStackInSlot(j, ItemStack.EMPTY); } });