Provide dummy locations from our fixed monaco dataset
This commit is contained in:
parent
51d153a5f7
commit
82ee08fcaf
29
unit_tests/library/coordinates.hpp
Normal file
29
unit_tests/library/coordinates.hpp
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
#ifndef OSRM_UNIT_TEST_COORDINATES
|
||||||
|
#define OSRM_UNIT_TEST_COORDINATES
|
||||||
|
|
||||||
|
#include "osrm/coordinate.hpp"
|
||||||
|
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
// Somewhere in 2b8dd9343d5e615afc9c67bcc7028a63 Monaco
|
||||||
|
|
||||||
|
// Convenience aliases
|
||||||
|
using Longitude = osrm::util::FloatLongitude;
|
||||||
|
using Latitude = osrm::util::FloatLatitude;
|
||||||
|
using Location = osrm::util::Coordinate;
|
||||||
|
using Locations = std::vector<Location>;
|
||||||
|
|
||||||
|
inline Location get_dummy_location()
|
||||||
|
{
|
||||||
|
return {osrm::util::FloatLongitude{7.437069}, osrm::util::FloatLatitude{43.749249}};
|
||||||
|
}
|
||||||
|
|
||||||
|
inline Locations get_locations_in_small_component()
|
||||||
|
{
|
||||||
|
return {{Longitude{7.437246}, Latitude{43.747225}},
|
||||||
|
{Longitude{7.438023}, Latitude{43.746465}},
|
||||||
|
{Longitude{7.439263}, Latitude{43.746543}},
|
||||||
|
{Longitude{7.438190}, Latitude{43.747560}}};
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
#include "args.hpp"
|
#include "args.hpp"
|
||||||
#include "fixture.hpp"
|
#include "fixture.hpp"
|
||||||
|
#include "coordinates.hpp"
|
||||||
|
|
||||||
#include "osrm/nearest_parameters.hpp"
|
#include "osrm/nearest_parameters.hpp"
|
||||||
|
|
||||||
@ -22,7 +23,7 @@ BOOST_AUTO_TEST_CASE(test_nearest_response)
|
|||||||
using namespace osrm;
|
using namespace osrm;
|
||||||
|
|
||||||
NearestParameters params;
|
NearestParameters params;
|
||||||
params.coordinates.emplace_back(util::FloatLongitude{}, util::FloatLatitude{});
|
params.coordinates.push_back(get_dummy_location());
|
||||||
|
|
||||||
json::Object result;
|
json::Object result;
|
||||||
const auto rc = osrm.Nearest(params, result);
|
const auto rc = osrm.Nearest(params, result);
|
||||||
@ -67,8 +68,8 @@ BOOST_AUTO_TEST_CASE(test_nearest_response_multiple_coordinates)
|
|||||||
using namespace osrm;
|
using namespace osrm;
|
||||||
|
|
||||||
NearestParameters params;
|
NearestParameters params;
|
||||||
params.coordinates.emplace_back(util::FloatLongitude{}, util::FloatLatitude{});
|
params.coordinates.push_back(get_dummy_location());
|
||||||
params.coordinates.emplace_back(util::FloatLongitude{}, util::FloatLatitude{});
|
params.coordinates.push_back(get_dummy_location());
|
||||||
|
|
||||||
json::Object result;
|
json::Object result;
|
||||||
const auto rc = osrm.Nearest(params, result);
|
const auto rc = osrm.Nearest(params, result);
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
#include "args.hpp"
|
#include "args.hpp"
|
||||||
#include "fixture.hpp"
|
#include "fixture.hpp"
|
||||||
|
#include "coordinates.hpp"
|
||||||
|
|
||||||
#include "osrm/route_parameters.hpp"
|
#include "osrm/route_parameters.hpp"
|
||||||
|
|
||||||
@ -22,9 +23,9 @@ BOOST_AUTO_TEST_CASE(test_route_same_coordinates)
|
|||||||
using namespace osrm;
|
using namespace osrm;
|
||||||
|
|
||||||
RouteParameters params;
|
RouteParameters params;
|
||||||
params.coordinates.emplace_back(util::FloatLongitude{}, util::FloatLatitude{});
|
params.coordinates.push_back(get_dummy_location());
|
||||||
params.coordinates.emplace_back(util::FloatLongitude{}, util::FloatLatitude{});
|
params.coordinates.push_back(get_dummy_location());
|
||||||
params.coordinates.emplace_back(util::FloatLongitude{}, util::FloatLatitude{});
|
params.coordinates.push_back(get_dummy_location());
|
||||||
|
|
||||||
json::Object result;
|
json::Object result;
|
||||||
const auto rc = osrm.Route(params, result);
|
const auto rc = osrm.Route(params, result);
|
||||||
@ -47,7 +48,7 @@ BOOST_AUTO_TEST_CASE(test_route_same_coordinates)
|
|||||||
const auto location = waypoint_object.values.at("location").get<json::Array>().values;
|
const auto location = waypoint_object.values.at("location").get<json::Array>().values;
|
||||||
const auto longitude = location[0].get<json::Number>().value;
|
const auto longitude = location[0].get<json::Number>().value;
|
||||||
const auto latitude = location[1].get<json::Number>().value;
|
const auto latitude = location[1].get<json::Number>().value;
|
||||||
BOOST_CHECK(longitude >= 180. && longitude <= -180.);
|
BOOST_CHECK(longitude >= -180. && longitude <= 180.);
|
||||||
BOOST_CHECK(latitude >= -90. && latitude <= 90.);
|
BOOST_CHECK(latitude >= -90. && latitude <= 90.);
|
||||||
|
|
||||||
const auto hint = waypoint_object.values.at("hint").get<json::String>().value;
|
const auto hint = waypoint_object.values.at("hint").get<json::String>().value;
|
||||||
@ -121,7 +122,7 @@ BOOST_AUTO_TEST_CASE(test_route_same_coordinates)
|
|||||||
const auto location = maneuver.at("location").get<json::Array>().values;
|
const auto location = maneuver.at("location").get<json::Array>().values;
|
||||||
const auto longitude = location[0].get<json::Number>().value;
|
const auto longitude = location[0].get<json::Number>().value;
|
||||||
const auto latitude = location[1].get<json::Number>().value;
|
const auto latitude = location[1].get<json::Number>().value;
|
||||||
BOOST_CHECK(longitude >= 180. && longitude <= -180.);
|
BOOST_CHECK(longitude >= -180. && longitude <= 180.);
|
||||||
BOOST_CHECK(latitude >= -90. && latitude <= 90.);
|
BOOST_CHECK(latitude >= -90. && latitude <= 90.);
|
||||||
|
|
||||||
const auto bearing_before = maneuver.at("bearing_before").get<json::Number>().value;
|
const auto bearing_before = maneuver.at("bearing_before").get<json::Number>().value;
|
||||||
|
Loading…
Reference in New Issue
Block a user