From 437a3acdcc472a609375f02b6f07e9a67a5d92eb Mon Sep 17 00:00:00 2001 From: Harrison Date: Tue, 28 Apr 2020 23:22:43 -0500 Subject: [PATCH] Added a more scattered test. This may be a more realistic representation. --- .../UniBiomeIslandGeneratorTest.java | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) 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 e142d67..7e3e7b7 100644 --- a/src/test/java/ca/recrown/islandsurvivalcraft/world/generation/UniBiomeIslandGeneratorTest.java +++ b/src/test/java/ca/recrown/islandsurvivalcraft/world/generation/UniBiomeIslandGeneratorTest.java @@ -106,4 +106,30 @@ public class UniBiomeIslandGeneratorTest { assertFalse(false, e.getCause().getMessage()); } } + + @Test + public void testBiomeGenerationMultithread1608ChunksScattered() { + int chunksToDoEach = 268; + 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); + ex.execute(g1); + ex.execute(g2); + ex.execute(g3); + ex.execute(g4); + ex.execute(g5); + ex.execute(g6); + + try { + ex.shutdown(); + assertTrue(ex.awaitTermination(1, TimeUnit.MINUTES), "timed out."); + } catch (InterruptedException e) { + assertFalse(false); + } + } } \ No newline at end of file