forked from organicmaps/organicmaps
Street names integration test.
This commit is contained in:
parent
406187e731
commit
19d7673519
4 changed files with 81 additions and 0 deletions
59
routing/routing_integration_tests/osrm_street_names_test.cpp
Normal file
59
routing/routing_integration_tests/osrm_street_names_test.cpp
Normal file
|
@ -0,0 +1,59 @@
|
|||
#include "testing/testing.hpp"
|
||||
|
||||
#include "routing/routing_integration_tests/routing_test_tools.hpp"
|
||||
|
||||
#include "routing/route.hpp"
|
||||
|
||||
#include "platform/location.hpp"
|
||||
|
||||
|
||||
using namespace routing;
|
||||
using namespace routing::turns;
|
||||
|
||||
void MoveRoute(Route & route, ms::LatLon const & coords)
|
||||
{
|
||||
location::GpsInfo info;
|
||||
info.m_horizontalAccuracy = 0.01;
|
||||
info.m_verticalAccuracy = 0.01;
|
||||
info.m_longitude = coords.lon;
|
||||
info.m_latitude = coords.lat;
|
||||
route.MoveIterator(info);
|
||||
}
|
||||
|
||||
UNIT_TEST(RussiaTulskayaToPaveletskayaStreetNamesTest)
|
||||
{
|
||||
TRouteResult const routeResult = integration::CalculateRoute(
|
||||
integration::GetOsrmComponents(),
|
||||
MercatorBounds::FromLatLon(55.70839, 37.62145), {0., 0.},
|
||||
MercatorBounds::FromLatLon(55.73198, 37.63945));
|
||||
|
||||
Route & route = *routeResult.first;
|
||||
IRouter::ResultCode const result = routeResult.second;
|
||||
TEST_EQUAL(result, IRouter::NoError, ());
|
||||
|
||||
integration::TestCurrentStreetName(route, "Большая Тульская улица");
|
||||
integration::TestNextStreetName(route, "Подольское шоссе");
|
||||
|
||||
MoveRoute(route, ms::LatLon(55.71398, 37.62443));
|
||||
|
||||
integration::TestCurrentStreetName(route, "Подольское шоссе");
|
||||
integration::TestNextStreetName(route, "Валовая улица");
|
||||
|
||||
|
||||
MoveRoute(route, ms::LatLon(55.72059, 37.62766));
|
||||
|
||||
integration::TestCurrentStreetName(route, "Павловская улица");
|
||||
integration::TestNextStreetName(route, "Валовая улица");
|
||||
|
||||
MoveRoute(route, ms::LatLon(55.72469, 37.62624));
|
||||
|
||||
integration::TestCurrentStreetName(route, "Большая Серпуховская улица");
|
||||
integration::TestNextStreetName(route, "Валовая улица");
|
||||
|
||||
MoveRoute(route, ms::LatLon(55.73034, 37.63099));
|
||||
|
||||
integration::TestCurrentStreetName(route, "Валовая улица");
|
||||
integration::TestNextStreetName(route, "");
|
||||
|
||||
integration::TestRouteLength(route, 3390.);
|
||||
}
|
|
@ -30,6 +30,7 @@ SOURCES += \
|
|||
osrm_turn_test.cpp \
|
||||
pedestrian_route_test.cpp \
|
||||
routing_test_tools.cpp \
|
||||
osrm_street_names_test.cpp \
|
||||
|
||||
HEADERS += \
|
||||
routing_test_tools.hpp \
|
||||
|
|
|
@ -188,6 +188,23 @@ namespace integration
|
|||
TEST_EQUAL(route.GetTurns().size() - 1, expectedTurnCount, ());
|
||||
}
|
||||
|
||||
void TestCurrentStreetName(routing::Route const & route, string const & expectedStreetName)
|
||||
{
|
||||
string streetName;
|
||||
route.GetCurrentStreetName(streetName);
|
||||
TEST_EQUAL(streetName, expectedStreetName, ());
|
||||
}
|
||||
|
||||
void TestNextStreetName(routing::Route const & route, string const & expectedStreetName)
|
||||
{
|
||||
string streetName;
|
||||
double distance;
|
||||
turns::TurnItem turn;
|
||||
TEST(route.GetCurrentTurn(distance, turn), ());
|
||||
route.GetStreetNameAfterIdx(turn.m_index, streetName);
|
||||
TEST_EQUAL(streetName, expectedStreetName, ());
|
||||
}
|
||||
|
||||
void TestRouteLength(Route const & route, double expectedRouteMeters,
|
||||
double relativeError)
|
||||
{
|
||||
|
|
|
@ -144,4 +144,8 @@ unique_ptr<storage::CountryInfoGetter> CreateCountryInfoGetter();
|
|||
/// Extracting appropriate TestTurn if any. If not TestTurn::isValid() returns false.
|
||||
/// inaccuracy is set in meters.
|
||||
TestTurn GetNthTurn(Route const & route, uint32_t turnNumber);
|
||||
|
||||
void TestCurrentStreetName(routing::Route const & route, string const & expectedStreetName);
|
||||
|
||||
void TestNextStreetName(routing::Route const & route, string const & expectedStreetName);
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue