mirror of
https://github.com/fastfloat/fast_float.git
synced 2025-12-06 16:56:57 +08:00
fix
This commit is contained in:
parent
9be7de5998
commit
7977ec6054
@ -27,8 +27,12 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
|
||||
auto answer =
|
||||
fast_float::from_chars(input_d.data(), input_d.data() + input_d.size(), result_d, format);
|
||||
std::string input_f = fdp.ConsumeRandomLengthString(128);
|
||||
double result_f = 0.0;
|
||||
float result_f = 0.0;
|
||||
answer =
|
||||
fast_float::from_chars(input_f.data(), input_f.data() + input_f.size(), result_f, format);
|
||||
int result_i = 0;
|
||||
std::string input_i = fdp.ConsumeRandomLengthString(128);
|
||||
answer =
|
||||
fast_float::from_chars(input_i.data(), input_i.data() + input_i.size(), result_i);
|
||||
return 0;
|
||||
}
|
||||
@ -1,4 +1,20 @@
|
||||
#if defined(__cplusplus) && (__cplusplus >= 201703L)
|
||||
#ifndef __cplusplus
|
||||
#error fastfloat requires a C++ compiler
|
||||
#endif
|
||||
|
||||
// We want to enable the tests only for C++17 and above.
|
||||
#ifndef FASTFLOAT_CPLUSPLUS
|
||||
#if defined(_MSVC_LANG) && !defined(__clang__)
|
||||
#define FASTFLOAT_CPLUSPLUS (_MSC_VER == 1900 ? 201103L : _MSVC_LANG)
|
||||
#else
|
||||
#define FASTFLOAT_CPLUSPLUS __cplusplus
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
#if FASTFLOAT_CPLUSPLUS >= 201703L
|
||||
|
||||
|
||||
#include <cstdlib>
|
||||
#include <iostream>
|
||||
#include <vector>
|
||||
@ -744,6 +760,9 @@ int main() {
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
#else
|
||||
#include <iostream>
|
||||
#include <cstdlib>
|
||||
|
||||
int main() {
|
||||
std::cerr << "The test requires C++17." << std::endl;
|
||||
return EXIT_SUCCESS;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user