Format with clang-format 3.8
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
#ifndef OSRM_UNIT_TEST_ARGS
|
||||
#define OSRM_UNIT_TEST_ARGS
|
||||
|
||||
#include <vector>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
inline std::vector<std::string> get_args()
|
||||
{
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
#include <boost/test/unit_test.hpp>
|
||||
#include <boost/test/test_case_template.hpp>
|
||||
#include <boost/test/unit_test.hpp>
|
||||
|
||||
#include "args.hpp"
|
||||
|
||||
#include "osrm/trip_parameters.hpp"
|
||||
#include "osrm/match_parameters.hpp"
|
||||
#include "osrm/route_parameters.hpp"
|
||||
#include "osrm/table_parameters.hpp"
|
||||
#include "osrm/match_parameters.hpp"
|
||||
#include "osrm/trip_parameters.hpp"
|
||||
|
||||
#include "osrm/coordinate.hpp"
|
||||
#include "osrm/engine_config.hpp"
|
||||
#include "osrm/json_container.hpp"
|
||||
#include "osrm/status.hpp"
|
||||
#include "osrm/osrm.hpp"
|
||||
#include "osrm/status.hpp"
|
||||
|
||||
BOOST_AUTO_TEST_SUITE(limits)
|
||||
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
#include <boost/test/unit_test.hpp>
|
||||
#include <boost/test/test_case_template.hpp>
|
||||
#include <boost/test/unit_test.hpp>
|
||||
|
||||
#include "args.hpp"
|
||||
#include "fixture.hpp"
|
||||
#include "coordinates.hpp"
|
||||
#include "fixture.hpp"
|
||||
#include "waypoint_check.hpp"
|
||||
|
||||
#include "osrm/match_parameters.hpp"
|
||||
@@ -11,8 +11,8 @@
|
||||
#include "osrm/coordinate.hpp"
|
||||
#include "osrm/engine_config.hpp"
|
||||
#include "osrm/json_container.hpp"
|
||||
#include "osrm/status.hpp"
|
||||
#include "osrm/osrm.hpp"
|
||||
#include "osrm/status.hpp"
|
||||
|
||||
BOOST_AUTO_TEST_SUITE(match)
|
||||
|
||||
@@ -49,14 +49,21 @@ BOOST_AUTO_TEST_CASE(test_match)
|
||||
{
|
||||
BOOST_CHECK(waypoint_check(waypoint));
|
||||
const auto &waypoint_object = waypoint.get<json::Object>();
|
||||
const auto matchings_index = waypoint_object.values.at("matchings_index").get<json::Number>().value;
|
||||
const auto waypoint_index = waypoint_object.values.at("waypoint_index").get<json::Number>().value;
|
||||
const auto &route_legs = matchings[matchings_index].get<json::Object>().values.at("legs").get<json::Array>().values;
|
||||
const auto matchings_index =
|
||||
waypoint_object.values.at("matchings_index").get<json::Number>().value;
|
||||
const auto waypoint_index =
|
||||
waypoint_object.values.at("waypoint_index").get<json::Number>().value;
|
||||
const auto &route_legs = matchings[matchings_index]
|
||||
.get<json::Object>()
|
||||
.values.at("legs")
|
||||
.get<json::Array>()
|
||||
.values;
|
||||
BOOST_CHECK_LT(waypoint_index, route_legs.size() + 1);
|
||||
BOOST_CHECK_LT(matchings_index, number_of_matchings);
|
||||
} else
|
||||
}
|
||||
else
|
||||
{
|
||||
BOOST_CHECK(waypoint.is<json::Null>());
|
||||
BOOST_CHECK(waypoint.is<json::Null>());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
#include <boost/test/unit_test.hpp>
|
||||
#include <boost/test/test_case_template.hpp>
|
||||
#include <boost/test/unit_test.hpp>
|
||||
|
||||
#include "args.hpp"
|
||||
#include "fixture.hpp"
|
||||
#include "coordinates.hpp"
|
||||
#include "fixture.hpp"
|
||||
|
||||
#include "osrm/nearest_parameters.hpp"
|
||||
|
||||
#include "osrm/coordinate.hpp"
|
||||
#include "osrm/engine_config.hpp"
|
||||
#include "osrm/json_container.hpp"
|
||||
#include "osrm/status.hpp"
|
||||
#include "osrm/osrm.hpp"
|
||||
#include "osrm/status.hpp"
|
||||
|
||||
BOOST_AUTO_TEST_SUITE(nearest)
|
||||
|
||||
|
||||
@@ -62,12 +62,13 @@ BOOST_AUTO_TEST_CASE(test_route_same_coordinates_fixture)
|
||||
{"geometry", "yw_jGupkl@??"},
|
||||
{"name", "Boulevard du Larvotto"},
|
||||
{"mode", "driving"},
|
||||
{"maneuver", json::Object{{
|
||||
{"location", location},
|
||||
{"bearing_before", 0},
|
||||
{"bearing_after", 0},
|
||||
{"type", "depart"},
|
||||
}}},
|
||||
{"maneuver",
|
||||
json::Object{{
|
||||
{"location", location},
|
||||
{"bearing_before", 0},
|
||||
{"bearing_after", 0},
|
||||
{"type", "depart"},
|
||||
}}},
|
||||
{"intersections",
|
||||
json::Array{{json::Object{
|
||||
{{"location", location},
|
||||
@@ -80,7 +81,11 @@ BOOST_AUTO_TEST_CASE(test_route_same_coordinates_fixture)
|
||||
{"geometry", "yw_jGupkl@"},
|
||||
{"name", "Boulevard du Larvotto"},
|
||||
{"mode", "driving"},
|
||||
{"maneuver", json::Object{{{"location", location}, {"bearing_before", 0}, {"bearing_after", 0}, {"type", "arrive"}}}},
|
||||
{"maneuver",
|
||||
json::Object{{{"location", location},
|
||||
{"bearing_before", 0},
|
||||
{"bearing_after", 0},
|
||||
{"type", "arrive"}}}},
|
||||
{"intersections",
|
||||
json::Array{{json::Object{
|
||||
{{"location", location},
|
||||
@@ -206,26 +211,29 @@ BOOST_AUTO_TEST_CASE(test_route_same_coordinates)
|
||||
for (auto &intersection : intersections)
|
||||
{
|
||||
const auto &intersection_object = intersection.get<json::Object>().values;
|
||||
const auto location = intersection_object.at("location").get<json::Array>().values;
|
||||
const auto location =
|
||||
intersection_object.at("location").get<json::Array>().values;
|
||||
const auto longitude = location[0].get<json::Number>().value;
|
||||
const auto latitude = location[1].get<json::Number>().value;
|
||||
BOOST_CHECK(longitude >= -180. && longitude <= 180.);
|
||||
BOOST_CHECK(latitude >= -90. && latitude <= 90.);
|
||||
|
||||
const auto &bearings = intersection_object.at("bearings").get<json::Array>().values;
|
||||
const auto &bearings =
|
||||
intersection_object.at("bearings").get<json::Array>().values;
|
||||
BOOST_CHECK(!bearings.empty());
|
||||
const auto &entries = intersection_object.at("entry").get<json::Array>().values;
|
||||
BOOST_CHECK(bearings.size() == entries.size());
|
||||
|
||||
for( const auto bearing : bearings )
|
||||
BOOST_CHECK( 0. <= bearing.get<json::Number>().value && bearing.get<json::Number>().value <= 360. );
|
||||
for (const auto bearing : bearings)
|
||||
BOOST_CHECK(0. <= bearing.get<json::Number>().value &&
|
||||
bearing.get<json::Number>().value <= 360.);
|
||||
|
||||
if( step_count > 0 )
|
||||
if (step_count > 0)
|
||||
{
|
||||
const auto in = intersection_object.at("in").get<json::Number>().value;
|
||||
BOOST_CHECK(in < bearings.size());
|
||||
}
|
||||
if( step_count + 1 < steps.size() )
|
||||
if (step_count + 1 < steps.size())
|
||||
{
|
||||
const auto out = intersection_object.at("out").get<json::Number>().value;
|
||||
BOOST_CHECK(out < bearings.size());
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#include <boost/test/unit_test.hpp>
|
||||
#include <boost/test/test_case_template.hpp>
|
||||
#include <boost/test/unit_test.hpp>
|
||||
|
||||
#include "args.hpp"
|
||||
#include "coordinates.hpp"
|
||||
@@ -11,8 +11,8 @@
|
||||
#include "osrm/coordinate.hpp"
|
||||
#include "osrm/engine_config.hpp"
|
||||
#include "osrm/json_container.hpp"
|
||||
#include "osrm/status.hpp"
|
||||
#include "osrm/osrm.hpp"
|
||||
#include "osrm/status.hpp"
|
||||
|
||||
BOOST_AUTO_TEST_SUITE(table)
|
||||
|
||||
@@ -47,7 +47,8 @@ BOOST_AUTO_TEST_CASE(test_table_three_coords_one_source_one_dest_matrix)
|
||||
for (unsigned int i = 0; i < durations_array.size(); i++)
|
||||
{
|
||||
const auto durations_matrix = durations_array[i].get<json::Array>().values;
|
||||
BOOST_CHECK_EQUAL(durations_matrix.size(), params.sources.size()*params.destinations.size());
|
||||
BOOST_CHECK_EQUAL(durations_matrix.size(),
|
||||
params.sources.size() * params.destinations.size());
|
||||
}
|
||||
// check destinations array of waypoint objects
|
||||
const auto &destinations_array = result.values.at("destinations").get<json::Array>().values;
|
||||
@@ -96,7 +97,8 @@ BOOST_AUTO_TEST_CASE(test_table_three_coords_one_source_matrix)
|
||||
{
|
||||
const auto durations_matrix = durations_array[i].get<json::Array>().values;
|
||||
BOOST_CHECK_EQUAL(durations_matrix[i].get<json::Number>().value, 0);
|
||||
BOOST_CHECK_EQUAL(durations_matrix.size(), params.sources.size()*params.coordinates.size());
|
||||
BOOST_CHECK_EQUAL(durations_matrix.size(),
|
||||
params.sources.size() * params.coordinates.size());
|
||||
}
|
||||
// check destinations array of waypoint objects
|
||||
const auto &destinations_array = result.values.at("destinations").get<json::Array>().values;
|
||||
|
||||
+42
-42
@@ -1,5 +1,5 @@
|
||||
#include <boost/test/unit_test.hpp>
|
||||
#include <boost/test/test_case_template.hpp>
|
||||
#include <boost/test/unit_test.hpp>
|
||||
|
||||
#include "args.hpp"
|
||||
#include "fixture.hpp"
|
||||
@@ -9,8 +9,8 @@
|
||||
#include "osrm/coordinate.hpp"
|
||||
#include "osrm/engine_config.hpp"
|
||||
#include "osrm/json_container.hpp"
|
||||
#include "osrm/status.hpp"
|
||||
#include "osrm/osrm.hpp"
|
||||
#include "osrm/status.hpp"
|
||||
|
||||
#include "util/vector_tile.hpp"
|
||||
|
||||
@@ -57,16 +57,16 @@ BOOST_AUTO_TEST_CASE(test_tile)
|
||||
BOOST_CHECK_EQUAL(std::distance(value_begin, value_end), 8);
|
||||
auto iter = value_begin;
|
||||
BOOST_CHECK_EQUAL(*iter++, 0); // speed key
|
||||
BOOST_CHECK_LT(*iter++, 128); // speed value
|
||||
BOOST_CHECK_LT(*iter++, 128); // speed value
|
||||
BOOST_CHECK_EQUAL(*iter++, 1); // component key
|
||||
// component value
|
||||
BOOST_CHECK_GE(*iter, 128);
|
||||
BOOST_CHECK_LE(*iter, 129);
|
||||
iter++;
|
||||
BOOST_CHECK_EQUAL(*iter++, 2); // data source key
|
||||
*iter++; // skip value check, can be valud uint32
|
||||
*iter++; // skip value check, can be valud uint32
|
||||
BOOST_CHECK_EQUAL(*iter++, 3); // duration key
|
||||
BOOST_CHECK_GT(*iter++, 130); // duration value
|
||||
BOOST_CHECK_GT(*iter++, 130); // duration value
|
||||
BOOST_CHECK(iter == value_end);
|
||||
// geometry
|
||||
feature_message.next();
|
||||
@@ -77,20 +77,20 @@ BOOST_AUTO_TEST_CASE(test_tile)
|
||||
const auto check_value = [](protozero::pbf_reader value) {
|
||||
while (value.next())
|
||||
{
|
||||
switch(value.tag())
|
||||
switch (value.tag())
|
||||
{
|
||||
case util::vector_tile::VARIANT_TYPE_BOOL:
|
||||
value.get_bool();
|
||||
break;
|
||||
case util::vector_tile::VARIANT_TYPE_DOUBLE:
|
||||
value.get_double();
|
||||
break;
|
||||
case util::vector_tile::VARIANT_TYPE_STRING:
|
||||
value.get_string();
|
||||
break;
|
||||
case util::vector_tile::VARIANT_TYPE_UINT32:
|
||||
value.get_uint32();
|
||||
break;
|
||||
case util::vector_tile::VARIANT_TYPE_BOOL:
|
||||
value.get_bool();
|
||||
break;
|
||||
case util::vector_tile::VARIANT_TYPE_DOUBLE:
|
||||
value.get_double();
|
||||
break;
|
||||
case util::vector_tile::VARIANT_TYPE_STRING:
|
||||
value.get_string();
|
||||
break;
|
||||
case util::vector_tile::VARIANT_TYPE_UINT32:
|
||||
value.get_uint32();
|
||||
break;
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -100,31 +100,31 @@ BOOST_AUTO_TEST_CASE(test_tile)
|
||||
|
||||
while (layer_message.next())
|
||||
{
|
||||
switch(layer_message.tag())
|
||||
switch (layer_message.tag())
|
||||
{
|
||||
case util::vector_tile::VERSION_TAG:
|
||||
BOOST_CHECK_EQUAL(layer_message.get_uint32(), 2);
|
||||
break;
|
||||
case util::vector_tile::NAME_TAG:
|
||||
BOOST_CHECK_EQUAL(layer_message.get_string(), "speeds");
|
||||
break;
|
||||
case util::vector_tile::EXTEND_TAG:
|
||||
BOOST_CHECK_EQUAL(layer_message.get_uint32(), util::vector_tile::EXTENT);
|
||||
break;
|
||||
case util::vector_tile::FEATURE_TAG:
|
||||
check_feature(layer_message.get_message());
|
||||
break;
|
||||
case util::vector_tile::KEY_TAG:
|
||||
layer_message.get_string();
|
||||
number_of_keys++;
|
||||
break;
|
||||
case util::vector_tile::VARIANT_TAG:
|
||||
check_value(layer_message.get_message());
|
||||
number_of_values++;
|
||||
break;
|
||||
default:
|
||||
BOOST_CHECK(false); // invalid tag
|
||||
break;
|
||||
case util::vector_tile::VERSION_TAG:
|
||||
BOOST_CHECK_EQUAL(layer_message.get_uint32(), 2);
|
||||
break;
|
||||
case util::vector_tile::NAME_TAG:
|
||||
BOOST_CHECK_EQUAL(layer_message.get_string(), "speeds");
|
||||
break;
|
||||
case util::vector_tile::EXTEND_TAG:
|
||||
BOOST_CHECK_EQUAL(layer_message.get_uint32(), util::vector_tile::EXTENT);
|
||||
break;
|
||||
case util::vector_tile::FEATURE_TAG:
|
||||
check_feature(layer_message.get_message());
|
||||
break;
|
||||
case util::vector_tile::KEY_TAG:
|
||||
layer_message.get_string();
|
||||
number_of_keys++;
|
||||
break;
|
||||
case util::vector_tile::VARIANT_TAG:
|
||||
check_value(layer_message.get_message());
|
||||
number_of_values++;
|
||||
break;
|
||||
default:
|
||||
BOOST_CHECK(false); // invalid tag
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -131,7 +131,8 @@ BOOST_AUTO_TEST_CASE(test_trip_response_for_locations_across_components)
|
||||
|
||||
const auto &trips = result.values.at("trips").get<json::Array>().values;
|
||||
BOOST_CHECK_EQUAL(trips.size(), 1);
|
||||
// ^ First snapping, then SCC decomposition (see plugins/trip.cpp). Therefore only a single trip.
|
||||
// ^ First snapping, then SCC decomposition (see plugins/trip.cpp). Therefore only a single
|
||||
// trip.
|
||||
|
||||
for (const auto &waypoint : waypoints)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user