diff --git a/src/test/java/ca/recrown/islandsurvivalcraft/world/generation/UniBiomeIslandGeneratorTest.java b/src/test/java/ca/recrown/islandsurvivalcraft/world/generation/UniBiomeIslandGeneratorTest.java index 496a29a..a3e167b 100644 --- a/src/test/java/ca/recrown/islandsurvivalcraft/world/generation/UniBiomeIslandGeneratorTest.java +++ b/src/test/java/ca/recrown/islandsurvivalcraft/world/generation/UniBiomeIslandGeneratorTest.java @@ -27,8 +27,8 @@ import ca.recrown.islandsurvivalcraft.world.IslandWorldMapper; public class UniBiomeIslandGeneratorTest { private final int SEED = 249398015; private final DummyWorld dummyWorld = new DummyWorld(); - private final Cache blockValueCache = new Cache<>(4096); - private final Cache biomeCache = new Cache<>(4096); + private final Cache blockValueCache = new Cache<>(524288); + private final Cache biomeCache = new Cache<>(524288); private final Cache chunkExistenceCache = new Cache<>(16384); private class BiomeGenTask implements Runnable { @@ -136,4 +136,34 @@ public class UniBiomeIslandGeneratorTest { } } } + + @Test + @Timeout(value = 1, unit = TimeUnit.MINUTES) + public void testBiomeGenerationMultithread6000ChunksScatteredColumns() { + int chunksToDoEach = 1000; + Runnable g1 = new BiomeGenTask(chunksToDoEach, 0); + Runnable g2 = new BiomeGenTask(chunksToDoEach, 2); + Runnable g3 = new BiomeGenTask(chunksToDoEach, 4); + Runnable g4 = new BiomeGenTask(chunksToDoEach, 6); + Runnable g5 = new BiomeGenTask(chunksToDoEach, 8); + Runnable g6 = new BiomeGenTask(chunksToDoEach, 10); + + ExecutorService ex = Executors.newFixedThreadPool(6); + LinkedList> tasks = new LinkedList<>(); + tasks.add(ex.submit(g1)); + tasks.add(ex.submit(g2)); + tasks.add(ex.submit(g3)); + tasks.add(ex.submit(g4)); + tasks.add(ex.submit(g5)); + tasks.add(ex.submit(g6)); + + while (!tasks.isEmpty()) { + try { + tasks.pop().get(); + } catch (InterruptedException | ExecutionException e) { + e.printStackTrace(); + assertFalse(false, e.getCause().getMessage()); + } + } + } } \ No newline at end of file