Tested biome selector.

Also deleted launch.json.
This commit is contained in:
Harrison Deng 2020-04-20 19:12:47 -05:00
parent 623ee1a544
commit c860ba1a15
2 changed files with 89 additions and 15 deletions

15
.vscode/launch.json vendored
View File

@ -1,15 +0,0 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "java",
"name": "debug",
"hostName": "localhost",
"port": 4711,
"request": "attach",
}
]
}

View File

@ -0,0 +1,89 @@
package ca.recrown.islandsurvivalcraft.worldgeneration;
import static org.junit.jupiter.api.Assertions.assertEquals;
import java.util.Random;
import org.bukkit.block.Biome;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.TestInstance;
import org.junit.jupiter.api.TestInstance.Lifecycle;
@TestInstance(Lifecycle.PER_CLASS)
public class BiomeSelectorTest {
BiomeSelector biomeSelector;
@BeforeAll
public void setUp() {
biomeSelector = new BiomeSelector(new Random());
biomeSelector.initialize();
}
@Test
public void testGetBiomeTemperatureBirchHill() {
assertEquals(0.6f, biomeSelector.getBiomeTemperature(Biome.BIRCH_FOREST_HILLS));
}
@Test
public void testGetBiomeTemperatureSwampHill() {
assertEquals(0.8f, biomeSelector.getBiomeTemperature(Biome.SWAMP_HILLS));
}
@Test
public void testGetBiomeTemperatureTaigaHill() {
assertEquals(0.25f, biomeSelector.getBiomeTemperature(Biome.TAIGA_HILLS));
}
@Test
public void testGetBiomeTemperatureSnowyTaigaHill() {
assertEquals(-0.5f, biomeSelector.getBiomeTemperature(Biome.SNOWY_TAIGA_HILLS));
}
@Test
public void testGetBiomeTemperatureSnowyTaigaMountain() {
assertEquals(-0.5f, biomeSelector.getBiomeTemperature(Biome.SNOWY_TAIGA_MOUNTAINS));
}
@Test
public void testGetTransitionalBiomeFromModifiedJungle() {
assertEquals(Biome.MODIFIED_JUNGLE_EDGE, biomeSelector.getTransitionalBiome(Biome.MODIFIED_JUNGLE));
}
@Test
public void testGetTransitionalBiomeFromOcean() {
assertEquals(null, biomeSelector.getTransitionalBiome(Biome.OCEAN));
}
@Test
public void testGetTransitionalBiomeFromMountain() {
assertEquals(null, biomeSelector.getTransitionalBiome(Biome.MOUNTAINS));
}
@Test
public void testGetTransitionalBiomeFromJungle() {
assertEquals(Biome.JUNGLE_EDGE, biomeSelector.getTransitionalBiome(Biome.JUNGLE));
}
@Test
public void testGetShoreBiomeFromMountain() {
assertEquals(Biome.STONE_SHORE, biomeSelector.getShoreBiome(Biome.MOUNTAINS, 0.2f));
}
@Test
public void testGetShoreBiomeFromMushroomIsland() {
assertEquals(Biome.MUSHROOM_FIELD_SHORE, biomeSelector.getShoreBiome(Biome.MUSHROOM_FIELDS, 1.2f));
}
@Test
public void testGetShoreBiomeFromPlains() {
assertEquals(Biome.BEACH, biomeSelector.getShoreBiome(Biome.PLAINS, 0.8f));
}
@Test
public void testGetShoreBiomeFromSnowyTaiga() {
assertEquals(Biome.SNOWY_BEACH, biomeSelector.getShoreBiome(Biome.SNOWY_TAIGA, -0.5f));
}
}