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 int32_t parseint32_out_without_locale;
50 const bool parseint32_without_locale =
ParseInt32(random_string, &parseint32_out_without_locale);
51 int64_t parseint64_out_without_locale;
52 const bool parseint64_without_locale =
ParseInt64(random_string, &parseint64_out_without_locale);
53 const int64_t random_int64 = fuzzed_data_provider.
ConsumeIntegral<int64_t>();
54 const std::string tostring_without_locale =
util::ToString(random_int64);
57 const int32_t random_int32 = fuzzed_data_provider.
ConsumeIntegral<int32_t>();
59 const std::string strprintf_int_without_locale =
strprintf(
"%d", random_int64);
61 const std::string strprintf_double_without_locale =
strprintf(
"%f", random_double);
63 const char* new_locale = std::setlocale(LC_ALL, locale_identifier.c_str());
64 assert(new_locale !=
nullptr);
66 int32_t parseint32_out_with_locale;
67 const bool parseint32_with_locale =
ParseInt32(random_string, &parseint32_out_with_locale);
68 assert(parseint32_without_locale == parseint32_with_locale);
69 if (parseint32_without_locale) {
70 assert(parseint32_out_without_locale == parseint32_out_with_locale);
72 int64_t parseint64_out_with_locale;
73 const bool parseint64_with_locale =
ParseInt64(random_string, &parseint64_out_with_locale);
74 assert(parseint64_without_locale == parseint64_with_locale);
75 if (parseint64_without_locale) {
76 assert(parseint64_out_without_locale == parseint64_out_with_locale);
78 const std::string tostring_with_locale =
util::ToString(random_int64);
79 assert(tostring_without_locale == tostring_with_locale);
80 const std::string strprintf_int_with_locale =
strprintf(
"%d", random_int64);
81 assert(strprintf_int_without_locale == strprintf_int_with_locale);
82 const std::string strprintf_double_with_locale =
strprintf(
"%f", random_double);
83 assert(strprintf_double_without_locale == strprintf_double_with_locale);
85 const std::locale current_cpp_locale;
86 assert(current_cpp_locale == std::locale::classic());