forked from organicmaps/organicmaps
[routing] Tests on RoadCategoryToSpeed() function.
This commit is contained in:
parent
1164f26da1
commit
298706f18e
2 changed files with 25 additions and 6 deletions
|
@ -119,13 +119,13 @@ std::unordered_map<std::string, Speed> const kRoadCategoryToSpeed = {
|
|||
{"SE:trunk", {90, Units::Metric}},
|
||||
{"SE:motorway", {110, Units::Metric}},
|
||||
|
||||
{"GB:motorway", {70, Units::Imperial}}, // 70 mph = 112.65408 kmph
|
||||
{"GB:nsl_dual", {70, Units::Imperial}}, // 70 mph = 112.65408 kmph
|
||||
{"GB:nsl_single", {60, Units::Imperial}}, // 60 mph = 96.56064 kmph
|
||||
{"GB:motorway", {70, Units::Imperial}}, // 70 mph = 112.65408 kmph
|
||||
{"GB:nsl_dual", {70, Units::Imperial}}, // 70 mph = 112.65408 kmph
|
||||
{"GB:nsl_single", {60, Units::Imperial}}, // 60 mph = 96.56064 kmph
|
||||
|
||||
{"UK:motorway", {70, Units::Imperial}}, // 70 mph
|
||||
{"UK:nsl_dual", {70, Units::Imperial}}, // 70 mph
|
||||
{"UK:nsl_single", {60, Units::Imperial}}, // 60 mph
|
||||
{"UK:motorway", {70, Units::Imperial}}, // 70 mph
|
||||
{"UK:nsl_dual", {70, Units::Imperial}}, // 70 mph
|
||||
{"UK:nsl_single", {60, Units::Imperial}}, // 60 mph
|
||||
|
||||
{"UA:urban", {50, Units::Metric}},
|
||||
{"UA:rural", {90, Units::Metric}},
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
#include "testing/testing.hpp"
|
||||
|
||||
#include "generator/camera_info_collector.hpp"
|
||||
#include "generator/category_to_speed.hpp"
|
||||
#include "generator/emitter_factory.hpp"
|
||||
#include "generator/feature_sorter.hpp"
|
||||
#include "generator/generate_info.hpp"
|
||||
|
@ -16,6 +17,7 @@
|
|||
#include "indexer/map_style_reader.hpp"
|
||||
|
||||
#include "platform/local_country_file.hpp"
|
||||
#include "platform/measurement_utils.hpp"
|
||||
#include "platform/platform.hpp"
|
||||
#include "platform/platform_tests_support/scoped_dir.hpp"
|
||||
#include "platform/platform_tests_support/scoped_file.hpp"
|
||||
|
@ -42,6 +44,7 @@
|
|||
|
||||
using namespace feature;
|
||||
using namespace generator;
|
||||
using namespace measurement_utils;
|
||||
using namespace platform::tests_support;
|
||||
using namespace platform;
|
||||
using namespace routing;
|
||||
|
@ -452,4 +455,20 @@ UNIT_TEST(SpeedCameraGenerationTest_CameraIsNearFeature_2)
|
|||
};
|
||||
TestSpeedCameraSectionBuilding(osmContent, answer);
|
||||
}
|
||||
|
||||
UNIT_TEST(RoadCategoryToSpeedTest)
|
||||
{
|
||||
uint16_t speed = 0;
|
||||
Units units = Units::Metric;
|
||||
|
||||
TEST(RoadCategoryToSpeed("RU:rural", speed, units), ());
|
||||
TEST_EQUAL(speed, 90, ());
|
||||
TEST_EQUAL(units, Units::Metric, ());
|
||||
|
||||
TEST(RoadCategoryToSpeed("UK:motorway", speed, units), ());
|
||||
TEST_EQUAL(speed, 70, ());
|
||||
TEST_EQUAL(units, Units::Imperial, ());
|
||||
|
||||
TEST(!RoadCategoryToSpeed("UNKNOWN:unknown", speed, units), ());
|
||||
}
|
||||
} // namespace
|
||||
|
|
Loading…
Add table
Reference in a new issue