41 const std::string locale_identifier = ConsumeLocaleIdentifier(fuzzed_data_provider);
42 if (!IsAvailableLocale(locale_identifier)) {
45 const char* c_locale = std::setlocale(LC_ALL,
"C");
46 assert(c_locale !=
nullptr);
49 const int64_t random_int64 = fuzzed_data_provider.
ConsumeIntegral<int64_t>();
50 const std::string tostring_without_locale =
util::ToString(random_int64);
51 const std::string strprintf_int_without_locale =
strprintf(
"%d", random_int64);
53 const std::string strprintf_double_without_locale =
strprintf(
"%f", random_double);
55 const char* new_locale = std::setlocale(LC_ALL, locale_identifier.c_str());
56 assert(new_locale !=
nullptr);
58 const std::string tostring_with_locale =
util::ToString(random_int64);
59 assert(tostring_without_locale == tostring_with_locale);
60 const std::string strprintf_int_with_locale =
strprintf(
"%d", random_int64);
61 assert(strprintf_int_without_locale == strprintf_int_with_locale);
62 const std::string strprintf_double_with_locale =
strprintf(
"%f", random_double);
63 assert(strprintf_double_without_locale == strprintf_double_with_locale);
65 const std::locale current_cpp_locale;
66 assert(current_cpp_locale == std::locale::classic());