Skip to content

Commit

Permalink
lint
Browse files Browse the repository at this point in the history
  • Loading branch information
lemire committed Aug 14, 2024
1 parent 8f3dae6 commit 5ad6aae
Show file tree
Hide file tree
Showing 45 changed files with 4,497 additions and 2,853 deletions.
Empty file added clang-format-ignore.txt
Empty file.
38 changes: 19 additions & 19 deletions fuzz/from_chars.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4,35 +4,35 @@
#include <system_error>

fast_float::chars_format arbitrary_format(FuzzedDataProvider &fdp) {
using fast_float::chars_format;
switch (fdp.ConsumeIntegralInRange<int>(0,3)) {
case 0:
return chars_format::scientific;
break;
case 1:
return chars_format::fixed;
break;
case 2:
return chars_format::fixed;
break;
}
return chars_format::general;
using fast_float::chars_format;
switch (fdp.ConsumeIntegralInRange<int>(0, 3)) {
case 0:
return chars_format::scientific;
break;
case 1:
return chars_format::fixed;
break;
case 2:
return chars_format::fixed;
break;
}
return chars_format::general;
}

extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
FuzzedDataProvider fdp(data, size);
fast_float::chars_format format = arbitrary_format(fdp);
double result_d = 0.0;
std::string input_d = fdp.ConsumeRandomLengthString(128);
auto answer =
fast_float::from_chars(input_d.data(), input_d.data() + input_d.size(), result_d, format);
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);
float result_f = 0.0;
answer =
fast_float::from_chars(input_f.data(), input_f.data() + input_f.size(), result_f, format);
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);
answer = fast_float::from_chars(input_i.data(),
input_i.data() + input_i.size(), result_i);
return 0;
}
Loading

0 comments on commit 5ad6aae

Please sign in to comment.