Rename side API

Side -> Approach
 - DEFAULT -> CURB
 - BOTH -> UNRESTRICTED
 - remove OPPOSITE param

Signed-off-by: FILLAU Jean-Maxime <jean-maxime.fillau@mapotempo.com>
This commit is contained in:
FILLAU Jean-Maxime 2017-05-22 16:07:12 +02:00 committed by Patrick Niklaus
parent f782dfbfd9
commit f65299d665
16 changed files with 272 additions and 330 deletions

View File

@ -728,7 +728,7 @@ set_property(TARGET osrm-routed PROPERTY INSTALL_RPATH_USE_LINK_PATH TRUE)
file(GLOB VariantGlob third_party/variant/include/mapbox/*.hpp)
file(GLOB LibraryGlob include/osrm/*.hpp)
file(GLOB ParametersGlob include/engine/api/*_parameters.hpp)
set(EngineHeader include/engine/status.hpp include/engine/engine_config.hpp include/engine/hint.hpp include/engine/bearing.hpp include/engine/side.hpp include/engine/phantom_node.hpp)
set(EngineHeader include/engine/status.hpp include/engine/engine_config.hpp include/engine/hint.hpp include/engine/bearing.hpp include/engine/approach.hpp include/engine/phantom_node.hpp)
set(UtilHeader include/util/coordinate.hpp include/util/json_container.hpp include/util/typedefs.hpp include/util/alias.hpp include/util/exception.hpp)
set(ExtractorHeader include/extractor/extractor.hpp include/extractor/extractor_config.hpp include/extractor/travel_mode.hpp)
set(PartitionerHeader include/partition/partitioner.hpp include/partition/partition_config.hpp)

View File

@ -46,9 +46,9 @@ module.exports = function () {
return waypoints.map(w => [w.lon, w.lat].map(ensureDecimal).join(','));
};
this.requestRoute = (waypoints, bearings, sides, userParams, callback) => {
this.requestRoute = (waypoints, bearings, approaches, userParams, callback) => {
if (bearings.length && bearings.length !== waypoints.length) throw new Error('*** number of bearings does not equal the number of waypoints');
if (sides.length && sides.length !== waypoints.length) throw new Error('*** number of sides does not equal the number of waypoints');
if (approaches.length && approaches.length !== waypoints.length) throw new Error('*** number of approaches does not equal the number of waypoints');
var defaults = {
output: 'json',
@ -68,8 +68,8 @@ module.exports = function () {
}).join(';');
}
if (sides.length) {
params.sides = sides.join(';');
if (approaches.length) {
params.approaches = approaches.join(';');
}
return this.requestPath('route', params, callback);
};
@ -167,8 +167,8 @@ module.exports = function () {
('out' in s.intersections[0] ? s.intersections[0].bearings[s.intersections[0].out] : 0));
};
this.sideList = (instructions) => {
return this.extractInstructionList(instructions, s => s.sides || '');
this.approachList = (instructions) => {
return this.extractInstructionList(instructions, s => s.approaches || '');
};
this.annotationList = (instructions) => {

View File

@ -35,7 +35,7 @@ module.exports = function () {
if (err) return cb(err);
if (body && body.length) {
let destinations, pronunciations, instructions, refs, bearings, turns, modes, times,
distances, summary, intersections, lanes, locations, annotation, weight_name, weights, sides;
distances, summary, intersections, lanes, locations, annotation, weight_name, weights, approaches;
let json = JSON.parse(body);
@ -60,7 +60,7 @@ module.exports = function () {
annotation = this.annotationList(json.routes[0]);
weight_name = this.weightName(json.routes[0]);
weights = this.weightList(json.routes[0]);
sides = this.sideList(json.routes[0]);
approaches = this.approachList(json.routes[0]);
}
if (headers.has('status')) {
@ -148,8 +148,8 @@ module.exports = function () {
got.locations = (locations || '').trim();
}
/*
if (headers.has('sides')){
got.sides = (sides || '').trim();
if (headers.has('approaches')){
got.approaches = (approaches || '').trim();
}*/
// if header matches 'a:*', parse out the values for *
// and return in that header
@ -180,7 +180,7 @@ module.exports = function () {
putValue('weight_name', weight_name);
putValue('weights', weights);
putValue('weight', weight);
putValue('side', sides);
putValue('approach', approaches);
for (var key in row) {
if (this.FuzzyMatch.match(got[key], row[key])) {
@ -216,16 +216,16 @@ module.exports = function () {
var params = this.overwriteParams(defaultParams, userParams),
waypoints = [],
bearings = [],
sides = [];
approaches = [];
if (row.bearings) {
got.bearings = row.bearings;
bearings = row.bearings.split(' ').filter(b => !!b);
}
if (row.sides) {
got.sides = row.sides;
sides = row.sides.split(' ').filter(b => !!b);
if (row.approaches) {
got.approaches = row.approaches;
approaches = row.approaches.split(' ').filter(b => !!b);
}
if (row.from && row.to) {
@ -239,7 +239,7 @@ module.exports = function () {
got.from = row.from;
got.to = row.to;
this.requestRoute(waypoints, bearings, sides, params, afterRequest);
this.requestRoute(waypoints, bearings, approaches, params, afterRequest);
} else if (row.waypoints) {
row.waypoints.split(',').forEach((n) => {
var node = this.findNodeByName(n.trim());
@ -247,7 +247,7 @@ module.exports = function () {
waypoints.push(node);
});
got.waypoints = row.waypoints;
this.requestRoute(waypoints, bearings, sides, params, afterRequest);
this.requestRoute(waypoints, bearings, approaches, params, afterRequest);
} else {
return cb(new Error('*** no waypoints'));
}

View File

@ -0,0 +1,192 @@
@routing @approach_param @testbot
Feature: Approach parameter
Background:
Given the profile "car"
And a grid size of 10 meters
Scenario: Testbot - Start End same approach, option unrestricted for Start and End
Given the node map
"""
s e
a------b------c
"""
And the ways
| nodes |
| ab |
| bc |
When I route I should get
| from | to | approaches | route |
| s | e | unrestricted unrestricted | ab,bc |
Scenario: Testbot - Start End same approach, option unrestricted for Start and curb for End
Given the node map
"""
s e
a------b------c
"""
And the ways
| nodes |
| ab |
| bc |
When I route I should get
| from | to | approaches | route |
| s | e | unrestricted curb | ab,bc,bc |
Scenario: Testbot - Start End opposite approach, option unrestricted for Start and End
Given the node map
"""
s
a------b------c
e
"""
And the ways
| nodes |
| ab |
| bc |
When I route I should get
| from | to | approaches | route |
| s | e | unrestricted unrestricted | ab,bc |
Scenario: Testbot - Start End opposite approach, option unrestricted for Start and curb for End
Given the node map
"""
s
a------b------c
e
"""
And the ways
| nodes |
| ab |
| bc |
When I route I should get
| from | to | approaches | route |
| s | e | unrestricted curb | ab,bc |
###############
# Oneway Test #
###############
Scenario: Testbot - Test on oneway segment, Start End same approach, option unrestricted for Start and End
Given the node map
"""
s e
a------b------c
"""
And the ways
| nodes | oneway |
| ab | yes |
| bc | yes |
When I route I should get
| from | to | approaches | route |
| s | e | unrestricted unrestricted | ab,bc |
Scenario: Testbot - Test on oneway segment, Start End same approach, option unrestricted for Start and curb for End
Given the node map
"""
s e
a------b------c
"""
And the ways
| nodes | oneway |
| ab | yes |
| bc | yes |
When I route I should get
| from | to | approaches | route |
| s | e | unrestricted curb | ab,bc |
Scenario: Testbot - Test on oneway segment, Start End opposite approach, option unrestricted for Start and End
Given the node map
"""
s
a------b------c
e
"""
And the ways
| nodes | oneway |
| ab | yes |
| bc | yes |
When I route I should get
| from | to | approaches | route |
| s | e | unrestricted unrestricted | ab,bc |
Scenario: Testbot - Test on oneway segment, Start End opposite approach, option unrestricted for Start and curb for End
Given the node map
"""
s
a------b------c
e
"""
And the ways
| nodes | oneway |
| ab | yes |
| bc | yes |
When I route I should get
| from | to | approaches | route |
| s | e | unrestricted curb | ab,bc |
##############
# UTurn Test #
##############
Scenario: Testbot - UTurn test, router can't found a route because uturn unauthorized on the segment selected
Given the node map
"""
s e
a------b------c
"""
And the ways
| nodes |
| ab |
| bc |
And the relations
| type | way:from | way:to | node:via | restriction |
| restriction | bc | bc | c | no_u_turn |
When I route I should get
| from | to | approaches | route |
| s | e | unrestricted curb | |
Scenario: Testbot - UTurn test, router can found a route because he can use the roundabout
Given the node map
"""
h
s e / \
a------b------c g
\ /
f
"""
And the ways
| nodes | junction |
| ab | |
| bc | |
| cfghc | roundabout |
And the relations
| type | way:from | way:to | node:via | restriction |
| restriction | bc | bc | c | no_u_turn |
When I route I should get
| from | to | approaches | route |
| s | e | unrestricted curb | ab,bc,bc |

View File

@ -1,245 +0,0 @@
@routing @side_param @testbot
Feature: Side parameter
Background:
Given the profile "car"
And a grid size of 10 meters
Scenario: Testbot - Start End same side, option both for Start and End
Given the node map
"""
s e
a------b------c
"""
And the ways
| nodes |
| ab |
| bc |
When I route I should get
| from | to | sides | route |
| s | e | b b | ab,bc |
Scenario: Testbot - Start End same side, option both for Start and Default for End
Given the node map
"""
s e
a------b------c
"""
And the ways
| nodes |
| ab |
| bc |
When I route I should get
| from | to | sides | route |
| s | e | b d | ab,bc,bc |
Scenario: Testbot - Start End same side, option both for Start and Opposite for End
Given the node map
"""
s e
a------b------c
"""
And the ways
| nodes |
| ab |
| bc |
When I route I should get
| from | to | sides | route |
| s | e | b o | ab,bc |
Scenario: Testbot - Start End opposite side, option both for Start and End
Given the node map
"""
s
a------b------c
e
"""
And the ways
| nodes |
| ab |
| bc |
When I route I should get
| from | to | sides | route |
| s | e | b b | ab,bc |
Scenario: Testbot - Start End opposite side, option both for Start and Default for End
Given the node map
"""
s
a------b------c
e
"""
And the ways
| nodes |
| ab |
| bc |
When I route I should get
| from | to | sides | route |
| s | e | b d | ab,bc |
Scenario: Testbot - Start End opposite side, option both for Start and Opposite for End
Given the node map
"""
s
a------b------c
e
"""
And the ways
| nodes |
| ab |
| bc |
When I route I should get
| from | to | sides | route |
| s | e | b o | ab,bc,bc |
###############
# Oneway Test #
###############
Scenario: Testbot - Test on oneway segment, Start End same side, option both for Start and End,
Given the node map
"""
s e
a------b------c
"""
And the ways
| nodes | oneway |
| ab | yes |
| bc | yes |
When I route I should get
| from | to | sides | route |
| s | e | b b | ab,bc |
Scenario: Testbot - Test on oneway segment, Start End same side, option both for Start and Default for End
Given the node map
"""
s e
a------b------c
"""
And the ways
| nodes | oneway |
| ab | yes |
| bc | yes |
When I route I should get
| from | to | sides | route |
| s | e | b d | ab,bc |
Scenario: Testbot - Test on oneway segment, Start End same side, option both for Start and Opposite for End
Given the node map
"""
s e
a------b------c
"""
And the ways
| nodes | oneway |
| ab | yes |
| bc | yes |
When I route I should get
| from | to | sides | route |
| s | e | b o | ab,bc |
Scenario: Testbot - Test on oneway segment, Start End opposite side, option both for Start and End,
Given the node map
"""
s
a------b------c
e
"""
And the ways
| nodes | oneway |
| ab | yes |
| bc | yes |
When I route I should get
| from | to | sides | route |
| s | e | b b | ab,bc |
Scenario: Testbot - Test on oneway segment, Start End opposite side, option both for Start and Default for End
Given the node map
"""
s
a------b------c
e
"""
And the ways
| nodes | oneway |
| ab | yes |
| bc | yes |
When I route I should get
| from | to | sides | route |
| s | e | b d | ab,bc |
Scenario: Testbot - Test on oneway segment, Start End opposite side, option both for Start and Opposite for End
Given the node map
"""
s
a------b------c
e
"""
And the ways
| nodes | oneway |
| ab | yes |
| bc | yes |
When I route I should get
| from | to | sides | route |
| s | e | b o | ab,bc |
Scenario: Testbot - UTurn test, router can't found a route because uturn unauthorized on the segment selected
Given the node map
"""
s e
a------b------c
"""
And the ways
| nodes |
| ab |
| bc |
And the relations
| type | way:from | way:to | node:via | restriction |
| restriction | bc | bc | c | no_u_turn |
When I route I should get
| from | to | sides | route |
| s | e | b d | |

View File

@ -30,7 +30,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "engine/bearing.hpp"
#include "engine/hint.hpp"
#include "engine/side.hpp"
#include "engine/approach.hpp"
#include "util/coordinate.hpp"
#include <boost/optional.hpp>
@ -56,7 +56,7 @@ namespace api
* optional per coordinate
* - bearings: limits the search for segments in the road network to given bearing(s) in degree
* towards true north in clockwise direction, optional per coordinate
* - sides: force the phantom node to start towards the node with the road country side.
* - approaches: force the phantom node to start towards the node with the road country side.
*
* \see OSRM, Coordinate, Hint, Bearing, RouteParame, RouteParameters, TableParameters,
* NearestParameters, TripParameters, MatchParameters and TileParameters
@ -67,7 +67,7 @@ struct BaseParameters
std::vector<boost::optional<Hint>> hints;
std::vector<boost::optional<double>> radiuses;
std::vector<boost::optional<Bearing>> bearings;
std::vector<boost::optional<Side>> sides;
std::vector<boost::optional<Approach>> approaches;
// Adds hints to response which can be included in subsequent requests, see `hints` above.
bool generate_hints = true;
@ -76,10 +76,10 @@ struct BaseParameters
const std::vector<boost::optional<Hint>> hints_ = {},
std::vector<boost::optional<double>> radiuses_ = {},
std::vector<boost::optional<Bearing>> bearings_ = {},
std::vector<boost::optional<Side>> sides_ = {},
std::vector<boost::optional<Approach>> approaches_ = {},
bool generate_hints_ = true)
: coordinates(coordinates_), hints(hints_), radiuses(radiuses_), bearings(bearings_),
sides(sides_), generate_hints(generate_hints_)
approaches(approaches_), generate_hints(generate_hints_)
{
}
@ -89,7 +89,7 @@ struct BaseParameters
return (hints.empty() || hints.size() == coordinates.size()) &&
(bearings.empty() || bearings.size() == coordinates.size()) &&
(radiuses.empty() || radiuses.size() == coordinates.size()) &&
(sides.empty() || sides.size() == coordinates.size()) &&
(approaches.empty() || approaches.size() == coordinates.size()) &&
std::all_of(bearings.begin(),
bearings.end(),
[](const boost::optional<Bearing> bearing_and_range) {

View File

@ -25,19 +25,18 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef OSRM_ENGINE_SIDE_HPP
#define OSRM_ENGINE_SIDE_HPP
#ifndef OSRM_ENGINE_APPROACH_HPP
#define OSRM_ENGINE_APPROACH_HPP
namespace osrm
{
namespace engine
{
enum Side
enum Approach
{
DEFAULT,
OPPOSITE,
BOTH
CURB,
UNRESTRICTED
};
}

View File

@ -7,7 +7,7 @@
#include "engine/algorithm.hpp"
#include "engine/geospatial_query.hpp"
#include "engine/side.hpp"
#include "engine/approach.hpp"
#include "customizer/edge_based_graph.hpp"
@ -716,12 +716,12 @@ class ContiguousInternalMemoryDataFacadeBase : public BaseDataFacade
std::pair<PhantomNode, PhantomNode>
NearestPhantomNodeWithAlternativeFromBigComponent(const util::Coordinate input_coordinate,
const engine::Side side) const override final
const engine::Approach approach) const override final
{
BOOST_ASSERT(m_geospatial_query.get());
return m_geospatial_query->NearestPhantomNodeWithAlternativeFromBigComponent(
input_coordinate, side);
input_coordinate, approach);
}
std::pair<PhantomNode, PhantomNode> NearestPhantomNodeWithAlternativeFromBigComponent(

View File

@ -10,7 +10,7 @@
#include "extractor/guidance/turn_lane_types.hpp"
#include "extractor/original_edge_data.hpp"
#include "engine/phantom_node.hpp"
#include "engine/side.hpp"
#include "engine/approach.hpp"
#include "util/exception.hpp"
#include "util/guidance/bearing_class.hpp"
#include "util/guidance/entry_class.hpp"
@ -120,7 +120,7 @@ class BaseDataFacade
virtual std::pair<PhantomNode, PhantomNode>
NearestPhantomNodeWithAlternativeFromBigComponent(const util::Coordinate input_coordinate,
const engine::Side side) const = 0;
const engine::Approach approach) const = 0;
virtual std::pair<PhantomNode, PhantomNode>
NearestPhantomNodeWithAlternativeFromBigComponent(const util::Coordinate input_coordinate,
const double max_distance) const = 0;

View File

@ -2,7 +2,7 @@
#define GEOSPATIAL_QUERY_HPP
#include "engine/phantom_node.hpp"
#include "engine/side.hpp"
#include "engine/approach.hpp"
#include "util/bearing.hpp"
#include "util/coordinate_calculation.hpp"
#include "util/rectangle.hpp"
@ -212,20 +212,20 @@ template <typename RTreeT, typename DataFacadeT> class GeospatialQuery
// a second phantom node is return that is the nearest coordinate in a big component.
std::pair<PhantomNode, PhantomNode>
NearestPhantomNodeWithAlternativeFromBigComponent(const util::Coordinate input_coordinate,
const engine::Side side) const
const engine::Approach approach) const
{
bool has_small_component = false;
bool has_big_component = false;
auto results = rtree.Nearest(
input_coordinate,
[this, &side, &input_coordinate, &has_big_component, &has_small_component](
[this, &approach, &input_coordinate, &has_big_component, &has_small_component](
const CandidateSegment &segment) {
auto use_segment =
(!has_small_component || (!has_big_component && !IsTinyComponent(segment)));
auto use_directions = std::make_pair(use_segment, use_segment);
bool isOnewaySegment = !(segment.data.forward_segment_id.enabled &&
segment.data.reverse_segment_id.enabled);
if (!isOnewaySegment && side != BOTH)
if (!isOnewaySegment && approach != UNRESTRICTED)
{
// Check the counter clockwise
//
@ -237,16 +237,12 @@ template <typename RTreeT, typename DataFacadeT> class GeospatialQuery
bool input_coordinate_is_at_right = !util::coordinate_calculation::isCCW(
coordinates[segment.data.u], coordinates[segment.data.v], input_coordinate);
// TODO Check the country side, for the moment right is the default country
// side.
// TODO Check the country approach, for the moment right is the default country
// approach.
// if drive left
// input_coordinate_is_at_right = !input_coordinate_is_at_right
// We reverse goCountrySide if side is OPPOSITE
if (side == OPPOSITE)
input_coordinate_is_at_right = !input_coordinate_is_at_right;
// Apply the side.
// Apply the approach.
use_directions.first = use_directions.first && input_coordinate_is_at_right;
use_directions.second = use_directions.second && !input_coordinate_is_at_right;
}

View File

@ -226,16 +226,16 @@ class BasePlugin
const bool use_hints = !parameters.hints.empty();
const bool use_bearings = !parameters.bearings.empty();
const bool use_radiuses = !parameters.radiuses.empty();
const bool use_sides = !parameters.sides.empty();
const bool use_approaches = !parameters.approaches.empty();
BOOST_ASSERT(parameters.IsValid());
for (const auto i : util::irange<std::size_t>(0UL, parameters.coordinates.size()))
{
Side side = engine::Side::BOTH;
Approach approach = engine::Approach::UNRESTRICTED;
// TODO init at SIDE for test
// SideValue side = engine::SideValue::DEFAULT;
if (use_sides && parameters.sides[i])
side = parameters.sides[i].get();
if (use_approaches && parameters.approaches[i])
approach = parameters.approaches[i].get();
if (use_hints && parameters.hints[i] &&
parameters.hints[i]->IsValid(parameters.coordinates[i], facade))
@ -277,7 +277,7 @@ class BasePlugin
{
phantom_node_pairs[i] =
facade.NearestPhantomNodeWithAlternativeFromBigComponent(
parameters.coordinates[i], side);
parameters.coordinates[i], approach);
}
}

View File

@ -149,16 +149,16 @@ struct BaseParametersGrammar : boost::spirit::qi::grammar<Iterator, Signature>
qi::lit("bearings=") >
(-(qi::short_ > ',' > qi::short_))[ph::bind(add_bearing, qi::_r1, qi::_1)] % ';';
side_type.add("d", engine::Side::DEFAULT)("o", engine::Side::OPPOSITE)("b", engine::Side::BOTH);
sides_rule =
qi::lit("sides=") >
(-side_type % ';')[ph::bind(&engine::api::BaseParameters::sides, qi::_r1) = qi::_1];
approach_type.add("unrestricted", engine::Approach::UNRESTRICTED)("curb", engine::Approach::CURB);
approach_rule =
qi::lit("approaches=") >
(-approach_type % ';')[ph::bind(&engine::api::BaseParameters::approaches, qi::_r1) = qi::_1];
base_rule = radiuses_rule(qi::_r1) //
| hints_rule(qi::_r1) //
| bearings_rule(qi::_r1) //
| generate_hints_rule(qi::_r1)
| sides_rule(qi::_r1);
| approach_rule(qi::_r1);
}
protected:
@ -171,7 +171,7 @@ struct BaseParametersGrammar : boost::spirit::qi::grammar<Iterator, Signature>
qi::rule<Iterator, Signature> hints_rule;
qi::rule<Iterator, Signature> generate_hints_rule;
qi::rule<Iterator, Signature> sides_rule;
qi::rule<Iterator, Signature> approach_rule;
qi::rule<Iterator, osrm::engine::Bearing()> bearing_rule;
qi::rule<Iterator, osrm::util::Coordinate()> location_rule;
@ -182,7 +182,7 @@ struct BaseParametersGrammar : boost::spirit::qi::grammar<Iterator, Signature>
qi::rule<Iterator, double()> unlimited_rule;
qi::real_parser<double, json_policy> double_;
qi::symbols<char, engine::Side> side_type;
qi::symbols<char, engine::Approach> approach_type;
};
}
}

View File

@ -28,7 +28,7 @@ std::string getWrongOptionHelp(const engine::api::RouteParameters &parameters)
constrainParamSize(
PARAMETER_SIZE_MISMATCH_MSG, "radiuses", parameters.radiuses, coord_size, help) ||
constrainParamSize(
PARAMETER_SIZE_MISMATCH_MSG, "sides", parameters.sides, coord_size, help);
PARAMETER_SIZE_MISMATCH_MSG, "approaches", parameters.approaches, coord_size, help);
if (!param_size_mismatch && parameters.coordinates.size() < 2)
{

View File

@ -147,7 +147,7 @@ class MockBaseDataFacade : public engine::datafacade::BaseDataFacade
std::pair<engine::PhantomNode, engine::PhantomNode>
NearestPhantomNodeWithAlternativeFromBigComponent(const util::Coordinate /*input_coordinate*/,
const engine::Side /*side*/) const override
const engine::Approach /*approach*/) const override
{
return {};
}

View File

@ -3,7 +3,7 @@
#include "engine/api/route_parameters.hpp"
#include "engine/bearing.hpp"
#include "engine/side.hpp"
#include "engine/approach.hpp"
#include <ostream>
@ -55,9 +55,9 @@ inline std::ostream &operator<<(std::ostream &out, Bearing bearing)
return out;
}
inline std::ostream &operator<<(std::ostream &out, Side side)
inline std::ostream &operator<<(std::ostream &out, Approach approach)
{
out << side;
out << approach;
return out;
}
}

View File

@ -45,8 +45,8 @@ BOOST_AUTO_TEST_CASE(invalid_route_urls)
testInvalidOptions<RouteParameters>("1,2;3,4?overview=false&continue_straight=foo"), 41UL);
BOOST_CHECK_EQUAL(testInvalidOptions<RouteParameters>("1,2;3,4?overview=false&radiuses=foo"),
32UL);
BOOST_CHECK_EQUAL(testInvalidOptions<RouteParameters>("1,2;3,4?overview=false&sides=foo"),
29UL);
BOOST_CHECK_EQUAL(testInvalidOptions<RouteParameters>("1,2;3,4?overview=false&approaches=foo"),
34UL);
BOOST_CHECK_EQUAL(testInvalidOptions<RouteParameters>("1,2;3,4?overview=false&hints=foo"),
29UL);
BOOST_CHECK_EQUAL(testInvalidOptions<RouteParameters>("1,2;3,4?overview=false&hints=;;; ;"),
@ -112,7 +112,7 @@ BOOST_AUTO_TEST_CASE(valid_route_urls)
BOOST_CHECK_EQUAL(reference_1.continue_straight, result_1->continue_straight);
CHECK_EQUAL_RANGE(reference_1.bearings, result_1->bearings);
CHECK_EQUAL_RANGE(reference_1.radiuses, result_1->radiuses);
CHECK_EQUAL_RANGE(reference_1.sides, result_1->sides);
CHECK_EQUAL_RANGE(reference_1.approaches, result_1->approaches);
CHECK_EQUAL_RANGE(reference_1.coordinates, result_1->coordinates);
CHECK_EQUAL_RANGE(reference_1.hints, result_1->hints);
@ -133,7 +133,7 @@ BOOST_AUTO_TEST_CASE(valid_route_urls)
BOOST_CHECK_EQUAL(reference_2.continue_straight, result_2->continue_straight);
CHECK_EQUAL_RANGE(reference_2.bearings, result_2->bearings);
CHECK_EQUAL_RANGE(reference_2.radiuses, result_2->radiuses);
CHECK_EQUAL_RANGE(reference_2.sides, result_2->sides);
CHECK_EQUAL_RANGE(reference_2.approaches, result_2->approaches);
CHECK_EQUAL_RANGE(reference_2.coordinates, result_2->coordinates);
CHECK_EQUAL_RANGE(reference_2.hints, result_2->hints);
BOOST_CHECK_EQUAL(result_2->annotations_type == RouteParameters::AnnotationsType::All, true);
@ -157,7 +157,7 @@ BOOST_AUTO_TEST_CASE(valid_route_urls)
BOOST_CHECK_EQUAL(reference_3.continue_straight, result_3->continue_straight);
CHECK_EQUAL_RANGE(reference_3.bearings, result_3->bearings);
CHECK_EQUAL_RANGE(reference_3.radiuses, result_3->radiuses);
CHECK_EQUAL_RANGE(reference_3.sides, result_3->sides);
CHECK_EQUAL_RANGE(reference_3.approaches, result_3->approaches);
CHECK_EQUAL_RANGE(reference_3.coordinates, result_3->coordinates);
CHECK_EQUAL_RANGE(reference_3.hints, result_3->hints);
@ -195,7 +195,7 @@ BOOST_AUTO_TEST_CASE(valid_route_urls)
BOOST_CHECK_EQUAL(reference_4.continue_straight, result_4->continue_straight);
CHECK_EQUAL_RANGE(reference_4.bearings, result_4->bearings);
CHECK_EQUAL_RANGE(reference_4.radiuses, result_4->radiuses);
CHECK_EQUAL_RANGE(reference_4.sides, result_4->sides);
CHECK_EQUAL_RANGE(reference_4.approaches, result_4->approaches);
CHECK_EQUAL_RANGE(reference_4.coordinates, result_4->coordinates);
CHECK_EQUAL_RANGE(reference_4.hints, result_4->hints);
@ -222,7 +222,7 @@ BOOST_AUTO_TEST_CASE(valid_route_urls)
BOOST_CHECK_EQUAL(reference_5.continue_straight, result_5->continue_straight);
CHECK_EQUAL_RANGE(reference_5.bearings, result_5->bearings);
CHECK_EQUAL_RANGE(reference_5.radiuses, result_5->radiuses);
CHECK_EQUAL_RANGE(reference_5.sides, result_5->sides);
CHECK_EQUAL_RANGE(reference_5.approaches, result_5->approaches);
CHECK_EQUAL_RANGE(reference_5.coordinates, result_5->coordinates);
CHECK_EQUAL_RANGE(reference_5.hints, result_5->hints);
@ -242,7 +242,7 @@ BOOST_AUTO_TEST_CASE(valid_route_urls)
BOOST_CHECK_EQUAL(reference_6.continue_straight, result_6->continue_straight);
CHECK_EQUAL_RANGE(reference_6.bearings, result_6->bearings);
CHECK_EQUAL_RANGE(reference_6.radiuses, result_6->radiuses);
CHECK_EQUAL_RANGE(reference_6.sides, result_6->sides);
CHECK_EQUAL_RANGE(reference_6.approaches, result_6->approaches);
CHECK_EQUAL_RANGE(reference_6.coordinates, result_6->coordinates);
CHECK_EQUAL_RANGE(reference_6.hints, result_6->hints);
@ -260,7 +260,7 @@ BOOST_AUTO_TEST_CASE(valid_route_urls)
BOOST_CHECK_EQUAL(reference_7.continue_straight, result_7->continue_straight);
CHECK_EQUAL_RANGE(reference_7.bearings, result_7->bearings);
CHECK_EQUAL_RANGE(reference_7.radiuses, result_7->radiuses);
CHECK_EQUAL_RANGE(reference_7.sides, result_7->sides);
CHECK_EQUAL_RANGE(reference_7.approaches, result_7->approaches);
CHECK_EQUAL_RANGE(reference_7.coordinates, result_7->coordinates);
CHECK_EQUAL_RANGE(reference_7.hints, result_7->hints);
@ -315,7 +315,7 @@ BOOST_AUTO_TEST_CASE(valid_route_urls)
BOOST_CHECK_EQUAL(reference_10.continue_straight, result_10->continue_straight);
CHECK_EQUAL_RANGE(reference_10.bearings, result_10->bearings);
CHECK_EQUAL_RANGE(reference_10.radiuses, result_10->radiuses);
CHECK_EQUAL_RANGE(reference_10.sides, result_10->sides);
CHECK_EQUAL_RANGE(reference_10.approaches, result_10->approaches);
CHECK_EQUAL_RANGE(reference_10.coordinates, result_10->coordinates);
CHECK_EQUAL_RANGE(reference_10.hints, result_10->hints);
@ -399,8 +399,8 @@ BOOST_AUTO_TEST_CASE(valid_route_urls)
BOOST_CHECK_EQUAL(result_2->annotations_type == RouteParameters::AnnotationsType::All, true);
BOOST_CHECK_EQUAL(result_17->annotations, true);
std::vector<boost::optional<engine::Side>> sides_18 = {
boost::none, engine::Side::DEFAULT, engine::Side::BOTH, engine::Side::OPPOSITE,
std::vector<boost::optional<engine::Approach>> approaches_18 = {
boost::none, engine::Approach::CURB, engine::Approach::UNRESTRICTED, engine::Approach::CURB,
};
RouteParameters reference_18{false,
false,
@ -412,9 +412,9 @@ BOOST_AUTO_TEST_CASE(valid_route_urls)
std::vector<boost::optional<engine::Hint>>{},
std::vector<boost::optional<double>>{},
std::vector<boost::optional<engine::Bearing>>{},
sides_18};
approaches_18};
auto result_18 = parseParameters<RouteParameters>("1,2;3,4;5,6;7,8?steps=false&sides=;d;b;o");
auto result_18 = parseParameters<RouteParameters>("1,2;3,4;5,6;7,8?steps=false&approaches=;curb;unrestricted;curb");
BOOST_CHECK(result_18);
BOOST_CHECK_EQUAL(reference_18.steps, result_18->steps);
BOOST_CHECK_EQUAL(reference_18.alternatives, result_18->alternatives);
@ -424,7 +424,7 @@ BOOST_AUTO_TEST_CASE(valid_route_urls)
BOOST_CHECK_EQUAL(reference_18.continue_straight, result_18->continue_straight);
CHECK_EQUAL_RANGE(reference_18.bearings, result_18->bearings);
CHECK_EQUAL_RANGE(reference_18.radiuses, result_18->radiuses);
CHECK_EQUAL_RANGE(reference_18.sides, result_18->sides);
CHECK_EQUAL_RANGE(reference_18.approaches, result_18->approaches);
CHECK_EQUAL_RANGE(reference_18.coordinates, result_18->coordinates);
CHECK_EQUAL_RANGE(reference_18.hints, result_18->hints);
}
@ -442,7 +442,7 @@ BOOST_AUTO_TEST_CASE(valid_table_urls)
CHECK_EQUAL_RANGE(reference_1.destinations, result_1->destinations);
CHECK_EQUAL_RANGE(reference_1.bearings, result_1->bearings);
CHECK_EQUAL_RANGE(reference_1.radiuses, result_1->radiuses);
CHECK_EQUAL_RANGE(reference_1.sides, result_1->sides);
CHECK_EQUAL_RANGE(reference_1.approaches, result_1->approaches);
CHECK_EQUAL_RANGE(reference_1.coordinates, result_1->coordinates);
std::vector<std::size_t> sources_2 = {1, 2, 3};
@ -455,7 +455,7 @@ BOOST_AUTO_TEST_CASE(valid_table_urls)
CHECK_EQUAL_RANGE(reference_2.destinations, result_2->destinations);
CHECK_EQUAL_RANGE(reference_2.bearings, result_2->bearings);
CHECK_EQUAL_RANGE(reference_2.radiuses, result_2->radiuses);
CHECK_EQUAL_RANGE(reference_2.sides, result_2->sides);
CHECK_EQUAL_RANGE(reference_2.approaches, result_2->approaches);
CHECK_EQUAL_RANGE(reference_2.coordinates, result_2->coordinates);
auto result_3 = parseParameters<TableParameters>("1,2;3,4?sources=all&destinations=all");
@ -464,7 +464,7 @@ BOOST_AUTO_TEST_CASE(valid_table_urls)
CHECK_EQUAL_RANGE(reference_1.destinations, result_3->destinations);
CHECK_EQUAL_RANGE(reference_1.bearings, result_3->bearings);
CHECK_EQUAL_RANGE(reference_1.radiuses, result_3->radiuses);
CHECK_EQUAL_RANGE(reference_1.sides, result_3->sides);
CHECK_EQUAL_RANGE(reference_1.approaches, result_3->approaches);
CHECK_EQUAL_RANGE(reference_1.coordinates, result_3->coordinates);
}
@ -480,7 +480,7 @@ BOOST_AUTO_TEST_CASE(valid_match_urls)
CHECK_EQUAL_RANGE(reference_1.timestamps, result_1->timestamps);
CHECK_EQUAL_RANGE(reference_1.bearings, result_1->bearings);
CHECK_EQUAL_RANGE(reference_1.radiuses, result_1->radiuses);
CHECK_EQUAL_RANGE(reference_1.sides, result_1->sides);
CHECK_EQUAL_RANGE(reference_1.approaches, result_1->approaches);
CHECK_EQUAL_RANGE(reference_1.coordinates, result_1->coordinates);
MatchParameters reference_2{};
@ -491,7 +491,7 @@ BOOST_AUTO_TEST_CASE(valid_match_urls)
CHECK_EQUAL_RANGE(reference_2.timestamps, result_2->timestamps);
CHECK_EQUAL_RANGE(reference_2.bearings, result_2->bearings);
CHECK_EQUAL_RANGE(reference_2.radiuses, result_2->radiuses);
CHECK_EQUAL_RANGE(reference_2.sides, result_2->sides);
CHECK_EQUAL_RANGE(reference_2.approaches, result_2->approaches);
CHECK_EQUAL_RANGE(reference_2.coordinates, result_2->coordinates);
}
@ -506,7 +506,7 @@ BOOST_AUTO_TEST_CASE(valid_nearest_urls)
BOOST_CHECK_EQUAL(reference_1.number_of_results, result_1->number_of_results);
CHECK_EQUAL_RANGE(reference_1.bearings, result_1->bearings);
CHECK_EQUAL_RANGE(reference_1.radiuses, result_1->radiuses);
CHECK_EQUAL_RANGE(reference_1.sides, result_1->sides);
CHECK_EQUAL_RANGE(reference_1.approaches, result_1->approaches);
CHECK_EQUAL_RANGE(reference_1.coordinates, result_1->coordinates);
NearestParameters reference_2{};
@ -517,7 +517,7 @@ BOOST_AUTO_TEST_CASE(valid_nearest_urls)
BOOST_CHECK_EQUAL(reference_2.number_of_results, result_2->number_of_results);
CHECK_EQUAL_RANGE(reference_2.bearings, result_2->bearings);
CHECK_EQUAL_RANGE(reference_2.radiuses, result_2->radiuses);
CHECK_EQUAL_RANGE(reference_2.sides, result_2->sides);
CHECK_EQUAL_RANGE(reference_2.approaches, result_2->approaches);
CHECK_EQUAL_RANGE(reference_2.coordinates, result_2->coordinates);
}