/src/simdjson/fuzz/fuzz_minify.cpp
Line | Count | Source |
1 | | #include "simdjson.h" |
2 | | #include "FuzzUtils.h" |
3 | | #include <cstddef> |
4 | | #include <cstdint> |
5 | | #include <string> |
6 | | |
7 | | /* |
8 | | * Minifies by first parsing, then minifying. |
9 | | */ |
10 | 10.9k | extern "C" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) { |
11 | | |
12 | 10.9k | auto begin = as_chars(Data); |
13 | 10.9k | auto end = begin + Size; |
14 | | |
15 | 10.9k | std::string str(begin, end); |
16 | 10.9k | simdjson::dom::parser parser; |
17 | 10.9k | simdjson::dom::element elem; |
18 | 10.9k | auto error = parser.parse(str).get(elem); |
19 | 10.9k | if (error) { return 0; } |
20 | | |
21 | 6.79k | std::string minified=simdjson::minify(elem); |
22 | 6.79k | (void)minified; |
23 | 6.79k | return 0; |
24 | 10.9k | } |