mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2026-11-28 16:54:04 +00:00
Fingerprint skips scheduling knobs
- prefetchRings and persist leave the hydrology settings fingerprint, since they only choose which windows are prepared ahead and whether plans are saved - Compile checks drainage.fillEpsilon as the compiled float, rejecting values that round to 0 or overflow to infinity - DEFAULT_FINGERPRINT recaptured
This commit is contained in:
1 parent
ca431452fe
commit
408ac5e6b0
2 files changed
+30
-6
No files matched your search
+26
-1
@@ -22,6 +22,7 @@ import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertNotSame;
|
||||
import static org.junit.Assert.assertNull;
|
||||
import static org.junit.Assert.assertThrows;
|
||||
@@ -32,7 +33,7 @@ public class HydrologySettingsTest {
|
||||
private static final int SEA_LEVEL = 62;
|
||||
private static final int MIN_Y = -64;
|
||||
private static final int MAX_Y = 320;
|
||||
private static final long DEFAULT_FINGERPRINT = 8818472145657699942L;
|
||||
private static final long DEFAULT_FINGERPRINT = 4166234412166664615L;
|
||||
|
||||
@Test
|
||||
public void densityIsBoundedAndChangesThePlanIdentity() {
|
||||
@@ -245,6 +246,18 @@ public class HydrologySettingsTest {
|
||||
assertEquals("fingerprint must be identical in every JVM run", DEFAULT_FINGERPRINT, first);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void schedulingKnobsDoNotChangeTheFingerprint() {
|
||||
HydrologySettings eager = compile(new IrisHydrology().setPrefetchRings(4));
|
||||
HydrologySettings inMemory = compile(new IrisHydrology().setPersist(false));
|
||||
HydrologySettings both = compile(new IrisHydrology().setPrefetchRings(0).setPersist(false));
|
||||
assertEquals(4, eager.prefetchRings());
|
||||
assertFalse(inMemory.persist());
|
||||
assertEquals(DEFAULT_FINGERPRINT, eager.fingerprint());
|
||||
assertEquals(DEFAULT_FINGERPRINT, inMemory.fingerprint());
|
||||
assertEquals(DEFAULT_FINGERPRINT, both.fingerprint());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void compileRejectsUnknownFluidProfile() {
|
||||
IrisHydrology config = new IrisHydrology();
|
||||
@@ -337,6 +350,18 @@ public class HydrologySettingsTest {
|
||||
assertEquals(64f, compile(densest).ponds().seeded().density(), 0f);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void compileRejectsAFillEpsilonThatIsNotPositiveAsAFloat() {
|
||||
for (double invalid : new double[]{0D, -0.001D, 1e-50D, Double.MIN_VALUE, 1e300D, Double.NaN, Double.POSITIVE_INFINITY}) {
|
||||
IrisHydrology config = new IrisHydrology();
|
||||
config.getDrainage().setFillEpsilon(invalid);
|
||||
assertRejected(config, "drainage.fillEpsilon must be a finite value above 0");
|
||||
}
|
||||
IrisHydrology finest = new IrisHydrology();
|
||||
finest.getDrainage().setFillEpsilon(0.00001D);
|
||||
assertEquals(0.00001f, compile(finest).drainage().fillEpsilon(), 0f);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void compileRejectsCavePoolsThatReachPastTheNeighbouringChunks() {
|
||||
IrisHydrology wide = new IrisHydrology();
|
||||
|
||||
Reference in new issue
Block a user