31 lines
1.2 KiB
Java
31 lines
1.2 KiB
Java
package com.example.duneterrain;
|
|
|
|
import static org.junit.jupiter.api.Assertions.*;
|
|
|
|
import org.junit.jupiter.api.Test;
|
|
|
|
class OrdosSulfurRangeTest {
|
|
@Test void sulfurStopsAtTheMushroomFieldsEdge() {
|
|
assertTrue(OrdosSulfurRange.near(0));
|
|
assertTrue(OrdosSulfurRange.near(144.99));
|
|
assertFalse(OrdosSulfurRange.near(145));
|
|
assertFalse(OrdosSulfurRange.near(Double.POSITIVE_INFINITY));
|
|
}
|
|
|
|
@Test void realIslandGeometryAndOriginalVerticalLimitsBothConstrainSulfur() {
|
|
for (long seed = 0; seed < 2048; seed++) {
|
|
for (int x = 384; x <= 640; x += 32) {
|
|
for (int z = 384; z <= 640; z += 32) {
|
|
double distance = TemperateLandscape.islandDistance(seed, x, z);
|
|
boolean pocket = TemperateLandscape.sulfurPocket(seed, x, 0, z);
|
|
if (distance >= 145) assertFalse(pocket);
|
|
if (!pocket) continue;
|
|
assertFalse(TemperateLandscape.sulfurPocket(seed, x, -45, z));
|
|
assertFalse(TemperateLandscape.sulfurPocket(seed, x, 35, z));
|
|
return;
|
|
}
|
|
}
|
|
}
|
|
fail("Expected a sulfur pocket close to a real mushroom island");
|
|
}
|
|
}
|

Staff