Add support for non-round-trips with a single fixed endpoint (#6050)

Currently /trip supports finding round-trip routes where only the
start or end location is fixed. This PR extends this feature to
non-round-trip requests.

We do this by a new table manipulation that simulates non-round-trip
fixed endpoint requests as a round-trip request.
This commit is contained in:
Michael Bell
2022-08-22 12:56:47 +01:00
committed by GitHub
parent e3c7995b00
commit b4b1aea567
8 changed files with 188 additions and 94 deletions
+4 -4
View File
@@ -362,7 +362,7 @@ void test_tfse_illegal_parameters(bool use_json_only_api)
ResetParams(locations, params);
params.source = TripParameters::SourceType::First;
params.roundtrip = false;
CheckNotImplemented(osrm, params, use_json_only_api);
CheckOk(osrm, params, use_json_only_api);
ResetParams(locations, params);
params.destination = TripParameters::DestinationType::Any;
@@ -372,7 +372,7 @@ void test_tfse_illegal_parameters(bool use_json_only_api)
ResetParams(locations, params);
params.destination = TripParameters::DestinationType::Last;
params.roundtrip = false;
CheckNotImplemented(osrm, params, use_json_only_api);
CheckOk(osrm, params, use_json_only_api);
// three parameters set
params.source = TripParameters::SourceType::Any;
@@ -383,12 +383,12 @@ void test_tfse_illegal_parameters(bool use_json_only_api)
params.source = TripParameters::SourceType::Any;
params.destination = TripParameters::DestinationType::Last;
params.roundtrip = false;
CheckNotImplemented(osrm, params, use_json_only_api);
CheckOk(osrm, params, use_json_only_api);
params.source = TripParameters::SourceType::First;
params.destination = TripParameters::DestinationType::Any;
params.roundtrip = false;
CheckNotImplemented(osrm, params, use_json_only_api);
CheckOk(osrm, params, use_json_only_api);
}
BOOST_AUTO_TEST_CASE(test_tfse_illegal_parameters_old_api) { test_tfse_illegal_parameters(true); }
BOOST_AUTO_TEST_CASE(test_tfse_illegal_parameters_new_api) { test_tfse_illegal_parameters(false); }