Changeset View
Changeset View
Standalone View
Standalone View
src/test/fuzz/locale.cpp
Show First 20 Lines • Show All 801 Lines • ▼ Show 20 Lines | void test_one_input(const std::vector<uint8_t> &buffer) { | ||||
const bool parseint64_without_locale = | const bool parseint64_without_locale = | ||||
ParseInt64(random_string, &parseint64_out_without_locale); | ParseInt64(random_string, &parseint64_out_without_locale); | ||||
const int64_t atoi64_without_locale = atoi64(random_string); | const int64_t atoi64_without_locale = atoi64(random_string); | ||||
const int atoi_without_locale = atoi(random_string); | const int atoi_without_locale = atoi(random_string); | ||||
const int64_t atoi64c_without_locale = atoi64(random_string.c_str()); | const int64_t atoi64c_without_locale = atoi64(random_string.c_str()); | ||||
const int64_t random_int64 = | const int64_t random_int64 = | ||||
fuzzed_data_provider.ConsumeIntegral<int64_t>(); | fuzzed_data_provider.ConsumeIntegral<int64_t>(); | ||||
const std::string tostring_without_locale = ToString(random_int64); | const std::string tostring_without_locale = ToString(random_int64); | ||||
// The variable `random_int32` is no longer used, but the harness still | |||||
// needs to consume the same data that it did previously to not invalidate | |||||
// existing seeds. | |||||
const int32_t random_int32 = | |||||
fuzzed_data_provider.ConsumeIntegral<int32_t>(); | |||||
(void)random_int32; | |||||
const std::string strprintf_int_without_locale = | const std::string strprintf_int_without_locale = | ||||
strprintf("%d", random_int64); | strprintf("%d", random_int64); | ||||
const double random_double = | const double random_double = | ||||
fuzzed_data_provider.ConsumeFloatingPoint<double>(); | fuzzed_data_provider.ConsumeFloatingPoint<double>(); | ||||
const std::string strprintf_double_without_locale = | const std::string strprintf_double_without_locale = | ||||
strprintf("%f", random_double); | strprintf("%f", random_double); | ||||
const char *new_locale = std::setlocale(LC_ALL, locale_identifier.c_str()); | const char *new_locale = std::setlocale(LC_ALL, locale_identifier.c_str()); | ||||
Show All 33 Lines |