Skip to content

Commit

Permalink
Adapt tests
Browse files Browse the repository at this point in the history
  • Loading branch information
otbutz committed Apr 25, 2024
1 parent fda5a6d commit 7162e49
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down Expand Up @@ -216,4 +216,4 @@ public void minStorableBug() {
enc.setDecimal(true, edgeId, edgeIntAccess, 1.6);
assertEquals(1.6, enc.getDecimal(true, edgeId, edgeIntAccess));
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -65,4 +66,4 @@ public void testNoLimit() {
parser.handleWayTags(edgeId, edgeIntAccess, readerWay, relFlags);
assertEquals(Double.POSITIVE_INFINITY, malEnc.getDecimal(false, edgeId, edgeIntAccess), .01);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -62,4 +63,4 @@ public void testConditionalTags() {
parser.handleWayTags(edgeId, edgeIntAccess, readerWay, relFlags);
assertEquals(6, mwEnc.getDecimal(false, edgeId, edgeIntAccess), .01);
}
}
}

0 comments on commit 7162e49

Please sign in to comment.