Skip to content

Commit d0235a5

Browse files
koebiTheGreatRefrigerator
authored andcommitted
add test for surface speed
1 parent cedfcea commit d0235a5

File tree

1 file changed

+19
-19
lines changed
  • openrouteservice-api-tests/src/test/java/org/heigit/ors/v2/services/routing

1 file changed

+19
-19
lines changed

Diff for: openrouteservice-api-tests/src/test/java/org/heigit/ors/v2/services/routing/ResultTest.java

+19-19
Original file line numberDiff line numberDiff line change
@@ -3770,14 +3770,14 @@ public void testUserRoadSpeed() {
37703770
public void testUserSurfaceSpeed() {
37713771
JSONObject body = new JSONObject();
37723772
JSONArray coords = new JSONArray();
3773-
JSONArray neuenheim = new JSONArray();
3774-
neuenheim.put(8.685036);
3775-
neuenheim.put(49.4201314);
3776-
JSONArray dossenheim = new JSONArray();
3777-
dossenheim.put(8.668814);
3778-
dossenheim.put(49.442794);
3779-
coords.put(neuenheim);
3780-
coords.put(dossenheim);
3773+
JSONArray south = new JSONArray();
3774+
south.put(8.707808);
3775+
south.put(49.398337);
3776+
JSONArray north = new JSONArray();
3777+
north.put(8.710012);
3778+
north.put(49.405015);
3779+
coords.put(south);
3780+
coords.put(north);
37813781
body.put("coordinates", coords);
37823782

37833783
// since we're testing on the same profile, "shortest" would not be dependent on speed settings
@@ -3788,39 +3788,39 @@ public void testUserSurfaceSpeed() {
37883788
given()
37893789
.header("Accept", "application/json")
37903790
.header("Content-Type", "application/json")
3791-
.pathParam("profile", getParameter("carProfile"))
3791+
.pathParam("profile", "cycling-mountain")
37923792
.body(body.toString())
37933793
.when().log().ifValidationFails()
37943794
.post(getEndPointPath() + "/{profile}")
37953795
.then().log().ifValidationFails()
37963796
.assertThat()
37973797
.body("any { it.key == 'routes' }", is(true))
3798-
.body("routes[0].summary.distance", is(4507.5f))
3799-
.body("routes[0].summary.duration", is(469.1f))
3798+
.body("routes[0].summary.distance", is(1532.1f))
3799+
.body("routes[0].summary.duration", is(349.7f))
38003800
.statusCode(200);
38013801

38023802
JSONObject userSpeedLimits = new JSONObject();
3803-
JSONObject roadSpeedLimits = new JSONObject();
3804-
roadSpeedLimits.put("primary", 30);
3805-
roadSpeedLimits.put("secondary", 30);
3806-
userSpeedLimits.put("roadSpeeds", roadSpeedLimits);
3803+
JSONObject surfaceSpeedLimits = new JSONObject();
3804+
surfaceSpeedLimits.put("gravel", 2);
3805+
surfaceSpeedLimits.put("ground", 2);
3806+
surfaceSpeedLimits.put("compacted", 2);
3807+
userSpeedLimits.put("surfaceSpeeds", surfaceSpeedLimits);
38073808
body.put("user_speed_limits", userSpeedLimits);
38083809

38093810
// request route limiting speed on primary and secondary roads to 30
38103811
given()
38113812
.header("Accept", "application/json")
38123813
.header("Content-Type", "application/json")
3813-
.pathParam("profile", getParameter("carProfile"))
3814+
.pathParam("profile", "cycling-mountain")
38143815
.body(body.toString())
38153816
.when().log().ifValidationFails()
38163817
.post(getEndPointPath() + "/{profile}")
38173818
.then().log().ifValidationFails()
38183819
.assertThat()
38193820
.body("any { it.key == 'routes' }", is(true))
3820-
.body("routes[0].summary.distance", is(3811.0f))
3821-
.body("routes[0].summary.duration", is(554.3f))
3821+
.body("routes[0].summary.distance", is(2485.8f))
3822+
.body("routes[0].summary.duration", is(497.1f))
38223823
.statusCode(200);
3823-
38243824
}
38253825

38263826
@Test

0 commit comments

Comments
 (0)