Format with clang-format 3.8

This commit is contained in:
Patrick Niklaus
2016-05-27 21:05:04 +02:00
parent 21c47514da
commit 6e16eab6ec
202 changed files with 2485 additions and 1863 deletions
+3 -3
View File
@@ -1,12 +1,12 @@
#include "engine/base64.hpp"
#include "engine/hint.hpp"
#include "mocks/mock_datafacade.hpp"
#include "engine/hint.hpp"
#include <boost/test/unit_test.hpp>
#include <boost/test/test_case_template.hpp>
#include <boost/test/unit_test.hpp>
#include <iostream>
#include <algorithm>
#include <iostream>
// RFC 4648 "The Base16, Base32, and Base64 Data Encodings"
BOOST_AUTO_TEST_SUITE(base64)
+4 -8
View File
@@ -1,8 +1,8 @@
#include "engine/douglas_peucker.hpp"
#include "util/coordinate_calculation.hpp"
#include <boost/test/unit_test.hpp>
#include <boost/test/test_case_template.hpp>
#include <boost/test/unit_test.hpp>
#include <osrm/coordinate.hpp>
@@ -79,7 +79,6 @@ BOOST_AUTO_TEST_CASE(removed_middle_test_zoom_sensitive)
}
}
BOOST_AUTO_TEST_CASE(remove_second_node_test)
{
// derived from the degreeToPixel function
@@ -99,14 +98,11 @@ BOOST_AUTO_TEST_CASE(remove_second_node_test)
x
*/
std::vector<util::Coordinate> input = {
util::Coordinate(util::FloatLongitude(5),
util::FloatLatitude(5)),
util::Coordinate(util::FloatLongitude(5), util::FloatLatitude(5)),
util::Coordinate(util::FloatLongitude(5 + delta_pixel_to_delta_degree(2, z)),
util::FloatLatitude(5)),
util::Coordinate(util::FloatLongitude(10),
util::FloatLatitude(10)),
util::Coordinate(util::FloatLongitude(5),
util::FloatLatitude(15)),
util::Coordinate(util::FloatLongitude(10), util::FloatLatitude(10)),
util::Coordinate(util::FloatLongitude(5), util::FloatLatitude(15)),
util::Coordinate(util::FloatLongitude(5),
util::FloatLatitude(15 + delta_pixel_to_delta_degree(2, z)))};
BOOST_TEST_MESSAGE("Delta (" << z << "): " << delta_pixel_to_delta_degree(2, z));
+4 -2
View File
@@ -36,9 +36,11 @@ BOOST_AUTO_TEST_CASE(decode)
for (unsigned i = 0; i < cmp_coords.size(); ++i)
{
BOOST_CHECK_CLOSE(static_cast<double>(util::toFloating(coords[i].lat)),
static_cast<double>(util::toFloating(cmp_coords[i].lat)), 0.0001);
static_cast<double>(util::toFloating(cmp_coords[i].lat)),
0.0001);
BOOST_CHECK_CLOSE(static_cast<double>(util::toFloating(coords[i].lon)),
static_cast<double>(util::toFloating(cmp_coords[i].lon)), 0.0001);
static_cast<double>(util::toFloating(cmp_coords[i].lon)),
0.0001);
}
}
+4 -4
View File
@@ -1,11 +1,11 @@
#include "engine/guidance/assemble_overview.hpp"
#include "engine/guidance/assemble_geometry.hpp"
#include "engine/guidance/assemble_steps.hpp"
#include "engine/guidance/assemble_route.hpp"
#include "engine/guidance/assemble_leg.hpp"
#include "engine/guidance/assemble_overview.hpp"
#include "engine/guidance/assemble_route.hpp"
#include "engine/guidance/assemble_steps.hpp"
#include <boost/test/unit_test.hpp>
#include <boost/test/test_case_template.hpp>
#include <boost/test/unit_test.hpp>
BOOST_AUTO_TEST_SUITE(guidance_assembly)
@@ -1,8 +1,8 @@
#include "extractor/compressed_edge_container.hpp"
#include "util/typedefs.hpp"
#include <boost/test/unit_test.hpp>
#include <boost/test/test_case_template.hpp>
#include <boost/test/unit_test.hpp>
BOOST_AUTO_TEST_SUITE(compressed_edge_container)
+1 -1
View File
@@ -4,8 +4,8 @@
#include "util/node_based_graph.hpp"
#include "util/typedefs.hpp"
#include <boost/test/unit_test.hpp>
#include <boost/test/test_case_template.hpp>
#include <boost/test/unit_test.hpp>
#include <iostream>
+2 -2
View File
@@ -23,8 +23,8 @@ int normalize(double coord) { return static_cast<int>(coord * COORDINATE_PRECISI
BOOST_AUTO_TEST_CASE(raster_test)
{
SourceContainer sources;
int source_id = sources.LoadRasterSource("../unit_tests/fixtures/raster_data.asc", 0, 0.09, 0,
0.09, 10, 10);
int source_id = sources.LoadRasterSource(
"../unit_tests/fixtures/raster_data.asc", 0, 0.09, 0, 0.09, 10, 10);
BOOST_CHECK_EQUAL(source_id, 0);
// Expected nearest-neighbor queries
+1 -1
View File
@@ -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()
{
+4 -4
View File
@@ -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)
+15 -8
View File
@@ -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>());
}
}
}
+3 -3
View File
@@ -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)
+21 -13
View File
@@ -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());
+6 -4
View File
@@ -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
View File
@@ -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;
}
}
+2 -1
View File
@@ -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)
{
+3 -2
View File
@@ -4,8 +4,8 @@
// implements all data storage when shared memory _IS_ used
#include "contractor/query_edge.hpp"
#include "engine/datafacade/datafacade_base.hpp"
#include "extractor/guidance/turn_instruction.hpp"
#include "engine/datafacade/datafacade_base.hpp"
#include "util/guidance/bearing_class.hpp"
#include "util/guidance/entry_class.hpp"
#include "util/typedefs.hpp"
@@ -177,7 +177,8 @@ class MockDataFacade final : public engine::datafacade::BaseDataFacade
BearingClassID GetBearingClassID(const NodeID /*id*/) const override { return 0; };
EntryClassID GetEntryClassID(const EdgeID /*id*/) const override { return 0; }
util::guidance::BearingClass GetBearingClass(const BearingClassID /*bearing_class_id*/) const override
util::guidance::BearingClass
GetBearingClass(const BearingClassID /*bearing_class_id*/) const override
{
util::guidance::BearingClass result;
result.add(0);
+25 -17
View File
@@ -57,10 +57,11 @@ BOOST_AUTO_TEST_CASE(invalid_route_urls)
BOOST_CHECK_EQUAL(testInvalidOptions<RouteParameters>("1,2;3,4.json?nooptions"), 13);
BOOST_CHECK_EQUAL(testInvalidOptions<RouteParameters>("1,2;3,4..json?nooptions"), 14);
BOOST_CHECK_EQUAL(testInvalidOptions<RouteParameters>("1,2;3,4.0.json?nooptions"), 15);
BOOST_CHECK_EQUAL(testInvalidOptions<RouteParameters>(std::string{"1,2;3,4"} + '\0' + ".json"), 7);
BOOST_CHECK_EQUAL(testInvalidOptions<RouteParameters>(std::string{"1,2;3,4"} + '\0' + ".json"),
7);
BOOST_CHECK_EQUAL(testInvalidOptions<RouteParameters>(std::string{"1,2;3,"} + '\0'), 6);
//BOOST_CHECK_EQUAL(testInvalidOptions<RouteParameters>(), );
// BOOST_CHECK_EQUAL(testInvalidOptions<RouteParameters>(), );
}
BOOST_AUTO_TEST_CASE(invalid_table_urls)
@@ -98,8 +99,9 @@ BOOST_AUTO_TEST_CASE(valid_route_urls)
reference_2.steps = true;
reference_2.annotations = true;
reference_2.coordinates = coords_1;
auto result_2 = parseParameters<RouteParameters>(
"1,2;3,4?steps=true&alternatives=true&geometries=polyline&overview=simplified&annotations=true");
auto result_2 =
parseParameters<RouteParameters>("1,2;3,4?steps=true&alternatives=true&geometries=polyline&"
"overview=simplified&annotations=true");
BOOST_CHECK(result_2);
BOOST_CHECK_EQUAL(reference_2.steps, result_2->steps);
BOOST_CHECK_EQUAL(reference_2.alternatives, result_2->alternatives);
@@ -112,8 +114,12 @@ BOOST_AUTO_TEST_CASE(valid_route_urls)
CHECK_EQUAL_RANGE(reference_2.coordinates, result_2->coordinates);
CHECK_EQUAL_RANGE(reference_2.hints, result_2->hints);
RouteParameters reference_3{false, false, false, RouteParameters::GeometriesType::GeoJSON,
RouteParameters::OverviewType::False, true};
RouteParameters reference_3{false,
false,
false,
RouteParameters::GeometriesType::GeoJSON,
RouteParameters::OverviewType::False,
true};
reference_3.coordinates = coords_1;
auto result_3 = api::parseParameters<engine::api::RouteParameters>(
"1,2;3,4?steps=false&alternatives=false&geometries=geojson&overview=false&continue_"
@@ -215,7 +221,8 @@ BOOST_AUTO_TEST_CASE(valid_route_urls)
auto result_7 = parseParameters<RouteParameters>("1,2;3,4?radiuses=;unlimited");
RouteParameters reference_7{};
reference_7.coordinates = coords_1;
reference_7.radiuses = {boost::none, boost::make_optional(std::numeric_limits<double>::infinity())};
reference_7.radiuses = {boost::none,
boost::make_optional(std::numeric_limits<double>::infinity())};
BOOST_CHECK(result_7);
BOOST_CHECK_EQUAL(reference_7.steps, result_7->steps);
BOOST_CHECK_EQUAL(reference_7.alternatives, result_7->alternatives);
@@ -257,19 +264,20 @@ BOOST_AUTO_TEST_CASE(valid_route_urls)
"IFAAEBl-Umfg=="),
boost::none};
RouteParameters reference_10{false,
false,
false,
RouteParameters::GeometriesType::Polyline,
RouteParameters::OverviewType::Simplified,
boost::optional<bool>{},
coords_3,
hints_10,
std::vector<boost::optional<double>>{},
std::vector<boost::optional<engine::Bearing>>{}};
false,
false,
RouteParameters::GeometriesType::Polyline,
RouteParameters::OverviewType::Simplified,
boost::optional<bool>{},
coords_3,
hints_10,
std::vector<boost::optional<double>>{},
std::vector<boost::optional<engine::Bearing>>{}};
auto result_10 = parseParameters<RouteParameters>(
"1,2;3,4;5,6;7,8?steps=false&hints="
"DAIAgP___38AAAAAAAAAAAIAAAAAAAAAEAAAAOgDAAD0AwAAGwAAAOUacQBQP5sCshpxAB0_mwIAAAEBl-Umfg==;;"
"cgAAgP___39jAAAADgAAACIAAABeAAAAkQAAANoDAABOAgAAGwAAAFVGcQCiRJsCR0VxAOZFmwIFAAEBl-Umfg==;");
"cgAAgP___39jAAAADgAAACIAAABeAAAAkQAAANoDAABOAgAAGwAAAFVGcQCiRJsCR0VxAOZFmwIFAAEBl-Umfg=="
";");
BOOST_CHECK(result_10);
BOOST_CHECK_EQUAL(reference_10.steps, result_10->steps);
BOOST_CHECK_EQUAL(reference_10.alternatives, result_10->alternatives);
+1 -1
View File
@@ -2,8 +2,8 @@
#include "util/typedefs.hpp"
#include <boost/functional/hash.hpp>
#include <boost/test/unit_test.hpp>
#include <boost/test/test_case_template.hpp>
#include <boost/test/unit_test.hpp>
BOOST_AUTO_TEST_SUITE(bearing_test)
+4 -3
View File
@@ -1,9 +1,9 @@
#include "util/binary_heap.hpp"
#include "util/typedefs.hpp"
#include <boost/test/unit_test.hpp>
#include <boost/test/test_case_template.hpp>
#include <boost/mpl/list.hpp>
#include <boost/test/test_case_template.hpp>
#include <boost/test/unit_test.hpp>
#include <algorithm>
#include <limits>
@@ -25,7 +25,8 @@ typedef int TestKey;
typedef int TestWeight;
typedef boost::mpl::list<ArrayStorage<TestNodeID, TestKey>,
MapStorage<TestNodeID, TestKey>,
UnorderedMapStorage<TestNodeID, TestKey>> storage_types;
UnorderedMapStorage<TestNodeID, TestKey>>
storage_types;
template <unsigned NUM_ELEM> struct RandomDataFixture
{
+19 -13
View File
@@ -1,5 +1,5 @@
#include <boost/test/unit_test.hpp>
#include <boost/numeric/conversion/cast.hpp>
#include <boost/test/unit_test.hpp>
#include "util/coordinate_calculation.hpp"
@@ -180,9 +180,11 @@ BOOST_AUTO_TEST_CASE(regression_point_on_segment)
FloatCoordinate diff{target.lon - start.lon, target.lat - start.lat};
BOOST_CHECK_CLOSE(static_cast<double>(start.lon + FloatLongitude(ratio) * diff.lon),
static_cast<double>(nearest.lon), 0.1);
static_cast<double>(nearest.lon),
0.1);
BOOST_CHECK_CLOSE(static_cast<double>(start.lat + FloatLatitude(ratio) * diff.lat),
static_cast<double>(nearest.lat), 0.1);
static_cast<double>(nearest.lat),
0.1);
}
BOOST_AUTO_TEST_CASE(point_on_segment)
@@ -192,9 +194,10 @@ BOOST_AUTO_TEST_CASE(point_on_segment)
// |---- i
// |
// s
auto result_1 = coordinate_calculation::projectPointOnSegment(
{FloatLongitude{0}, FloatLatitude{0}}, {FloatLongitude{0}, FloatLatitude{2}},
{FloatLongitude{2}, FloatLatitude{1}});
auto result_1 =
coordinate_calculation::projectPointOnSegment({FloatLongitude{0}, FloatLatitude{0}},
{FloatLongitude{0}, FloatLatitude{2}},
{FloatLongitude{2}, FloatLatitude{1}});
auto reference_ratio_1 = 0.5;
auto reference_point_1 = FloatCoordinate{FloatLongitude{0}, FloatLatitude{1}};
BOOST_CHECK_EQUAL(result_1.first, reference_ratio_1);
@@ -208,9 +211,10 @@ BOOST_AUTO_TEST_CASE(point_on_segment)
// |
// |
// s
auto result_2 = coordinate_calculation::projectPointOnSegment(
{FloatLongitude{0.}, FloatLatitude{0.}}, {FloatLongitude{0}, FloatLatitude{2}},
{FloatLongitude{0}, FloatLatitude{3}});
auto result_2 =
coordinate_calculation::projectPointOnSegment({FloatLongitude{0.}, FloatLatitude{0.}},
{FloatLongitude{0}, FloatLatitude{2}},
{FloatLongitude{0}, FloatLatitude{3}});
auto reference_ratio_2 = 1.;
auto reference_point_2 = FloatCoordinate{FloatLongitude{0}, FloatLatitude{2}};
BOOST_CHECK_EQUAL(result_2.first, reference_ratio_2);
@@ -224,9 +228,10 @@ BOOST_AUTO_TEST_CASE(point_on_segment)
// s
// :
// i
auto result_3 = coordinate_calculation::projectPointOnSegment(
{FloatLongitude{0.}, FloatLatitude{0.}}, {FloatLongitude{0}, FloatLatitude{2}},
{FloatLongitude{0}, FloatLatitude{-1}});
auto result_3 =
coordinate_calculation::projectPointOnSegment({FloatLongitude{0.}, FloatLatitude{0.}},
{FloatLongitude{0}, FloatLatitude{2}},
{FloatLongitude{0}, FloatLatitude{-1}});
auto reference_ratio_3 = 0.;
auto reference_point_3 = FloatCoordinate{FloatLongitude{0}, FloatLatitude{0}};
BOOST_CHECK_EQUAL(result_3.first, reference_ratio_3);
@@ -240,7 +245,8 @@ BOOST_AUTO_TEST_CASE(point_on_segment)
// s
//
auto result_4 = coordinate_calculation::projectPointOnSegment(
{FloatLongitude{0}, FloatLatitude{0}}, {FloatLongitude{1}, FloatLatitude{1}},
{FloatLongitude{0}, FloatLatitude{0}},
{FloatLongitude{1}, FloatLatitude{1}},
{FloatLongitude{0.5 + 0.1}, FloatLatitude{0.5 - 0.1}});
auto reference_ratio_4 = 0.5;
auto reference_point_4 = FloatCoordinate{FloatLongitude{0.5}, FloatLatitude{0.5}};
+1 -1
View File
@@ -1,7 +1,7 @@
#include "extractor/extraction_helper_functions.hpp"
#include <boost/test/unit_test.hpp>
#include <boost/test/test_case_template.hpp>
#include <boost/test/unit_test.hpp>
BOOST_AUTO_TEST_SUITE(durations_are_valid)
+6 -5
View File
@@ -1,8 +1,8 @@
#include "util/dynamic_graph.hpp"
#include "util/typedefs.hpp"
#include <boost/test/unit_test.hpp>
#include <boost/test/test_case_template.hpp>
#include <boost/test/unit_test.hpp>
#include <vector>
@@ -29,10 +29,11 @@ BOOST_AUTO_TEST_CASE(find_test)
* (3) -3-> (4)
* <-4-
*/
std::vector<TestInputEdge> input_edges = {
TestInputEdge{0, 1, TestData{1}}, TestInputEdge{3, 0, TestData{2}},
TestInputEdge{3, 0, TestData{5}}, TestInputEdge{3, 4, TestData{3}},
TestInputEdge{4, 3, TestData{4}}};
std::vector<TestInputEdge> input_edges = {TestInputEdge{0, 1, TestData{1}},
TestInputEdge{3, 0, TestData{2}},
TestInputEdge{3, 0, TestData{5}},
TestInputEdge{3, 4, TestData{3}},
TestInputEdge{4, 3, TestData{4}}};
TestDynamicGraph simple_graph(5, input_edges);
auto eit = simple_graph.FindEdge(0, 1);
+3 -3
View File
@@ -1,8 +1,8 @@
#include "util/io.hpp"
#include "util/typedefs.hpp"
#include <boost/test/unit_test.hpp>
#include <boost/test/test_case_template.hpp>
#include <boost/test/unit_test.hpp>
#include <string>
@@ -21,8 +21,8 @@ BOOST_AUTO_TEST_CASE(io_flags)
osrm::util::deserializeFlags(IO_TMP_FILE, flags_out);
BOOST_REQUIRE_EQUAL(flags_in.size(), flags_out.size());
BOOST_CHECK_EQUAL_COLLECTIONS(flags_out.begin(), flags_out.end(), flags_in.begin(),
flags_in.end());
BOOST_CHECK_EQUAL_COLLECTIONS(
flags_out.begin(), flags_out.end(), flags_in.begin(), flags_in.end());
}
BOOST_AUTO_TEST_CASE(io_data)
+1 -1
View File
@@ -1,8 +1,8 @@
#include "util/range_table.hpp"
#include "util/typedefs.hpp"
#include <boost/test/unit_test.hpp>
#include <boost/test/test_case_template.hpp>
#include <boost/test/unit_test.hpp>
#include <numeric>
#include <stxxl/vector>
+73 -41
View File
@@ -1,8 +1,8 @@
#include "util/rectangle.hpp"
#include "util/typedefs.hpp"
#include <boost/test/unit_test.hpp>
#include <boost/test/test_case_template.hpp>
#include <boost/test/unit_test.hpp>
BOOST_AUTO_TEST_SUITE(rectangle_test)
@@ -26,14 +26,14 @@ BOOST_AUTO_TEST_CASE(get_min_dist_test)
// |
// +- -80
// |
RectangleInt2D ne{FloatLongitude(10), FloatLongitude(100), FloatLatitude(10),
FloatLatitude(80)};
RectangleInt2D nw{FloatLongitude(-100), FloatLongitude(-10), FloatLatitude(10),
FloatLatitude(80)};
RectangleInt2D se{FloatLongitude(10), FloatLongitude(100), FloatLatitude(-80),
FloatLatitude(-10)};
RectangleInt2D sw{FloatLongitude(-100), FloatLongitude(-10), FloatLatitude(-80),
FloatLatitude(-10)};
RectangleInt2D ne{
FloatLongitude(10), FloatLongitude(100), FloatLatitude(10), FloatLatitude(80)};
RectangleInt2D nw{
FloatLongitude(-100), FloatLongitude(-10), FloatLatitude(10), FloatLatitude(80)};
RectangleInt2D se{
FloatLongitude(10), FloatLongitude(100), FloatLatitude(-80), FloatLatitude(-10)};
RectangleInt2D sw{
FloatLongitude(-100), FloatLongitude(-10), FloatLatitude(-80), FloatLatitude(-10)};
Coordinate nw_sw{FloatLongitude(-100.1), FloatLatitude(9.9)};
Coordinate nw_se{FloatLongitude(-9.9), FloatLatitude(9.9)};
@@ -43,14 +43,22 @@ BOOST_AUTO_TEST_CASE(get_min_dist_test)
Coordinate nw_e{FloatLongitude(-9.9), FloatLatitude(45.0)};
Coordinate nw_w{FloatLongitude(-100.1), FloatLatitude(45.0)};
Coordinate nw_n{FloatLongitude(-55), FloatLatitude(80.1)};
BOOST_CHECK_CLOSE(nw.GetMinSquaredDist(nw_sw), 0.02 * COORDINATE_PRECISION * COORDINATE_PRECISION, 0.1);
BOOST_CHECK_CLOSE(nw.GetMinSquaredDist(nw_se), 0.02 * COORDINATE_PRECISION * COORDINATE_PRECISION, 0.1);
BOOST_CHECK_CLOSE(nw.GetMinSquaredDist(nw_ne), 0.02 * COORDINATE_PRECISION * COORDINATE_PRECISION, 0.1);
BOOST_CHECK_CLOSE(nw.GetMinSquaredDist(nw_nw), 0.02 * COORDINATE_PRECISION * COORDINATE_PRECISION, 0.1);
BOOST_CHECK_CLOSE(nw.GetMinSquaredDist(nw_s), 0.01 * COORDINATE_PRECISION * COORDINATE_PRECISION, 0.1);
BOOST_CHECK_CLOSE(nw.GetMinSquaredDist(nw_e), 0.01 * COORDINATE_PRECISION * COORDINATE_PRECISION, 0.1);
BOOST_CHECK_CLOSE(nw.GetMinSquaredDist(nw_w), 0.01 * COORDINATE_PRECISION * COORDINATE_PRECISION, 0.1);
BOOST_CHECK_CLOSE(nw.GetMinSquaredDist(nw_n), 0.01 * COORDINATE_PRECISION * COORDINATE_PRECISION, 0.1);
BOOST_CHECK_CLOSE(
nw.GetMinSquaredDist(nw_sw), 0.02 * COORDINATE_PRECISION * COORDINATE_PRECISION, 0.1);
BOOST_CHECK_CLOSE(
nw.GetMinSquaredDist(nw_se), 0.02 * COORDINATE_PRECISION * COORDINATE_PRECISION, 0.1);
BOOST_CHECK_CLOSE(
nw.GetMinSquaredDist(nw_ne), 0.02 * COORDINATE_PRECISION * COORDINATE_PRECISION, 0.1);
BOOST_CHECK_CLOSE(
nw.GetMinSquaredDist(nw_nw), 0.02 * COORDINATE_PRECISION * COORDINATE_PRECISION, 0.1);
BOOST_CHECK_CLOSE(
nw.GetMinSquaredDist(nw_s), 0.01 * COORDINATE_PRECISION * COORDINATE_PRECISION, 0.1);
BOOST_CHECK_CLOSE(
nw.GetMinSquaredDist(nw_e), 0.01 * COORDINATE_PRECISION * COORDINATE_PRECISION, 0.1);
BOOST_CHECK_CLOSE(
nw.GetMinSquaredDist(nw_w), 0.01 * COORDINATE_PRECISION * COORDINATE_PRECISION, 0.1);
BOOST_CHECK_CLOSE(
nw.GetMinSquaredDist(nw_n), 0.01 * COORDINATE_PRECISION * COORDINATE_PRECISION, 0.1);
Coordinate ne_sw{FloatLongitude(9.9), FloatLatitude(9.9)};
Coordinate ne_se{FloatLongitude(100.1), FloatLatitude(9.9)};
@@ -60,14 +68,22 @@ BOOST_AUTO_TEST_CASE(get_min_dist_test)
Coordinate ne_e{FloatLongitude(100.1), FloatLatitude(45.0)};
Coordinate ne_w{FloatLongitude(9.9), FloatLatitude(45.0)};
Coordinate ne_n{FloatLongitude(55), FloatLatitude(80.1)};
BOOST_CHECK_CLOSE(ne.GetMinSquaredDist(ne_sw), 0.02 * COORDINATE_PRECISION * COORDINATE_PRECISION, 0.1);
BOOST_CHECK_CLOSE(ne.GetMinSquaredDist(ne_se), 0.02 * COORDINATE_PRECISION * COORDINATE_PRECISION, 0.1);
BOOST_CHECK_CLOSE(ne.GetMinSquaredDist(ne_ne), 0.02 * COORDINATE_PRECISION * COORDINATE_PRECISION, 0.1);
BOOST_CHECK_CLOSE(ne.GetMinSquaredDist(ne_nw), 0.02 * COORDINATE_PRECISION * COORDINATE_PRECISION, 0.1);
BOOST_CHECK_CLOSE(ne.GetMinSquaredDist(ne_s), 0.01 * COORDINATE_PRECISION * COORDINATE_PRECISION, 0.1);
BOOST_CHECK_CLOSE(ne.GetMinSquaredDist(ne_e), 0.01 * COORDINATE_PRECISION * COORDINATE_PRECISION, 0.1);
BOOST_CHECK_CLOSE(ne.GetMinSquaredDist(ne_w), 0.01 * COORDINATE_PRECISION * COORDINATE_PRECISION, 0.1);
BOOST_CHECK_CLOSE(ne.GetMinSquaredDist(ne_n), 0.01 * COORDINATE_PRECISION * COORDINATE_PRECISION, 0.1);
BOOST_CHECK_CLOSE(
ne.GetMinSquaredDist(ne_sw), 0.02 * COORDINATE_PRECISION * COORDINATE_PRECISION, 0.1);
BOOST_CHECK_CLOSE(
ne.GetMinSquaredDist(ne_se), 0.02 * COORDINATE_PRECISION * COORDINATE_PRECISION, 0.1);
BOOST_CHECK_CLOSE(
ne.GetMinSquaredDist(ne_ne), 0.02 * COORDINATE_PRECISION * COORDINATE_PRECISION, 0.1);
BOOST_CHECK_CLOSE(
ne.GetMinSquaredDist(ne_nw), 0.02 * COORDINATE_PRECISION * COORDINATE_PRECISION, 0.1);
BOOST_CHECK_CLOSE(
ne.GetMinSquaredDist(ne_s), 0.01 * COORDINATE_PRECISION * COORDINATE_PRECISION, 0.1);
BOOST_CHECK_CLOSE(
ne.GetMinSquaredDist(ne_e), 0.01 * COORDINATE_PRECISION * COORDINATE_PRECISION, 0.1);
BOOST_CHECK_CLOSE(
ne.GetMinSquaredDist(ne_w), 0.01 * COORDINATE_PRECISION * COORDINATE_PRECISION, 0.1);
BOOST_CHECK_CLOSE(
ne.GetMinSquaredDist(ne_n), 0.01 * COORDINATE_PRECISION * COORDINATE_PRECISION, 0.1);
Coordinate se_ne{FloatLongitude(100.1), FloatLatitude(-9.9)};
Coordinate se_nw{FloatLongitude(9.9), FloatLatitude(-9.9)};
@@ -77,14 +93,22 @@ BOOST_AUTO_TEST_CASE(get_min_dist_test)
Coordinate se_w{FloatLongitude(9.9), FloatLatitude(-45.0)};
Coordinate se_e{FloatLongitude(100.1), FloatLatitude(-45.0)};
Coordinate se_s{FloatLongitude(55), FloatLatitude(-80.1)};
BOOST_CHECK_CLOSE(se.GetMinSquaredDist(se_sw), 0.02 * COORDINATE_PRECISION * COORDINATE_PRECISION, 0.1);
BOOST_CHECK_CLOSE(se.GetMinSquaredDist(se_se), 0.02 * COORDINATE_PRECISION * COORDINATE_PRECISION, 0.1);
BOOST_CHECK_CLOSE(se.GetMinSquaredDist(se_ne), 0.02 * COORDINATE_PRECISION * COORDINATE_PRECISION, 0.1);
BOOST_CHECK_CLOSE(se.GetMinSquaredDist(se_nw), 0.02 * COORDINATE_PRECISION * COORDINATE_PRECISION, 0.1);
BOOST_CHECK_CLOSE(se.GetMinSquaredDist(se_s), 0.01 * COORDINATE_PRECISION * COORDINATE_PRECISION, 0.1);
BOOST_CHECK_CLOSE(se.GetMinSquaredDist(se_e), 0.01 * COORDINATE_PRECISION * COORDINATE_PRECISION, 0.1);
BOOST_CHECK_CLOSE(se.GetMinSquaredDist(se_w), 0.01 * COORDINATE_PRECISION * COORDINATE_PRECISION, 0.1);
BOOST_CHECK_CLOSE(se.GetMinSquaredDist(se_n), 0.01 * COORDINATE_PRECISION * COORDINATE_PRECISION, 0.1);
BOOST_CHECK_CLOSE(
se.GetMinSquaredDist(se_sw), 0.02 * COORDINATE_PRECISION * COORDINATE_PRECISION, 0.1);
BOOST_CHECK_CLOSE(
se.GetMinSquaredDist(se_se), 0.02 * COORDINATE_PRECISION * COORDINATE_PRECISION, 0.1);
BOOST_CHECK_CLOSE(
se.GetMinSquaredDist(se_ne), 0.02 * COORDINATE_PRECISION * COORDINATE_PRECISION, 0.1);
BOOST_CHECK_CLOSE(
se.GetMinSquaredDist(se_nw), 0.02 * COORDINATE_PRECISION * COORDINATE_PRECISION, 0.1);
BOOST_CHECK_CLOSE(
se.GetMinSquaredDist(se_s), 0.01 * COORDINATE_PRECISION * COORDINATE_PRECISION, 0.1);
BOOST_CHECK_CLOSE(
se.GetMinSquaredDist(se_e), 0.01 * COORDINATE_PRECISION * COORDINATE_PRECISION, 0.1);
BOOST_CHECK_CLOSE(
se.GetMinSquaredDist(se_w), 0.01 * COORDINATE_PRECISION * COORDINATE_PRECISION, 0.1);
BOOST_CHECK_CLOSE(
se.GetMinSquaredDist(se_n), 0.01 * COORDINATE_PRECISION * COORDINATE_PRECISION, 0.1);
Coordinate sw_ne{FloatLongitude(-9.9), FloatLatitude(-9.9)};
Coordinate sw_nw{FloatLongitude(-100.1), FloatLatitude(-9.9)};
@@ -94,14 +118,22 @@ BOOST_AUTO_TEST_CASE(get_min_dist_test)
Coordinate sw_w{FloatLongitude(-100.1), FloatLatitude(-45.0)};
Coordinate sw_e{FloatLongitude(-9.9), FloatLatitude(-45.0)};
Coordinate sw_s{FloatLongitude(-55), FloatLatitude(-80.1)};
BOOST_CHECK_CLOSE(sw.GetMinSquaredDist(sw_sw), 0.02 * COORDINATE_PRECISION * COORDINATE_PRECISION, 0.1);
BOOST_CHECK_CLOSE(sw.GetMinSquaredDist(sw_se), 0.02 * COORDINATE_PRECISION * COORDINATE_PRECISION, 0.1);
BOOST_CHECK_CLOSE(sw.GetMinSquaredDist(sw_ne), 0.02 * COORDINATE_PRECISION * COORDINATE_PRECISION, 0.1);
BOOST_CHECK_CLOSE(sw.GetMinSquaredDist(sw_nw), 0.02 * COORDINATE_PRECISION * COORDINATE_PRECISION, 0.1);
BOOST_CHECK_CLOSE(sw.GetMinSquaredDist(sw_s), 0.01 * COORDINATE_PRECISION * COORDINATE_PRECISION, 0.1);
BOOST_CHECK_CLOSE(sw.GetMinSquaredDist(sw_e), 0.01 * COORDINATE_PRECISION * COORDINATE_PRECISION, 0.1);
BOOST_CHECK_CLOSE(sw.GetMinSquaredDist(sw_w), 0.01 * COORDINATE_PRECISION * COORDINATE_PRECISION, 0.1);
BOOST_CHECK_CLOSE(sw.GetMinSquaredDist(sw_n), 0.01 * COORDINATE_PRECISION * COORDINATE_PRECISION, 0.1);
BOOST_CHECK_CLOSE(
sw.GetMinSquaredDist(sw_sw), 0.02 * COORDINATE_PRECISION * COORDINATE_PRECISION, 0.1);
BOOST_CHECK_CLOSE(
sw.GetMinSquaredDist(sw_se), 0.02 * COORDINATE_PRECISION * COORDINATE_PRECISION, 0.1);
BOOST_CHECK_CLOSE(
sw.GetMinSquaredDist(sw_ne), 0.02 * COORDINATE_PRECISION * COORDINATE_PRECISION, 0.1);
BOOST_CHECK_CLOSE(
sw.GetMinSquaredDist(sw_nw), 0.02 * COORDINATE_PRECISION * COORDINATE_PRECISION, 0.1);
BOOST_CHECK_CLOSE(
sw.GetMinSquaredDist(sw_s), 0.01 * COORDINATE_PRECISION * COORDINATE_PRECISION, 0.1);
BOOST_CHECK_CLOSE(
sw.GetMinSquaredDist(sw_e), 0.01 * COORDINATE_PRECISION * COORDINATE_PRECISION, 0.1);
BOOST_CHECK_CLOSE(
sw.GetMinSquaredDist(sw_w), 0.01 * COORDINATE_PRECISION * COORDINATE_PRECISION, 0.1);
BOOST_CHECK_CLOSE(
sw.GetMinSquaredDist(sw_n), 0.01 * COORDINATE_PRECISION * COORDINATE_PRECISION, 0.1);
}
BOOST_AUTO_TEST_SUITE_END()
+6 -5
View File
@@ -1,8 +1,8 @@
#include "util/static_graph.hpp"
#include "util/typedefs.hpp"
#include <boost/test/unit_test.hpp>
#include <boost/test/test_case_template.hpp>
#include <boost/test/unit_test.hpp>
#include <algorithm>
#include <random>
@@ -114,10 +114,11 @@ BOOST_AUTO_TEST_CASE(find_test)
* (3) -3-> (4)
* <-4-
*/
std::vector<TestInputEdge> input_edges = {
TestInputEdge{0, 1, TestData{1}}, TestInputEdge{3, 0, TestData{2}},
TestInputEdge{3, 0, TestData{5}}, TestInputEdge{3, 4, TestData{3}},
TestInputEdge{4, 3, TestData{4}}};
std::vector<TestInputEdge> input_edges = {TestInputEdge{0, 1, TestData{1}},
TestInputEdge{3, 0, TestData{2}},
TestInputEdge{3, 0, TestData{5}},
TestInputEdge{3, 4, TestData{3}},
TestInputEdge{4, 3, TestData{4}}};
TestStaticGraph simple_graph(5, input_edges);
auto eit = simple_graph.FindEdge(0, 1);
+18 -17
View File
@@ -1,10 +1,10 @@
#include "engine/geospatial_query.hpp"
#include "util/static_rtree.hpp"
#include "extractor/edge_based_node.hpp"
#include "engine/geospatial_query.hpp"
#include "util/coordinate.hpp"
#include "util/coordinate_calculation.hpp"
#include "util/exception.hpp"
#include "util/rectangle.hpp"
#include "util/static_rtree.hpp"
#include "util/typedefs.hpp"
#include "mocks/mock_datafacade.hpp"
@@ -52,8 +52,7 @@ static const int32_t WORLD_MAX_LON = 180 * COORDINATE_PRECISION;
template <typename DataT> class LinearSearchNN
{
public:
LinearSearchNN(const std::vector<Coordinate> &coords,
const std::vector<DataT> &edges)
LinearSearchNN(const std::vector<Coordinate> &coords, const std::vector<DataT> &edges)
: coords(coords), edges(edges)
{
}
@@ -77,7 +76,9 @@ template <typename DataT> class LinearSearchNN
return lhs_squared_dist < rhs_squared_dist;
};
std::nth_element(local_edges.begin(), local_edges.begin() + num_results, local_edges.end(),
std::nth_element(local_edges.begin(),
local_edges.begin() + num_results,
local_edges.end(),
segment_comparator);
local_edges.resize(num_results);
@@ -317,8 +318,8 @@ BOOST_AUTO_TEST_CASE(regression_test)
std::string leaves_path;
std::string nodes_path;
build_rtree<GraphFixture, MiniStaticRTree>("test_regression", &fixture, leaves_path,
nodes_path);
build_rtree<GraphFixture, MiniStaticRTree>(
"test_regression", &fixture, leaves_path, nodes_path);
MiniStaticRTree rtree(nodes_path, leaves_path, fixture.coords);
LinearSearchNN<TestData> lsnn(fixture.coords, fixture.edges);
@@ -351,8 +352,8 @@ BOOST_AUTO_TEST_CASE(radius_regression_test)
build_rtree<GraphFixture, MiniStaticRTree>("test_angle", &fixture, leaves_path, nodes_path);
MiniStaticRTree rtree(nodes_path, leaves_path, fixture.coords);
MockDataFacade mockfacade;
engine::GeospatialQuery<MiniStaticRTree, MockDataFacade> query(rtree, fixture.coords,
mockfacade);
engine::GeospatialQuery<MiniStaticRTree, MockDataFacade> query(
rtree, fixture.coords, mockfacade);
Coordinate input(FloatLongitude(5.2), FloatLatitude(5.0));
@@ -378,8 +379,8 @@ BOOST_AUTO_TEST_CASE(bearing_tests)
build_rtree<GraphFixture, MiniStaticRTree>("test_bearing", &fixture, leaves_path, nodes_path);
MiniStaticRTree rtree(nodes_path, leaves_path, fixture.coords);
MockDataFacade mockfacade;
engine::GeospatialQuery<MiniStaticRTree, MockDataFacade> query(rtree, fixture.coords,
mockfacade);
engine::GeospatialQuery<MiniStaticRTree, MockDataFacade> query(
rtree, fixture.coords, mockfacade);
Coordinate input(FloatLongitude(5.1), FloatLatitude(5.0));
@@ -452,19 +453,19 @@ BOOST_AUTO_TEST_CASE(bbox_search_tests)
build_rtree<GraphFixture, MiniStaticRTree>("test_bbox", &fixture, leaves_path, nodes_path);
MiniStaticRTree rtree(nodes_path, leaves_path, fixture.coords);
MockDataFacade mockfacade;
engine::GeospatialQuery<MiniStaticRTree, MockDataFacade> query(rtree, fixture.coords,
mockfacade);
engine::GeospatialQuery<MiniStaticRTree, MockDataFacade> query(
rtree, fixture.coords, mockfacade);
{
RectangleInt2D bbox = {FloatLongitude(0.5), FloatLongitude(1.5), FloatLatitude(0.5),
FloatLatitude(1.5)};
RectangleInt2D bbox = {
FloatLongitude(0.5), FloatLongitude(1.5), FloatLatitude(0.5), FloatLatitude(1.5)};
auto results = query.Search(bbox);
BOOST_CHECK_EQUAL(results.size(), 2);
}
{
RectangleInt2D bbox = {FloatLongitude(1.5), FloatLongitude(3.5), FloatLatitude(1.5),
FloatLatitude(3.5)};
RectangleInt2D bbox = {
FloatLongitude(1.5), FloatLongitude(3.5), FloatLatitude(1.5), FloatLatitude(3.5)};
auto results = query.Search(bbox);
BOOST_CHECK_EQUAL(results.size(), 3);
}
+1 -1
View File
@@ -1,7 +1,7 @@
#include "util/string_util.hpp"
#include <boost/test/unit_test.hpp>
#include <boost/test/test_case_template.hpp>
#include <boost/test/unit_test.hpp>
#include <iostream>
+1 -1
View File
@@ -3,8 +3,8 @@
using namespace osrm::util;
#include <boost/functional/hash.hpp>
#include <boost/test/unit_test.hpp>
#include <boost/test/test_case_template.hpp>
#include <boost/test/unit_test.hpp>
#include <iostream>
+20 -10
View File
@@ -22,16 +22,26 @@ BOOST_AUTO_TEST_CASE(lon_to_pixel)
BOOST_AUTO_TEST_CASE(lat_to_pixel)
{
BOOST_CHECK_CLOSE(web_mercator::latToY(util::FloatLatitude(43.733947)) * web_mercator::DEGREE_TO_PX,
5424361.75863, 0.1);
BOOST_CHECK_CLOSE(web_mercator::latToY(util::FloatLatitude(43.733799)) * web_mercator::DEGREE_TO_PX,
5424338.95731, 0.1);
BOOST_CHECK_CLOSE(web_mercator::latToY(util::FloatLatitude(43.733922)) * web_mercator::DEGREE_TO_PX,
5424357.90705, 0.1);
BOOST_CHECK_CLOSE(web_mercator::latToY(util::FloatLatitude(43.733697)) * web_mercator::DEGREE_TO_PX,
5424323.24293, 0.1);
BOOST_CHECK_CLOSE(web_mercator::latToY(util::FloatLatitude(43.733729)) * web_mercator::DEGREE_TO_PX,
5424328.17293, 0.1);
BOOST_CHECK_CLOSE(web_mercator::latToY(util::FloatLatitude(43.733947)) *
web_mercator::DEGREE_TO_PX,
5424361.75863,
0.1);
BOOST_CHECK_CLOSE(web_mercator::latToY(util::FloatLatitude(43.733799)) *
web_mercator::DEGREE_TO_PX,
5424338.95731,
0.1);
BOOST_CHECK_CLOSE(web_mercator::latToY(util::FloatLatitude(43.733922)) *
web_mercator::DEGREE_TO_PX,
5424357.90705,
0.1);
BOOST_CHECK_CLOSE(web_mercator::latToY(util::FloatLatitude(43.733697)) *
web_mercator::DEGREE_TO_PX,
5424323.24293,
0.1);
BOOST_CHECK_CLOSE(web_mercator::latToY(util::FloatLatitude(43.733729)) *
web_mercator::DEGREE_TO_PX,
5424328.17293,
0.1);
}
BOOST_AUTO_TEST_CASE(xyz_to_wgs84)