From 4c6160d1abd17409d1c875cac03e9e1663d2d84b Mon Sep 17 00:00:00 2001 From: Arsentiy Milchakov Date: Mon, 27 Jul 2020 21:59:59 +0300 Subject: [booking] price formatting is implemented. --- map/map_tests/booking_filter_test.cpp | 59 +++++++++++++++++++++++++++++++++-- 1 file changed, 56 insertions(+), 3 deletions(-) (limited to 'map/map_tests') 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 #include #include @@ -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 -- cgit v1.2.3