diff options
author | Ilya Grechuhin <i.grechuhin@gmail.com> | 2016-07-06 13:49:16 +0300 |
---|---|---|
committer | Ilya Grechuhin <i.grechuhin@gmail.com> | 2016-07-07 14:23:14 +0300 |
commit | f7aafa00e27d85f4d0f2b4c504d9063d392b41f8 (patch) | |
tree | 42a642688dfef0e8dea4d9fc8ebacd185dc75993 /routing/routing_tests | |
parent | aae90b0081d9b38fe2d0d58ee63445a8e58f6462 (diff) |
[omim] Refactored measurement_utils.
Diffstat (limited to 'routing/routing_tests')
-rw-r--r-- | routing/routing_tests/turns_sound_test.cpp | 18 | ||||
-rw-r--r-- | routing/routing_tests/turns_tts_text_tests.cpp | 71 |
2 files changed, 56 insertions, 33 deletions
diff --git a/routing/routing_tests/turns_sound_test.cpp b/routing/routing_tests/turns_sound_test.cpp index f362c9e5cf..b0f7519095 100644 --- a/routing/routing_tests/turns_sound_test.cpp +++ b/routing/routing_tests/turns_sound_test.cpp @@ -26,7 +26,7 @@ UNIT_TEST(TurnNotificationSettingsMetersTest) 25 /* m_minStartBeforeMeters */, 150 /* m_maxStartBeforeMeters */, 170 /* m_minDistToSayNotificationMeters */, {100, 200, 300, 400, 500, 600, 700} /* soundedDistancesUnits */, - ::settings::Metric /* lengthUnits */); + measurement_utils::Units::Metric /* lengthUnits */); TEST(settings.IsValid(), ()); TEST(my::AlmostEqualAbs( @@ -57,7 +57,7 @@ UNIT_TEST(TurnNotificationSettingsFeetTest) 25 /* m_minStartBeforeMeters */, 150 /* m_maxStartBeforeMeters */, 170 /* m_minDistToSayNotificationMeters */, {200, 400, 600, 800, 1000, 1500, 2000} /* soundedDistancesUnits */, - ::settings::Foot /* lengthUnits */); + measurement_utils::Units::Imperial /* lengthUnits */); TEST(settings.IsValid(), ()); TEST(my::AlmostEqualAbs( @@ -76,7 +76,7 @@ UNIT_TEST(TurnNotificationSettingsNotValidTest) 25 /* m_minStartBeforeMeters */, 150 /* m_maxStartBeforeMeters */, 170 /* m_minDistToSayNotificationMeters */, {200, 400, 800, 600, 1000, 1500, 2000} /* soundedDistancesUnits */, - ::settings::Foot /* lengthUnits */); + measurement_utils::Units::Imperial /* lengthUnits */); TEST(!settings1.IsValid(), ()); Settings settings2(20 /* notificationTimeSeconds */, 5000 /* minNotificationDistanceUnits */, @@ -84,7 +84,7 @@ UNIT_TEST(TurnNotificationSettingsNotValidTest) 25 /* m_minStartBeforeMeters */, 150 /* m_maxStartBeforeMeters */, 170 /* m_minDistToSayNotificationMeters */, {200, 400, 600, 800, 1000, 1500, 2000} /* soundedDistancesUnits */, - ::settings::Metric /* lengthUnits */); + measurement_utils::Units::Metric /* lengthUnits */); TEST(!settings2.IsValid(), ()); } @@ -94,7 +94,7 @@ UNIT_TEST(TurnsSoundMetersTest) 100 /* maxStartBeforeMeters */, 100 /* minDistToSayNotificationMeters */); notificationManager.Enable(true); - notificationManager.SetLengthUnits(::settings::Metric); + notificationManager.SetLengthUnits(measurement_utils::Units::Metric); string const engShortJson = "\ {\ @@ -192,7 +192,7 @@ UNIT_TEST(TurnsSoundMetersTwoTurnsTest) 100 /* maxStartBeforeMeters */, 100 /* minDistToSayNotificationMeters */); notificationManager.Enable(true); - notificationManager.SetLengthUnits(::settings::Metric); + notificationManager.SetLengthUnits(measurement_utils::Units::Metric); string const engShortJson = "\ {\ @@ -269,7 +269,7 @@ UNIT_TEST(TurnsSoundFeetTest) 100 /* maxStartBeforeMeters */, 100 /* minDistToSayNotificationMeters */); notificationManager.Enable(true); - notificationManager.SetLengthUnits(::settings::Foot); + notificationManager.SetLengthUnits(measurement_utils::Units::Imperial); string const engShortJson = "\ {\ @@ -352,7 +352,7 @@ UNIT_TEST(TurnsSoundComposedTurnTest) 100 /* maxStartBeforeMeters */, 100 /* minDistToSayNotificationMeters */); notificationManager.Enable(true); - notificationManager.SetLengthUnits(::settings::Metric); + notificationManager.SetLengthUnits(measurement_utils::Units::Metric); string const engShortJson = "\ {\ @@ -429,7 +429,7 @@ UNIT_TEST(TurnsSoundRoundaboutTurnTest) 100 /* maxStartBeforeMeters */, 100 /* minDistToSayNotificationMeters */); notificationManager.Enable(true); - notificationManager.SetLengthUnits(::settings::Metric); + notificationManager.SetLengthUnits(measurement_utils::Units::Metric); string const engShortJson = "\ {\ diff --git a/routing/routing_tests/turns_tts_text_tests.cpp b/routing/routing_tests/turns_tts_text_tests.cpp index a2fbb7d113..dc2d968d6d 100644 --- a/routing/routing_tests/turns_tts_text_tests.cpp +++ b/routing/routing_tests/turns_tts_text_tests.cpp @@ -20,13 +20,17 @@ UNIT_TEST(GetDistanceTextIdMetersTest) { // Notification(uint32_t distanceUnits, uint8_t exitNum, bool useThenInsteadOfDistance, // TurnDirection turnDir, ::Settings::Units lengthUnits) - Notification const notification1(500, 0, false, TurnDirection::TurnRight, ::settings::Metric); + Notification const notification1(500, 0, false, TurnDirection::TurnRight, + measurement_utils::Units::Metric); TEST_EQUAL(GetDistanceTextId(notification1), "in_500_meters", ()); - Notification const notification2(500, 0, true, TurnDirection::TurnRight, ::settings::Metric); + Notification const notification2(500, 0, true, TurnDirection::TurnRight, + measurement_utils::Units::Metric); TEST_EQUAL(GetDistanceTextId(notification2), "then", ()); - Notification const notification3(200, 0, false, TurnDirection::TurnRight, ::settings::Metric); + Notification const notification3(200, 0, false, TurnDirection::TurnRight, + measurement_utils::Units::Metric); TEST_EQUAL(GetDistanceTextId(notification3), "in_200_meters", ()); - Notification const notification4(2000, 0, false, TurnDirection::TurnRight, ::settings::Metric); + Notification const notification4(2000, 0, false, TurnDirection::TurnRight, + measurement_utils::Units::Metric); TEST_EQUAL(GetDistanceTextId(notification4), "in_2_kilometers", ()); } @@ -34,13 +38,17 @@ UNIT_TEST(GetDistanceTextIdFeetTest) { // Notification(uint32_t distanceUnits, uint8_t exitNum, bool useThenInsteadOfDistance, // TurnDirection turnDir, ::Settings::Units lengthUnits) - Notification const notification1(500, 0, false, TurnDirection::TurnRight, ::settings::Foot); + Notification const notification1(500, 0, false, TurnDirection::TurnRight, + measurement_utils::Units::Imperial); TEST_EQUAL(GetDistanceTextId(notification1), "in_500_feet", ()); - Notification const notification2(500, 0, true, TurnDirection::TurnRight, ::settings::Foot); + Notification const notification2(500, 0, true, TurnDirection::TurnRight, + measurement_utils::Units::Imperial); TEST_EQUAL(GetDistanceTextId(notification2), "then", ()); - Notification const notification3(800, 0, false, TurnDirection::TurnRight, ::settings::Foot); + Notification const notification3(800, 0, false, TurnDirection::TurnRight, + measurement_utils::Units::Imperial); TEST_EQUAL(GetDistanceTextId(notification3), "in_800_feet", ()); - Notification const notification4(5000, 0, false, TurnDirection::TurnRight, ::settings::Foot); + Notification const notification4(5000, 0, false, TurnDirection::TurnRight, + measurement_utils::Units::Imperial); TEST_EQUAL(GetDistanceTextId(notification4), "in_5000_feet", ()); } @@ -48,13 +56,17 @@ UNIT_TEST(GetRoundaboutTextIdTest) { // Notification(uint32_t distanceUnits, uint8_t exitNum, bool useThenInsteadOfDistance, // TurnDirection turnDir, ::Settings::Units lengthUnits) - Notification const notification1(500, 0, false, TurnDirection::LeaveRoundAbout, ::settings::Foot); + Notification const notification1(500, 0, false, TurnDirection::LeaveRoundAbout, + measurement_utils::Units::Imperial); TEST_EQUAL(GetRoundaboutTextId(notification1), "leave_the_roundabout", ()); - Notification const notification2(0, 3, true, TurnDirection::LeaveRoundAbout, ::settings::Foot); + Notification const notification2(0, 3, true, TurnDirection::LeaveRoundAbout, + measurement_utils::Units::Imperial); TEST_EQUAL(GetRoundaboutTextId(notification2), "take_the_3_exit", ()); - Notification const notification3(0, 7, true, TurnDirection::LeaveRoundAbout, ::settings::Metric); + Notification const notification3(0, 7, true, TurnDirection::LeaveRoundAbout, + measurement_utils::Units::Metric); TEST_EQUAL(GetRoundaboutTextId(notification3), "take_the_7_exit", ()); - Notification const notification4(0, 15, true, TurnDirection::LeaveRoundAbout, ::settings::Metric); + Notification const notification4(0, 15, true, TurnDirection::LeaveRoundAbout, + measurement_utils::Units::Metric); TEST_EQUAL(GetRoundaboutTextId(notification4), "leave_the_roundabout", ()); } @@ -62,11 +74,14 @@ UNIT_TEST(GetYouArriveTextIdTest) { // Notification(uint32_t distanceUnits, uint8_t exitNum, bool useThenInsteadOfDistance, // TurnDirection turnDir, ::Settings::Units lengthUnits) - Notification const notification1(500, 0, false, TurnDirection::ReachedYourDestination, ::settings::Foot); + Notification const notification1(500, 0, false, TurnDirection::ReachedYourDestination, + measurement_utils::Units::Imperial); TEST_EQUAL(GetYouArriveTextId(notification1), "destination", ()); - Notification const notification2(0, 0, false, TurnDirection::ReachedYourDestination, ::settings::Metric); + Notification const notification2(0, 0, false, TurnDirection::ReachedYourDestination, + measurement_utils::Units::Metric); TEST_EQUAL(GetYouArriveTextId(notification2), "you_have_reached_the_destination", ()); - Notification const notification3(0, 0, true, TurnDirection::ReachedYourDestination, ::settings::Metric); + Notification const notification3(0, 0, true, TurnDirection::ReachedYourDestination, + measurement_utils::Units::Metric); TEST_EQUAL(GetYouArriveTextId(notification3), "destination", ()); } @@ -74,15 +89,20 @@ UNIT_TEST(GetDirectionTextIdTest) { // Notification(uint32_t distanceUnits, uint8_t exitNum, bool useThenInsteadOfDistance, // TurnDirection turnDir, ::Settings::Units lengthUnits) - Notification const notification1(500, 0, false, TurnDirection::TurnRight, ::settings::Foot); + Notification const notification1(500, 0, false, TurnDirection::TurnRight, + measurement_utils::Units::Imperial); TEST_EQUAL(GetDirectionTextId(notification1), "make_a_right_turn", ()); - Notification const notification2(1000, 0, false, TurnDirection::GoStraight, ::settings::Metric); + Notification const notification2(1000, 0, false, TurnDirection::GoStraight, + measurement_utils::Units::Metric); TEST_EQUAL(GetDirectionTextId(notification2), "go_straight", ()); - Notification const notification3(700, 0, false, TurnDirection::UTurnLeft, ::settings::Metric); + Notification const notification3(700, 0, false, TurnDirection::UTurnLeft, + measurement_utils::Units::Metric); TEST_EQUAL(GetDirectionTextId(notification3), "make_a_u_turn", ()); - Notification const notification4(200, 0, false, TurnDirection::ReachedYourDestination, ::settings::Metric); + Notification const notification4(200, 0, false, TurnDirection::ReachedYourDestination, + measurement_utils::Units::Metric); TEST_EQUAL(GetDirectionTextId(notification4), "destination", ()); - Notification const notification5(0, 0, false, TurnDirection::ReachedYourDestination, ::settings::Metric); + Notification const notification5(0, 0, false, TurnDirection::ReachedYourDestination, + measurement_utils::Units::Metric); TEST_EQUAL(GetDirectionTextId(notification5), "you_have_reached_the_destination", ()); } @@ -113,11 +133,14 @@ UNIT_TEST(GetTtsTextTest) GetTtsText getTtsText; // Notification(uint32_t distanceUnits, uint8_t exitNum, bool useThenInsteadOfDistance, // TurnDirection turnDir, Settings::Units lengthUnits) - Notification const notification1(500, 0, false, TurnDirection::TurnRight, ::settings::Metric); - Notification const notification2(300, 0, false, TurnDirection::TurnLeft, ::settings::Metric); + Notification const notification1(500, 0, false, TurnDirection::TurnRight, + measurement_utils::Units::Metric); + Notification const notification2(300, 0, false, TurnDirection::TurnLeft, + measurement_utils::Units::Metric); Notification const notification3(0, 0, false, TurnDirection::ReachedYourDestination, - ::settings::Metric); - Notification const notification4(0, 0, true, TurnDirection::TurnLeft, ::settings::Metric); + measurement_utils::Units::Metric); + Notification const notification4(0, 0, true, TurnDirection::TurnLeft, + measurement_utils::Units::Metric); getTtsText.ForTestingSetLocaleWithJson(engShortJson, "en"); TEST_EQUAL(getTtsText(notification1), "In 500 meters. Make a right turn.", ()); |