From 7162e4987b60b5c903982359c86628fb3b6b2d5c Mon Sep 17 00:00:00 2001 From: Thomas Butz Date: Thu, 25 Apr 2024 18:17:55 +0200 Subject: [PATCH] Adapt tests --- .../routing/ev/DecimalEncodedValueImplTest.java | 4 ++-- .../routing/util/parsers/OSMMaxAxleLoadParserTest.java | 7 ++++--- .../routing/util/parsers/OSMMaxWeightParserTest.java | 9 +++++---- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/core/src/test/java/com/graphhopper/routing/ev/DecimalEncodedValueImplTest.java b/core/src/test/java/com/graphhopper/routing/ev/DecimalEncodedValueImplTest.java index 3fdb38cf5aa..06da6239b28 100644 --- a/core/src/test/java/com/graphhopper/routing/ev/DecimalEncodedValueImplTest.java +++ b/core/src/test/java/com/graphhopper/routing/ev/DecimalEncodedValueImplTest.java @@ -180,7 +180,7 @@ public void testNextStorableValue_maxInfinity() { EdgeIntAccess edgeIntAccess = new ArrayEdgeIntAccess(1); int edgeId = 0; enc.setDecimal(false, edgeId, edgeIntAccess, 45); - assertEquals(42, enc.getDecimal(false, edgeId, edgeIntAccess)); + assertEquals(Double.POSITIVE_INFINITY, enc.getDecimal(false, edgeId, edgeIntAccess)); enc.setDecimal(false, edgeId, edgeIntAccess, Double.POSITIVE_INFINITY); assertEquals(Double.POSITIVE_INFINITY, enc.getDecimal(false, edgeId, edgeIntAccess)); @@ -216,4 +216,4 @@ public void minStorableBug() { enc.setDecimal(true, edgeId, edgeIntAccess, 1.6); assertEquals(1.6, enc.getDecimal(true, edgeId, edgeIntAccess)); } -} \ No newline at end of file +} diff --git a/core/src/test/java/com/graphhopper/routing/util/parsers/OSMMaxAxleLoadParserTest.java b/core/src/test/java/com/graphhopper/routing/util/parsers/OSMMaxAxleLoadParserTest.java index 135d669403d..3822d82a1f6 100644 --- a/core/src/test/java/com/graphhopper/routing/util/parsers/OSMMaxAxleLoadParserTest.java +++ b/core/src/test/java/com/graphhopper/routing/util/parsers/OSMMaxAxleLoadParserTest.java @@ -30,11 +30,12 @@ public void testSimpleTags() { parser.handleWayTags(edgeId, edgeIntAccess, readerWay, relFlags); assertEquals(11.5, malEnc.getDecimal(false, edgeId, edgeIntAccess), .01); - // if value is beyond the maximum then do not use infinity instead fallback to more restrictive maximum + // if value is beyond the maximum then do use infinity edgeIntAccess = new ArrayEdgeIntAccess(1); readerWay.setTag("maxaxleload", "80"); parser.handleWayTags(edgeId, edgeIntAccess, readerWay, relFlags); - assertEquals(63.0, malEnc.getDecimal(false, edgeId, edgeIntAccess), .01); + assertEquals(Double.POSITIVE_INFINITY, malEnc.getNextStorableValue(80), .01); + assertEquals(Double.POSITIVE_INFINITY, malEnc.getDecimal(false, edgeId, edgeIntAccess), .01); } @Test @@ -65,4 +66,4 @@ public void testNoLimit() { parser.handleWayTags(edgeId, edgeIntAccess, readerWay, relFlags); assertEquals(Double.POSITIVE_INFINITY, malEnc.getDecimal(false, edgeId, edgeIntAccess), .01); } -} \ No newline at end of file +} diff --git a/core/src/test/java/com/graphhopper/routing/util/parsers/OSMMaxWeightParserTest.java b/core/src/test/java/com/graphhopper/routing/util/parsers/OSMMaxWeightParserTest.java index 5091cca6e87..5ac263de7ea 100644 --- a/core/src/test/java/com/graphhopper/routing/util/parsers/OSMMaxWeightParserTest.java +++ b/core/src/test/java/com/graphhopper/routing/util/parsers/OSMMaxWeightParserTest.java @@ -31,11 +31,12 @@ public void testSimpleTags() { parser.handleWayTags(edgeId, edgeIntAccess, readerWay, relFlags); assertEquals(5.0, mwEnc.getDecimal(false, edgeId, edgeIntAccess), .01); - // if value is beyond the maximum then do not use infinity instead fallback to more restrictive maximum + // if value is beyond the maximum then do use infinity edgeIntAccess = new ArrayEdgeIntAccess(1); - readerWay.setTag("maxweight", "50"); + readerWay.setTag("maxweight", "120"); parser.handleWayTags(edgeId, edgeIntAccess, readerWay, relFlags); - assertEquals(25.4, mwEnc.getDecimal(false, edgeId, edgeIntAccess), .01); + assertEquals(Double.POSITIVE_INFINITY, mwEnc.getNextStorableValue(120), .01); + assertEquals(Double.POSITIVE_INFINITY, mwEnc.getDecimal(false, edgeId, edgeIntAccess), .01); } @Test @@ -62,4 +63,4 @@ public void testConditionalTags() { parser.handleWayTags(edgeId, edgeIntAccess, readerWay, relFlags); assertEquals(6, mwEnc.getDecimal(false, edgeId, edgeIntAccess), .01); } -} \ No newline at end of file +}