Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArsentiy Milchakov <milcars@mapswithme.com>2020-07-27 21:59:59 +0300
committerAlexander Boriskov <polas.okurtis@gmail.com>2020-07-28 13:18:17 +0300
commit4c6160d1abd17409d1c875cac03e9e1663d2d84b (patch)
tree704d0979c8c760d58928fdc1025c003cbf0f1dda /map/map_tests
parent1c0e4af00a7090d67bf579d41fc34d81e384ac35 (diff)
[booking] price formatting is implemented.
Diffstat (limited to 'map/map_tests')
-rw-r--r--map/map_tests/booking_filter_test.cpp59
1 files changed, 56 insertions, 3 deletions
diff --git a/map/map_tests/booking_filter_test.cpp b/map/map_tests/booking_filter_test.cpp
index 30d7964830..c893e81402 100644
--- a/map/map_tests/booking_filter_test.cpp
+++ b/map/map_tests/booking_filter_test.cpp
@@ -5,18 +5,21 @@
#include "map/booking_availability_filter.hpp"
#include "map/booking_filter_processor.hpp"
+#include "map/booking_utils.hpp"
+
+#include "search/result.hpp"
#include "partners_api/booking_api.hpp"
-#include "search/result.hpp"
+#include "storage/country_info_getter.hpp"
#include "indexer/data_source.hpp"
#include "indexer/feature_meta.hpp"
-#include "storage/country_info_getter.hpp"
-
#include "platform/platform.hpp"
+#include "base/string_utils.hpp"
+
#include <algorithm>
#include <memory>
#include <set>
@@ -356,4 +359,54 @@ UNIT_CLASS_TEST(TestMwmEnvironment, BookingFilter_ApplyFilterOntoWithFeatureIds)
TEST(!availabilityExtras.empty(), ());
TEST_EQUAL(availabilityExtras.size(), filteredResults.size(), ());
}
+
+UNIT_TEST(Booking_PriceFormatter)
+{
+ booking::PriceFormatter formatter;
+
+ {
+ auto const result = formatter.Format(1, "USD");
+ TEST(strings::StartsWith(result, "1 "), ());
+ }
+ {
+ auto const result = formatter.Format(12, "USD");
+ TEST(strings::StartsWith(result, "12 "), ());
+ }
+ {
+ auto const result = formatter.Format(123, "USD");
+ TEST(strings::StartsWith(result, "123 "), ());
+ }
+ {
+ auto const result = formatter.Format(1234, "USD");
+ TEST(strings::StartsWith(result, "1,234 "), (result));
+ }
+ {
+ auto const result = formatter.Format(12345, "USD");
+ TEST(strings::StartsWith(result, "12,345 "), (result));
+ }
+ {
+ auto const result = formatter.Format(123456, "USD");
+ TEST(strings::StartsWith(result, "123,456 "), (result));
+ }
+ {
+ auto const result = formatter.Format(1234567, "USD");
+ TEST(strings::StartsWith(result, "1,234,567 "), (result));
+ }
+ {
+ auto const result = formatter.Format(12345678, "USD");
+ TEST(strings::StartsWith(result, "12,345,678 "), (result));
+ }
+ {
+ auto const result = formatter.Format(123456789, "USD");
+ TEST(strings::StartsWith(result, std::string("123,456,") + u8"\u2026" + " "), (result));
+ }
+ {
+ auto const result = formatter.Format(1234567891, "USD");
+ TEST(strings::StartsWith(result, std::string("1,234,56") + u8"\u2026" + " "), (result));
+ }
+ {
+ auto const result = formatter.Format(12345678911, "USD");
+ TEST(strings::StartsWith(result, std::string("12,345,6") + u8"\u2026" + " "), (result));
+ }
+}
} // namespace