/src/simdutf/fuzz/conversion.cpp
Line | Count | Source |
1 | | // this fuzzes the convert_ functions |
2 | | // by Paul Dreik 2024 |
3 | | |
4 | | #include <algorithm> |
5 | | #include <cstddef> |
6 | | #include <cstdint> |
7 | | #include <cstdlib> |
8 | | #include <functional> |
9 | | #include <iomanip> |
10 | | #include <iostream> |
11 | | #include <span> |
12 | | #include <vector> |
13 | | |
14 | | #include "helpers/common.h" |
15 | | #include "helpers/nameof.hpp" |
16 | | |
17 | | #include "simdutf.h" |
18 | | |
19 | | // clang-format off |
20 | | // suppress warnings from attributes when expanding function pointers in |
21 | | // nameof macros |
22 | | #if !defined(SIMDUTF_REGULAR_VISUAL_STUDIO) |
23 | | SIMDUTF_DISABLE_GCC_WARNING(-Wignored-attributes); |
24 | | #endif |
25 | | //clang-format on |
26 | | |
27 | | |
28 | | // these knobs tweak how the fuzzer works |
29 | | constexpr bool allow_implementations_to_differ = false; |
30 | | constexpr bool use_canary_in_output = true; |
31 | | constexpr bool use_separate_allocation = true; |
32 | | |
33 | | enum class UtfEncodings { UTF16BE, UTF16LE, UTF8, UTF32, LATIN1 }; |
34 | | |
35 | | template <UtfEncodings encoding> struct ValidationFunctionTrait {}; |
36 | | |
37 | | template <> struct ValidationFunctionTrait<UtfEncodings::UTF16BE> { |
38 | | static inline auto Validation = &simdutf::implementation::validate_utf16be; |
39 | | static inline auto ValidationWithErrors = |
40 | | &simdutf::implementation::validate_utf16be_with_errors; |
41 | | static inline std::string ValidationWithErrorsName{ |
42 | | NAMEOF(&simdutf::implementation::validate_utf16be_with_errors)}; |
43 | | static inline std::string ValidationName{ |
44 | | NAMEOF(&simdutf::implementation::validate_utf16be)}; |
45 | | using RawType = char16_t; |
46 | | }; |
47 | | template <> struct ValidationFunctionTrait<UtfEncodings::UTF16LE> { |
48 | | static inline auto Validation = &simdutf::implementation::validate_utf16le; |
49 | | static inline auto ValidationWithErrors = |
50 | | &simdutf::implementation::validate_utf16le_with_errors; |
51 | | static inline std::string ValidationWithErrorsName{ |
52 | | NAMEOF(&simdutf::implementation::validate_utf16le_with_errors)}; |
53 | | static inline std::string ValidationName{ |
54 | | NAMEOF(&simdutf::implementation::validate_utf16le)}; |
55 | | using RawType = char16_t; |
56 | | }; |
57 | | template <> struct ValidationFunctionTrait<UtfEncodings::UTF32> { |
58 | | static inline auto Validation = &simdutf::implementation::validate_utf32; |
59 | | static inline auto ValidationWithErrors = |
60 | | &simdutf::implementation::validate_utf32_with_errors; |
61 | | static inline std::string ValidationWithErrorsName{ |
62 | | NAMEOF(&simdutf::implementation::validate_utf32_with_errors)}; |
63 | | static inline std::string ValidationName{ |
64 | | NAMEOF(&simdutf::implementation::validate_utf32)}; |
65 | | using RawType = char32_t; |
66 | | }; |
67 | | template <> struct ValidationFunctionTrait<UtfEncodings::UTF8> { |
68 | | static inline auto Validation = &simdutf::implementation::validate_utf8; |
69 | | static inline auto ValidationWithErrors = |
70 | | &simdutf::implementation::validate_utf8_with_errors; |
71 | | static inline std::string ValidationWithErrorsName{ |
72 | | NAMEOF(&simdutf::implementation::validate_utf8_with_errors)}; |
73 | | static inline std::string ValidationName{ |
74 | | NAMEOF(&simdutf::implementation::validate_utf8)}; |
75 | | using RawType = char; |
76 | | }; |
77 | | template <> struct ValidationFunctionTrait<UtfEncodings::LATIN1> { |
78 | | // note - there are no validation functions for latin1, all input is valid. |
79 | | using RawType = char; |
80 | | }; |
81 | | |
82 | 0 | constexpr std::string_view nameoftype(char) { return "char"; } |
83 | 0 | constexpr std::string_view nameoftype(char16_t) { return "char16_t"; } |
84 | 0 | constexpr std::string_view nameoftype(char32_t) { return "char32_t"; } |
85 | | |
86 | | /// given the name of a conversion function, return the enum describing the |
87 | | /// *from* type. must be a macro because of string view not being sufficiently |
88 | | /// constexpr. |
89 | | #define ENCODING_FROM_CONVERSION_NAME(x) \ |
90 | | []() { \ |
91 | | using sv = std::string_view; \ |
92 | | using enum UtfEncodings; \ |
93 | | if constexpr (sv{NAMEOF(x)}.find("utf16be_to") != sv::npos) { \ |
94 | | return UTF16BE; \ |
95 | | } else if constexpr (sv{NAMEOF(x)}.find("utf16le_to") != sv::npos) { \ |
96 | | return UTF16LE; \ |
97 | | } else if constexpr (sv{NAMEOF(x)}.find("utf32_to") != sv::npos) { \ |
98 | | return UTF32; \ |
99 | | } else if constexpr (sv{NAMEOF(x)}.find("utf8_to") != sv::npos) { \ |
100 | | return UTF8; \ |
101 | | } else if constexpr (sv{NAMEOF(x)}.find("latin1_to") != sv::npos) { \ |
102 | | return LATIN1; \ |
103 | | } else { \ |
104 | | throw "oops"; \ |
105 | | } \ |
106 | | }() |
107 | | |
108 | | /// given the name of a conversion function, return the enum describing the |
109 | | /// *to* type. must be a macro because of string view not being sufficiently |
110 | | /// constexpr. |
111 | | #define ENCODING_TO_CONVERSION_NAME(x) \ |
112 | | []() { \ |
113 | | using sv = std::string_view; \ |
114 | | using enum UtfEncodings; \ |
115 | | if constexpr (sv{NAMEOF(x)}.find("to_utf16be") != sv::npos) { \ |
116 | | return UTF16BE; \ |
117 | | } else if constexpr (sv{NAMEOF(x)}.find("to_utf16le") != sv::npos) { \ |
118 | | return UTF16LE; \ |
119 | | } else if constexpr (sv{NAMEOF(x)}.find("to_utf32") != sv::npos) { \ |
120 | | return UTF32; \ |
121 | | } else if constexpr (sv{NAMEOF(x)}.find("to_utf8") != sv::npos) { \ |
122 | | return UTF8; \ |
123 | | } else if constexpr (sv{NAMEOF(x)}.find("to_latin1") != sv::npos) { \ |
124 | | return LATIN1; \ |
125 | | } else { \ |
126 | | throw "oops"; \ |
127 | | } \ |
128 | | }() |
129 | | |
130 | | template <typename R> struct result { |
131 | | R retval{}; |
132 | | std::string outputhash; |
133 | | auto operator<=>(const result<R>&) const = default; |
134 | | }; |
135 | | |
136 | | template <typename R> |
137 | 0 | std::ostream& operator<<(std::ostream& os, const result<R>& r) { |
138 | 0 | os << "[retval=" << r.retval << ", output hash=" << r.outputhash << "]"; |
139 | 0 | return os; |
140 | 0 | } Unexecuted instantiation: std::__1::basic_ostream<char, std::__1::char_traits<char> >& operator<< <unsigned long>(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, result<unsigned long> const&) Unexecuted instantiation: std::__1::basic_ostream<char, std::__1::char_traits<char> >& operator<< <simdutf::result>(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, result<simdutf::result> const&) |
141 | | |
142 | | template <UtfEncodings From, UtfEncodings To, |
143 | | member_function_pointer LengthFunction, |
144 | | member_function_pointer ConversionFunction> |
145 | | struct Conversion { |
146 | | LengthFunction lengthcalc; |
147 | | ConversionFunction conversion; |
148 | | std::string lengthcalcname; |
149 | | std::string name; |
150 | | |
151 | | using FromType = ValidationFunctionTrait<From>::RawType; |
152 | | using ToType = ValidationFunctionTrait<To>::RawType; |
153 | | |
154 | | using FromSpan = std::span<const FromType>; |
155 | | |
156 | | using ConversionResult = |
157 | | std::invoke_result<ConversionFunction, const simdutf::implementation*, |
158 | | const FromType*, std::size_t, ToType*>::type; |
159 | | |
160 | | struct validation_result { |
161 | | bool valid{}; |
162 | | bool implementations_agree{}; |
163 | | }; |
164 | | |
165 | | struct length_result { |
166 | | std::vector<std::size_t> length{}; |
167 | | bool implementations_agree{}; |
168 | | }; |
169 | | |
170 | | struct conversion_result { |
171 | | std::size_t written{}; |
172 | | bool implementations_agree{}; |
173 | | }; |
174 | | |
175 | 8.57k | void fuzz(std::span<const char> chardata) const { |
176 | | // assume the input is aligned to FromType |
177 | 8.57k | const FromSpan from{reinterpret_cast<const FromType*>(chardata.data()), |
178 | 8.57k | chardata.size() / sizeof(FromType)}; |
179 | | |
180 | 8.57k | static const bool do_print_testcase = |
181 | 8.57k | std::getenv("PRINT_FUZZ_CASE") != nullptr; |
182 | | |
183 | 8.57k | if (do_print_testcase) { |
184 | 0 | dump_testcase(from, std::cerr); |
185 | 0 | std::exit(EXIT_SUCCESS); |
186 | 0 | } |
187 | | |
188 | 8.57k | do { |
189 | | // step 0 - is the input valid? |
190 | 8.57k | const auto [inputisvalid, valid_input_agree] = verify_valid_input(from); |
191 | 8.57k | if (!valid_input_agree && !allow_implementations_to_differ) |
192 | 0 | break; |
193 | | |
194 | | // step 1 - count the input (only makes sense for some of the encodings) |
195 | | if constexpr (From == UtfEncodings::UTF16BE || |
196 | | From == UtfEncodings::UTF16LE || |
197 | 5.76k | From == UtfEncodings::UTF8) { |
198 | 5.76k | if (!count_the_input(from) && !allow_implementations_to_differ) |
199 | 0 | break; |
200 | 5.76k | } |
201 | | |
202 | | // step 2 - what is the required size of the output? |
203 | 5.76k | const auto [output_length, length_agree] = |
204 | 8.57k | calculate_length(from, inputisvalid); |
205 | 8.57k | if (!length_agree && !allow_implementations_to_differ) |
206 | 0 | break; |
207 | | |
208 | 8.57k | if (!inputisvalid && name.find("valid") != std::string::npos) { |
209 | | // don't run the conversion step, it requires valid input |
210 | 101 | return; |
211 | 101 | } |
212 | | |
213 | | // step 3 - run the conversion |
214 | 8.47k | const auto [written, outputs_agree] = |
215 | 8.47k | do_conversion(from, output_length, inputisvalid); |
216 | 8.47k | if (!outputs_agree && !allow_implementations_to_differ) |
217 | 0 | break; |
218 | | |
219 | | // coming this far means no problems were found |
220 | 8.47k | return; |
221 | 8.47k | } while (0); |
222 | | // if we come here, something failed |
223 | 0 | std::cerr << "something failed, rerun with PRINT_FUZZ_CASE set to print a " |
224 | 0 | "reproducer to stderr\n"; |
225 | 0 | std::abort(); |
226 | 8.57k | } Conversion<(UtfEncodings)0, (UtfEncodings)3, unsigned long (simdutf::implementation::*)(char16_t const*, unsigned long) noexcept const, unsigned long (simdutf::implementation::*)(char16_t const*, unsigned long, char32_t*) noexcept const>::fuzz(std::__1::span<char const, 18446744073709551615ul>) const Line | Count | Source | 175 | 201 | void fuzz(std::span<const char> chardata) const { | 176 | | // assume the input is aligned to FromType | 177 | 201 | const FromSpan from{reinterpret_cast<const FromType*>(chardata.data()), | 178 | 201 | chardata.size() / sizeof(FromType)}; | 179 | | | 180 | 201 | static const bool do_print_testcase = | 181 | 201 | std::getenv("PRINT_FUZZ_CASE") != nullptr; | 182 | | | 183 | 201 | if (do_print_testcase) { | 184 | 0 | dump_testcase(from, std::cerr); | 185 | 0 | std::exit(EXIT_SUCCESS); | 186 | 0 | } | 187 | | | 188 | 201 | do { | 189 | | // step 0 - is the input valid? | 190 | 201 | const auto [inputisvalid, valid_input_agree] = verify_valid_input(from); | 191 | 201 | if (!valid_input_agree && !allow_implementations_to_differ) | 192 | 0 | break; | 193 | | | 194 | | // step 1 - count the input (only makes sense for some of the encodings) | 195 | | if constexpr (From == UtfEncodings::UTF16BE || | 196 | | From == UtfEncodings::UTF16LE || | 197 | 201 | From == UtfEncodings::UTF8) { | 198 | 201 | if (!count_the_input(from) && !allow_implementations_to_differ) | 199 | 0 | break; | 200 | 201 | } | 201 | | | 202 | | // step 2 - what is the required size of the output? | 203 | 201 | const auto [output_length, length_agree] = | 204 | 201 | calculate_length(from, inputisvalid); | 205 | 201 | if (!length_agree && !allow_implementations_to_differ) | 206 | 0 | break; | 207 | | | 208 | 201 | if (!inputisvalid && name.find("valid") != std::string::npos) { | 209 | | // don't run the conversion step, it requires valid input | 210 | 18 | return; | 211 | 18 | } | 212 | | | 213 | | // step 3 - run the conversion | 214 | 183 | const auto [written, outputs_agree] = | 215 | 183 | do_conversion(from, output_length, inputisvalid); | 216 | 183 | if (!outputs_agree && !allow_implementations_to_differ) | 217 | 0 | break; | 218 | | | 219 | | // coming this far means no problems were found | 220 | 183 | return; | 221 | 183 | } while (0); | 222 | | // if we come here, something failed | 223 | 0 | std::cerr << "something failed, rerun with PRINT_FUZZ_CASE set to print a " | 224 | 0 | "reproducer to stderr\n"; | 225 | 0 | std::abort(); | 226 | 201 | } |
Conversion<(UtfEncodings)0, (UtfEncodings)2, unsigned long (simdutf::implementation::*)(char16_t const*, unsigned long) noexcept const, unsigned long (simdutf::implementation::*)(char16_t const*, unsigned long, char*) noexcept const>::fuzz(std::__1::span<char const, 18446744073709551615ul>) const Line | Count | Source | 175 | 403 | void fuzz(std::span<const char> chardata) const { | 176 | | // assume the input is aligned to FromType | 177 | 403 | const FromSpan from{reinterpret_cast<const FromType*>(chardata.data()), | 178 | 403 | chardata.size() / sizeof(FromType)}; | 179 | | | 180 | 403 | static const bool do_print_testcase = | 181 | 403 | std::getenv("PRINT_FUZZ_CASE") != nullptr; | 182 | | | 183 | 403 | if (do_print_testcase) { | 184 | 0 | dump_testcase(from, std::cerr); | 185 | 0 | std::exit(EXIT_SUCCESS); | 186 | 0 | } | 187 | | | 188 | 403 | do { | 189 | | // step 0 - is the input valid? | 190 | 403 | const auto [inputisvalid, valid_input_agree] = verify_valid_input(from); | 191 | 403 | if (!valid_input_agree && !allow_implementations_to_differ) | 192 | 0 | break; | 193 | | | 194 | | // step 1 - count the input (only makes sense for some of the encodings) | 195 | | if constexpr (From == UtfEncodings::UTF16BE || | 196 | | From == UtfEncodings::UTF16LE || | 197 | 403 | From == UtfEncodings::UTF8) { | 198 | 403 | if (!count_the_input(from) && !allow_implementations_to_differ) | 199 | 0 | break; | 200 | 403 | } | 201 | | | 202 | | // step 2 - what is the required size of the output? | 203 | 403 | const auto [output_length, length_agree] = | 204 | 403 | calculate_length(from, inputisvalid); | 205 | 403 | if (!length_agree && !allow_implementations_to_differ) | 206 | 0 | break; | 207 | | | 208 | 403 | if (!inputisvalid && name.find("valid") != std::string::npos) { | 209 | | // don't run the conversion step, it requires valid input | 210 | 19 | return; | 211 | 19 | } | 212 | | | 213 | | // step 3 - run the conversion | 214 | 384 | const auto [written, outputs_agree] = | 215 | 384 | do_conversion(from, output_length, inputisvalid); | 216 | 384 | if (!outputs_agree && !allow_implementations_to_differ) | 217 | 0 | break; | 218 | | | 219 | | // coming this far means no problems were found | 220 | 384 | return; | 221 | 384 | } while (0); | 222 | | // if we come here, something failed | 223 | 0 | std::cerr << "something failed, rerun with PRINT_FUZZ_CASE set to print a " | 224 | 0 | "reproducer to stderr\n"; | 225 | 0 | std::abort(); | 226 | 403 | } |
Conversion<(UtfEncodings)1, (UtfEncodings)3, unsigned long (simdutf::implementation::*)(char16_t const*, unsigned long) noexcept const, unsigned long (simdutf::implementation::*)(char16_t const*, unsigned long, char32_t*) noexcept const>::fuzz(std::__1::span<char const, 18446744073709551615ul>) const Line | Count | Source | 175 | 197 | void fuzz(std::span<const char> chardata) const { | 176 | | // assume the input is aligned to FromType | 177 | 197 | const FromSpan from{reinterpret_cast<const FromType*>(chardata.data()), | 178 | 197 | chardata.size() / sizeof(FromType)}; | 179 | | | 180 | 197 | static const bool do_print_testcase = | 181 | 197 | std::getenv("PRINT_FUZZ_CASE") != nullptr; | 182 | | | 183 | 197 | if (do_print_testcase) { | 184 | 0 | dump_testcase(from, std::cerr); | 185 | 0 | std::exit(EXIT_SUCCESS); | 186 | 0 | } | 187 | | | 188 | 197 | do { | 189 | | // step 0 - is the input valid? | 190 | 197 | const auto [inputisvalid, valid_input_agree] = verify_valid_input(from); | 191 | 197 | if (!valid_input_agree && !allow_implementations_to_differ) | 192 | 0 | break; | 193 | | | 194 | | // step 1 - count the input (only makes sense for some of the encodings) | 195 | | if constexpr (From == UtfEncodings::UTF16BE || | 196 | | From == UtfEncodings::UTF16LE || | 197 | 197 | From == UtfEncodings::UTF8) { | 198 | 197 | if (!count_the_input(from) && !allow_implementations_to_differ) | 199 | 0 | break; | 200 | 197 | } | 201 | | | 202 | | // step 2 - what is the required size of the output? | 203 | 197 | const auto [output_length, length_agree] = | 204 | 197 | calculate_length(from, inputisvalid); | 205 | 197 | if (!length_agree && !allow_implementations_to_differ) | 206 | 0 | break; | 207 | | | 208 | 197 | if (!inputisvalid && name.find("valid") != std::string::npos) { | 209 | | // don't run the conversion step, it requires valid input | 210 | 5 | return; | 211 | 5 | } | 212 | | | 213 | | // step 3 - run the conversion | 214 | 192 | const auto [written, outputs_agree] = | 215 | 192 | do_conversion(from, output_length, inputisvalid); | 216 | 192 | if (!outputs_agree && !allow_implementations_to_differ) | 217 | 0 | break; | 218 | | | 219 | | // coming this far means no problems were found | 220 | 192 | return; | 221 | 192 | } while (0); | 222 | | // if we come here, something failed | 223 | 0 | std::cerr << "something failed, rerun with PRINT_FUZZ_CASE set to print a " | 224 | 0 | "reproducer to stderr\n"; | 225 | 0 | std::abort(); | 226 | 197 | } |
Conversion<(UtfEncodings)1, (UtfEncodings)2, unsigned long (simdutf::implementation::*)(char16_t const*, unsigned long) noexcept const, unsigned long (simdutf::implementation::*)(char16_t const*, unsigned long, char*) noexcept const>::fuzz(std::__1::span<char const, 18446744073709551615ul>) const Line | Count | Source | 175 | 412 | void fuzz(std::span<const char> chardata) const { | 176 | | // assume the input is aligned to FromType | 177 | 412 | const FromSpan from{reinterpret_cast<const FromType*>(chardata.data()), | 178 | 412 | chardata.size() / sizeof(FromType)}; | 179 | | | 180 | 412 | static const bool do_print_testcase = | 181 | 412 | std::getenv("PRINT_FUZZ_CASE") != nullptr; | 182 | | | 183 | 412 | if (do_print_testcase) { | 184 | 0 | dump_testcase(from, std::cerr); | 185 | 0 | std::exit(EXIT_SUCCESS); | 186 | 0 | } | 187 | | | 188 | 412 | do { | 189 | | // step 0 - is the input valid? | 190 | 412 | const auto [inputisvalid, valid_input_agree] = verify_valid_input(from); | 191 | 412 | if (!valid_input_agree && !allow_implementations_to_differ) | 192 | 0 | break; | 193 | | | 194 | | // step 1 - count the input (only makes sense for some of the encodings) | 195 | | if constexpr (From == UtfEncodings::UTF16BE || | 196 | | From == UtfEncodings::UTF16LE || | 197 | 412 | From == UtfEncodings::UTF8) { | 198 | 412 | if (!count_the_input(from) && !allow_implementations_to_differ) | 199 | 0 | break; | 200 | 412 | } | 201 | | | 202 | | // step 2 - what is the required size of the output? | 203 | 412 | const auto [output_length, length_agree] = | 204 | 412 | calculate_length(from, inputisvalid); | 205 | 412 | if (!length_agree && !allow_implementations_to_differ) | 206 | 0 | break; | 207 | | | 208 | 412 | if (!inputisvalid && name.find("valid") != std::string::npos) { | 209 | | // don't run the conversion step, it requires valid input | 210 | 11 | return; | 211 | 11 | } | 212 | | | 213 | | // step 3 - run the conversion | 214 | 401 | const auto [written, outputs_agree] = | 215 | 401 | do_conversion(from, output_length, inputisvalid); | 216 | 401 | if (!outputs_agree && !allow_implementations_to_differ) | 217 | 0 | break; | 218 | | | 219 | | // coming this far means no problems were found | 220 | 401 | return; | 221 | 401 | } while (0); | 222 | | // if we come here, something failed | 223 | 0 | std::cerr << "something failed, rerun with PRINT_FUZZ_CASE set to print a " | 224 | 0 | "reproducer to stderr\n"; | 225 | 0 | std::abort(); | 226 | 412 | } |
Conversion<(UtfEncodings)3, (UtfEncodings)0, unsigned long (simdutf::implementation::*)(char32_t const*, unsigned long) noexcept const, unsigned long (simdutf::implementation::*)(char32_t const*, unsigned long, char16_t*) noexcept const>::fuzz(std::__1::span<char const, 18446744073709551615ul>) const Line | Count | Source | 175 | 268 | void fuzz(std::span<const char> chardata) const { | 176 | | // assume the input is aligned to FromType | 177 | 268 | const FromSpan from{reinterpret_cast<const FromType*>(chardata.data()), | 178 | 268 | chardata.size() / sizeof(FromType)}; | 179 | | | 180 | 268 | static const bool do_print_testcase = | 181 | 268 | std::getenv("PRINT_FUZZ_CASE") != nullptr; | 182 | | | 183 | 268 | if (do_print_testcase) { | 184 | 0 | dump_testcase(from, std::cerr); | 185 | 0 | std::exit(EXIT_SUCCESS); | 186 | 0 | } | 187 | | | 188 | 268 | do { | 189 | | // step 0 - is the input valid? | 190 | 268 | const auto [inputisvalid, valid_input_agree] = verify_valid_input(from); | 191 | 268 | if (!valid_input_agree && !allow_implementations_to_differ) | 192 | 0 | break; | 193 | | | 194 | | // step 1 - count the input (only makes sense for some of the encodings) | 195 | | if constexpr (From == UtfEncodings::UTF16BE || | 196 | | From == UtfEncodings::UTF16LE || | 197 | | From == UtfEncodings::UTF8) { | 198 | | if (!count_the_input(from) && !allow_implementations_to_differ) | 199 | | break; | 200 | | } | 201 | | | 202 | | // step 2 - what is the required size of the output? | 203 | 268 | const auto [output_length, length_agree] = | 204 | 268 | calculate_length(from, inputisvalid); | 205 | 268 | if (!length_agree && !allow_implementations_to_differ) | 206 | 0 | break; | 207 | | | 208 | 268 | if (!inputisvalid && name.find("valid") != std::string::npos) { | 209 | | // don't run the conversion step, it requires valid input | 210 | 4 | return; | 211 | 4 | } | 212 | | | 213 | | // step 3 - run the conversion | 214 | 264 | const auto [written, outputs_agree] = | 215 | 264 | do_conversion(from, output_length, inputisvalid); | 216 | 264 | if (!outputs_agree && !allow_implementations_to_differ) | 217 | 0 | break; | 218 | | | 219 | | // coming this far means no problems were found | 220 | 264 | return; | 221 | 264 | } while (0); | 222 | | // if we come here, something failed | 223 | 0 | std::cerr << "something failed, rerun with PRINT_FUZZ_CASE set to print a " | 224 | 0 | "reproducer to stderr\n"; | 225 | 0 | std::abort(); | 226 | 268 | } |
Conversion<(UtfEncodings)3, (UtfEncodings)1, unsigned long (simdutf::implementation::*)(char32_t const*, unsigned long) noexcept const, unsigned long (simdutf::implementation::*)(char32_t const*, unsigned long, char16_t*) noexcept const>::fuzz(std::__1::span<char const, 18446744073709551615ul>) const Line | Count | Source | 175 | 366 | void fuzz(std::span<const char> chardata) const { | 176 | | // assume the input is aligned to FromType | 177 | 366 | const FromSpan from{reinterpret_cast<const FromType*>(chardata.data()), | 178 | 366 | chardata.size() / sizeof(FromType)}; | 179 | | | 180 | 366 | static const bool do_print_testcase = | 181 | 366 | std::getenv("PRINT_FUZZ_CASE") != nullptr; | 182 | | | 183 | 366 | if (do_print_testcase) { | 184 | 0 | dump_testcase(from, std::cerr); | 185 | 0 | std::exit(EXIT_SUCCESS); | 186 | 0 | } | 187 | | | 188 | 366 | do { | 189 | | // step 0 - is the input valid? | 190 | 366 | const auto [inputisvalid, valid_input_agree] = verify_valid_input(from); | 191 | 366 | if (!valid_input_agree && !allow_implementations_to_differ) | 192 | 0 | break; | 193 | | | 194 | | // step 1 - count the input (only makes sense for some of the encodings) | 195 | | if constexpr (From == UtfEncodings::UTF16BE || | 196 | | From == UtfEncodings::UTF16LE || | 197 | | From == UtfEncodings::UTF8) { | 198 | | if (!count_the_input(from) && !allow_implementations_to_differ) | 199 | | break; | 200 | | } | 201 | | | 202 | | // step 2 - what is the required size of the output? | 203 | 366 | const auto [output_length, length_agree] = | 204 | 366 | calculate_length(from, inputisvalid); | 205 | 366 | if (!length_agree && !allow_implementations_to_differ) | 206 | 0 | break; | 207 | | | 208 | 366 | if (!inputisvalid && name.find("valid") != std::string::npos) { | 209 | | // don't run the conversion step, it requires valid input | 210 | 5 | return; | 211 | 5 | } | 212 | | | 213 | | // step 3 - run the conversion | 214 | 361 | const auto [written, outputs_agree] = | 215 | 361 | do_conversion(from, output_length, inputisvalid); | 216 | 361 | if (!outputs_agree && !allow_implementations_to_differ) | 217 | 0 | break; | 218 | | | 219 | | // coming this far means no problems were found | 220 | 361 | return; | 221 | 361 | } while (0); | 222 | | // if we come here, something failed | 223 | 0 | std::cerr << "something failed, rerun with PRINT_FUZZ_CASE set to print a " | 224 | 0 | "reproducer to stderr\n"; | 225 | 0 | std::abort(); | 226 | 366 | } |
Conversion<(UtfEncodings)3, (UtfEncodings)2, unsigned long (simdutf::implementation::*)(char32_t const*, unsigned long) noexcept const, unsigned long (simdutf::implementation::*)(char32_t const*, unsigned long, char*) noexcept const>::fuzz(std::__1::span<char const, 18446744073709551615ul>) const Line | Count | Source | 175 | 404 | void fuzz(std::span<const char> chardata) const { | 176 | | // assume the input is aligned to FromType | 177 | 404 | const FromSpan from{reinterpret_cast<const FromType*>(chardata.data()), | 178 | 404 | chardata.size() / sizeof(FromType)}; | 179 | | | 180 | 404 | static const bool do_print_testcase = | 181 | 404 | std::getenv("PRINT_FUZZ_CASE") != nullptr; | 182 | | | 183 | 404 | if (do_print_testcase) { | 184 | 0 | dump_testcase(from, std::cerr); | 185 | 0 | std::exit(EXIT_SUCCESS); | 186 | 0 | } | 187 | | | 188 | 404 | do { | 189 | | // step 0 - is the input valid? | 190 | 404 | const auto [inputisvalid, valid_input_agree] = verify_valid_input(from); | 191 | 404 | if (!valid_input_agree && !allow_implementations_to_differ) | 192 | 0 | break; | 193 | | | 194 | | // step 1 - count the input (only makes sense for some of the encodings) | 195 | | if constexpr (From == UtfEncodings::UTF16BE || | 196 | | From == UtfEncodings::UTF16LE || | 197 | | From == UtfEncodings::UTF8) { | 198 | | if (!count_the_input(from) && !allow_implementations_to_differ) | 199 | | break; | 200 | | } | 201 | | | 202 | | // step 2 - what is the required size of the output? | 203 | 404 | const auto [output_length, length_agree] = | 204 | 404 | calculate_length(from, inputisvalid); | 205 | 404 | if (!length_agree && !allow_implementations_to_differ) | 206 | 0 | break; | 207 | | | 208 | 404 | if (!inputisvalid && name.find("valid") != std::string::npos) { | 209 | | // don't run the conversion step, it requires valid input | 210 | 6 | return; | 211 | 6 | } | 212 | | | 213 | | // step 3 - run the conversion | 214 | 398 | const auto [written, outputs_agree] = | 215 | 398 | do_conversion(from, output_length, inputisvalid); | 216 | 398 | if (!outputs_agree && !allow_implementations_to_differ) | 217 | 0 | break; | 218 | | | 219 | | // coming this far means no problems were found | 220 | 398 | return; | 221 | 398 | } while (0); | 222 | | // if we come here, something failed | 223 | 0 | std::cerr << "something failed, rerun with PRINT_FUZZ_CASE set to print a " | 224 | 0 | "reproducer to stderr\n"; | 225 | 0 | std::abort(); | 226 | 404 | } |
Conversion<(UtfEncodings)2, (UtfEncodings)0, unsigned long (simdutf::implementation::*)(char const*, unsigned long) noexcept const, unsigned long (simdutf::implementation::*)(char const*, unsigned long, char16_t*) noexcept const>::fuzz(std::__1::span<char const, 18446744073709551615ul>) const Line | Count | Source | 175 | 584 | void fuzz(std::span<const char> chardata) const { | 176 | | // assume the input is aligned to FromType | 177 | 584 | const FromSpan from{reinterpret_cast<const FromType*>(chardata.data()), | 178 | 584 | chardata.size() / sizeof(FromType)}; | 179 | | | 180 | 584 | static const bool do_print_testcase = | 181 | 584 | std::getenv("PRINT_FUZZ_CASE") != nullptr; | 182 | | | 183 | 584 | if (do_print_testcase) { | 184 | 0 | dump_testcase(from, std::cerr); | 185 | 0 | std::exit(EXIT_SUCCESS); | 186 | 0 | } | 187 | | | 188 | 584 | do { | 189 | | // step 0 - is the input valid? | 190 | 584 | const auto [inputisvalid, valid_input_agree] = verify_valid_input(from); | 191 | 584 | if (!valid_input_agree && !allow_implementations_to_differ) | 192 | 0 | break; | 193 | | | 194 | | // step 1 - count the input (only makes sense for some of the encodings) | 195 | | if constexpr (From == UtfEncodings::UTF16BE || | 196 | | From == UtfEncodings::UTF16LE || | 197 | 584 | From == UtfEncodings::UTF8) { | 198 | 584 | if (!count_the_input(from) && !allow_implementations_to_differ) | 199 | 0 | break; | 200 | 584 | } | 201 | | | 202 | | // step 2 - what is the required size of the output? | 203 | 584 | const auto [output_length, length_agree] = | 204 | 584 | calculate_length(from, inputisvalid); | 205 | 584 | if (!length_agree && !allow_implementations_to_differ) | 206 | 0 | break; | 207 | | | 208 | 584 | if (!inputisvalid && name.find("valid") != std::string::npos) { | 209 | | // don't run the conversion step, it requires valid input | 210 | 9 | return; | 211 | 9 | } | 212 | | | 213 | | // step 3 - run the conversion | 214 | 575 | const auto [written, outputs_agree] = | 215 | 575 | do_conversion(from, output_length, inputisvalid); | 216 | 575 | if (!outputs_agree && !allow_implementations_to_differ) | 217 | 0 | break; | 218 | | | 219 | | // coming this far means no problems were found | 220 | 575 | return; | 221 | 575 | } while (0); | 222 | | // if we come here, something failed | 223 | 0 | std::cerr << "something failed, rerun with PRINT_FUZZ_CASE set to print a " | 224 | 0 | "reproducer to stderr\n"; | 225 | 0 | std::abort(); | 226 | 584 | } |
Conversion<(UtfEncodings)2, (UtfEncodings)1, unsigned long (simdutf::implementation::*)(char const*, unsigned long) noexcept const, unsigned long (simdutf::implementation::*)(char const*, unsigned long, char16_t*) noexcept const>::fuzz(std::__1::span<char const, 18446744073709551615ul>) const Line | Count | Source | 175 | 527 | void fuzz(std::span<const char> chardata) const { | 176 | | // assume the input is aligned to FromType | 177 | 527 | const FromSpan from{reinterpret_cast<const FromType*>(chardata.data()), | 178 | 527 | chardata.size() / sizeof(FromType)}; | 179 | | | 180 | 527 | static const bool do_print_testcase = | 181 | 527 | std::getenv("PRINT_FUZZ_CASE") != nullptr; | 182 | | | 183 | 527 | if (do_print_testcase) { | 184 | 0 | dump_testcase(from, std::cerr); | 185 | 0 | std::exit(EXIT_SUCCESS); | 186 | 0 | } | 187 | | | 188 | 527 | do { | 189 | | // step 0 - is the input valid? | 190 | 527 | const auto [inputisvalid, valid_input_agree] = verify_valid_input(from); | 191 | 527 | if (!valid_input_agree && !allow_implementations_to_differ) | 192 | 0 | break; | 193 | | | 194 | | // step 1 - count the input (only makes sense for some of the encodings) | 195 | | if constexpr (From == UtfEncodings::UTF16BE || | 196 | | From == UtfEncodings::UTF16LE || | 197 | 527 | From == UtfEncodings::UTF8) { | 198 | 527 | if (!count_the_input(from) && !allow_implementations_to_differ) | 199 | 0 | break; | 200 | 527 | } | 201 | | | 202 | | // step 2 - what is the required size of the output? | 203 | 527 | const auto [output_length, length_agree] = | 204 | 527 | calculate_length(from, inputisvalid); | 205 | 527 | if (!length_agree && !allow_implementations_to_differ) | 206 | 0 | break; | 207 | | | 208 | 527 | if (!inputisvalid && name.find("valid") != std::string::npos) { | 209 | | // don't run the conversion step, it requires valid input | 210 | 13 | return; | 211 | 13 | } | 212 | | | 213 | | // step 3 - run the conversion | 214 | 514 | const auto [written, outputs_agree] = | 215 | 514 | do_conversion(from, output_length, inputisvalid); | 216 | 514 | if (!outputs_agree && !allow_implementations_to_differ) | 217 | 0 | break; | 218 | | | 219 | | // coming this far means no problems were found | 220 | 514 | return; | 221 | 514 | } while (0); | 222 | | // if we come here, something failed | 223 | 0 | std::cerr << "something failed, rerun with PRINT_FUZZ_CASE set to print a " | 224 | 0 | "reproducer to stderr\n"; | 225 | 0 | std::abort(); | 226 | 527 | } |
Conversion<(UtfEncodings)2, (UtfEncodings)3, unsigned long (simdutf::implementation::*)(char const*, unsigned long) noexcept const, unsigned long (simdutf::implementation::*)(char const*, unsigned long, char32_t*) noexcept const>::fuzz(std::__1::span<char const, 18446744073709551615ul>) const Line | Count | Source | 175 | 564 | void fuzz(std::span<const char> chardata) const { | 176 | | // assume the input is aligned to FromType | 177 | 564 | const FromSpan from{reinterpret_cast<const FromType*>(chardata.data()), | 178 | 564 | chardata.size() / sizeof(FromType)}; | 179 | | | 180 | 564 | static const bool do_print_testcase = | 181 | 564 | std::getenv("PRINT_FUZZ_CASE") != nullptr; | 182 | | | 183 | 564 | if (do_print_testcase) { | 184 | 0 | dump_testcase(from, std::cerr); | 185 | 0 | std::exit(EXIT_SUCCESS); | 186 | 0 | } | 187 | | | 188 | 564 | do { | 189 | | // step 0 - is the input valid? | 190 | 564 | const auto [inputisvalid, valid_input_agree] = verify_valid_input(from); | 191 | 564 | if (!valid_input_agree && !allow_implementations_to_differ) | 192 | 0 | break; | 193 | | | 194 | | // step 1 - count the input (only makes sense for some of the encodings) | 195 | | if constexpr (From == UtfEncodings::UTF16BE || | 196 | | From == UtfEncodings::UTF16LE || | 197 | 564 | From == UtfEncodings::UTF8) { | 198 | 564 | if (!count_the_input(from) && !allow_implementations_to_differ) | 199 | 0 | break; | 200 | 564 | } | 201 | | | 202 | | // step 2 - what is the required size of the output? | 203 | 564 | const auto [output_length, length_agree] = | 204 | 564 | calculate_length(from, inputisvalid); | 205 | 564 | if (!length_agree && !allow_implementations_to_differ) | 206 | 0 | break; | 207 | | | 208 | 564 | if (!inputisvalid && name.find("valid") != std::string::npos) { | 209 | | // don't run the conversion step, it requires valid input | 210 | 11 | return; | 211 | 11 | } | 212 | | | 213 | | // step 3 - run the conversion | 214 | 553 | const auto [written, outputs_agree] = | 215 | 553 | do_conversion(from, output_length, inputisvalid); | 216 | 553 | if (!outputs_agree && !allow_implementations_to_differ) | 217 | 0 | break; | 218 | | | 219 | | // coming this far means no problems were found | 220 | 553 | return; | 221 | 553 | } while (0); | 222 | | // if we come here, something failed | 223 | 0 | std::cerr << "something failed, rerun with PRINT_FUZZ_CASE set to print a " | 224 | 0 | "reproducer to stderr\n"; | 225 | 0 | std::abort(); | 226 | 564 | } |
Conversion<(UtfEncodings)0, (UtfEncodings)4, unsigned long (simdutf::implementation::*)(unsigned long) noexcept const, unsigned long (simdutf::implementation::*)(char16_t const*, unsigned long, char*) noexcept const>::fuzz(std::__1::span<char const, 18446744073709551615ul>) const Line | Count | Source | 175 | 63 | void fuzz(std::span<const char> chardata) const { | 176 | | // assume the input is aligned to FromType | 177 | 63 | const FromSpan from{reinterpret_cast<const FromType*>(chardata.data()), | 178 | 63 | chardata.size() / sizeof(FromType)}; | 179 | | | 180 | 63 | static const bool do_print_testcase = | 181 | 63 | std::getenv("PRINT_FUZZ_CASE") != nullptr; | 182 | | | 183 | 63 | if (do_print_testcase) { | 184 | 0 | dump_testcase(from, std::cerr); | 185 | 0 | std::exit(EXIT_SUCCESS); | 186 | 0 | } | 187 | | | 188 | 63 | do { | 189 | | // step 0 - is the input valid? | 190 | 63 | const auto [inputisvalid, valid_input_agree] = verify_valid_input(from); | 191 | 63 | if (!valid_input_agree && !allow_implementations_to_differ) | 192 | 0 | break; | 193 | | | 194 | | // step 1 - count the input (only makes sense for some of the encodings) | 195 | | if constexpr (From == UtfEncodings::UTF16BE || | 196 | | From == UtfEncodings::UTF16LE || | 197 | 63 | From == UtfEncodings::UTF8) { | 198 | 63 | if (!count_the_input(from) && !allow_implementations_to_differ) | 199 | 0 | break; | 200 | 63 | } | 201 | | | 202 | | // step 2 - what is the required size of the output? | 203 | 63 | const auto [output_length, length_agree] = | 204 | 63 | calculate_length(from, inputisvalid); | 205 | 63 | if (!length_agree && !allow_implementations_to_differ) | 206 | 0 | break; | 207 | | | 208 | 63 | if (!inputisvalid && name.find("valid") != std::string::npos) { | 209 | | // don't run the conversion step, it requires valid input | 210 | 0 | return; | 211 | 0 | } | 212 | | | 213 | | // step 3 - run the conversion | 214 | 63 | const auto [written, outputs_agree] = | 215 | 63 | do_conversion(from, output_length, inputisvalid); | 216 | 63 | if (!outputs_agree && !allow_implementations_to_differ) | 217 | 0 | break; | 218 | | | 219 | | // coming this far means no problems were found | 220 | 63 | return; | 221 | 63 | } while (0); | 222 | | // if we come here, something failed | 223 | 0 | std::cerr << "something failed, rerun with PRINT_FUZZ_CASE set to print a " | 224 | 0 | "reproducer to stderr\n"; | 225 | 0 | std::abort(); | 226 | 63 | } |
Conversion<(UtfEncodings)1, (UtfEncodings)4, unsigned long (simdutf::implementation::*)(unsigned long) noexcept const, unsigned long (simdutf::implementation::*)(char16_t const*, unsigned long, char*) noexcept const>::fuzz(std::__1::span<char const, 18446744073709551615ul>) const Line | Count | Source | 175 | 62 | void fuzz(std::span<const char> chardata) const { | 176 | | // assume the input is aligned to FromType | 177 | 62 | const FromSpan from{reinterpret_cast<const FromType*>(chardata.data()), | 178 | 62 | chardata.size() / sizeof(FromType)}; | 179 | | | 180 | 62 | static const bool do_print_testcase = | 181 | 62 | std::getenv("PRINT_FUZZ_CASE") != nullptr; | 182 | | | 183 | 62 | if (do_print_testcase) { | 184 | 0 | dump_testcase(from, std::cerr); | 185 | 0 | std::exit(EXIT_SUCCESS); | 186 | 0 | } | 187 | | | 188 | 62 | do { | 189 | | // step 0 - is the input valid? | 190 | 62 | const auto [inputisvalid, valid_input_agree] = verify_valid_input(from); | 191 | 62 | if (!valid_input_agree && !allow_implementations_to_differ) | 192 | 0 | break; | 193 | | | 194 | | // step 1 - count the input (only makes sense for some of the encodings) | 195 | | if constexpr (From == UtfEncodings::UTF16BE || | 196 | | From == UtfEncodings::UTF16LE || | 197 | 62 | From == UtfEncodings::UTF8) { | 198 | 62 | if (!count_the_input(from) && !allow_implementations_to_differ) | 199 | 0 | break; | 200 | 62 | } | 201 | | | 202 | | // step 2 - what is the required size of the output? | 203 | 62 | const auto [output_length, length_agree] = | 204 | 62 | calculate_length(from, inputisvalid); | 205 | 62 | if (!length_agree && !allow_implementations_to_differ) | 206 | 0 | break; | 207 | | | 208 | 62 | if (!inputisvalid && name.find("valid") != std::string::npos) { | 209 | | // don't run the conversion step, it requires valid input | 210 | 0 | return; | 211 | 0 | } | 212 | | | 213 | | // step 3 - run the conversion | 214 | 62 | const auto [written, outputs_agree] = | 215 | 62 | do_conversion(from, output_length, inputisvalid); | 216 | 62 | if (!outputs_agree && !allow_implementations_to_differ) | 217 | 0 | break; | 218 | | | 219 | | // coming this far means no problems were found | 220 | 62 | return; | 221 | 62 | } while (0); | 222 | | // if we come here, something failed | 223 | 0 | std::cerr << "something failed, rerun with PRINT_FUZZ_CASE set to print a " | 224 | 0 | "reproducer to stderr\n"; | 225 | 0 | std::abort(); | 226 | 62 | } |
Conversion<(UtfEncodings)3, (UtfEncodings)4, unsigned long (simdutf::implementation::*)(unsigned long) noexcept const, unsigned long (simdutf::implementation::*)(char32_t const*, unsigned long, char*) noexcept const>::fuzz(std::__1::span<char const, 18446744073709551615ul>) const Line | Count | Source | 175 | 94 | void fuzz(std::span<const char> chardata) const { | 176 | | // assume the input is aligned to FromType | 177 | 94 | const FromSpan from{reinterpret_cast<const FromType*>(chardata.data()), | 178 | 94 | chardata.size() / sizeof(FromType)}; | 179 | | | 180 | 94 | static const bool do_print_testcase = | 181 | 94 | std::getenv("PRINT_FUZZ_CASE") != nullptr; | 182 | | | 183 | 94 | if (do_print_testcase) { | 184 | 0 | dump_testcase(from, std::cerr); | 185 | 0 | std::exit(EXIT_SUCCESS); | 186 | 0 | } | 187 | | | 188 | 94 | do { | 189 | | // step 0 - is the input valid? | 190 | 94 | const auto [inputisvalid, valid_input_agree] = verify_valid_input(from); | 191 | 94 | if (!valid_input_agree && !allow_implementations_to_differ) | 192 | 0 | break; | 193 | | | 194 | | // step 1 - count the input (only makes sense for some of the encodings) | 195 | | if constexpr (From == UtfEncodings::UTF16BE || | 196 | | From == UtfEncodings::UTF16LE || | 197 | | From == UtfEncodings::UTF8) { | 198 | | if (!count_the_input(from) && !allow_implementations_to_differ) | 199 | | break; | 200 | | } | 201 | | | 202 | | // step 2 - what is the required size of the output? | 203 | 94 | const auto [output_length, length_agree] = | 204 | 94 | calculate_length(from, inputisvalid); | 205 | 94 | if (!length_agree && !allow_implementations_to_differ) | 206 | 0 | break; | 207 | | | 208 | 94 | if (!inputisvalid && name.find("valid") != std::string::npos) { | 209 | | // don't run the conversion step, it requires valid input | 210 | 0 | return; | 211 | 0 | } | 212 | | | 213 | | // step 3 - run the conversion | 214 | 94 | const auto [written, outputs_agree] = | 215 | 94 | do_conversion(from, output_length, inputisvalid); | 216 | 94 | if (!outputs_agree && !allow_implementations_to_differ) | 217 | 0 | break; | 218 | | | 219 | | // coming this far means no problems were found | 220 | 94 | return; | 221 | 94 | } while (0); | 222 | | // if we come here, something failed | 223 | 0 | std::cerr << "something failed, rerun with PRINT_FUZZ_CASE set to print a " | 224 | 0 | "reproducer to stderr\n"; | 225 | 0 | std::abort(); | 226 | 94 | } |
Conversion<(UtfEncodings)2, (UtfEncodings)4, unsigned long (simdutf::implementation::*)(char const*, unsigned long) noexcept const, unsigned long (simdutf::implementation::*)(char const*, unsigned long, char*) noexcept const>::fuzz(std::__1::span<char const, 18446744073709551615ul>) const Line | Count | Source | 175 | 281 | void fuzz(std::span<const char> chardata) const { | 176 | | // assume the input is aligned to FromType | 177 | 281 | const FromSpan from{reinterpret_cast<const FromType*>(chardata.data()), | 178 | 281 | chardata.size() / sizeof(FromType)}; | 179 | | | 180 | 281 | static const bool do_print_testcase = | 181 | 281 | std::getenv("PRINT_FUZZ_CASE") != nullptr; | 182 | | | 183 | 281 | if (do_print_testcase) { | 184 | 0 | dump_testcase(from, std::cerr); | 185 | 0 | std::exit(EXIT_SUCCESS); | 186 | 0 | } | 187 | | | 188 | 281 | do { | 189 | | // step 0 - is the input valid? | 190 | 281 | const auto [inputisvalid, valid_input_agree] = verify_valid_input(from); | 191 | 281 | if (!valid_input_agree && !allow_implementations_to_differ) | 192 | 0 | break; | 193 | | | 194 | | // step 1 - count the input (only makes sense for some of the encodings) | 195 | | if constexpr (From == UtfEncodings::UTF16BE || | 196 | | From == UtfEncodings::UTF16LE || | 197 | 281 | From == UtfEncodings::UTF8) { | 198 | 281 | if (!count_the_input(from) && !allow_implementations_to_differ) | 199 | 0 | break; | 200 | 281 | } | 201 | | | 202 | | // step 2 - what is the required size of the output? | 203 | 281 | const auto [output_length, length_agree] = | 204 | 281 | calculate_length(from, inputisvalid); | 205 | 281 | if (!length_agree && !allow_implementations_to_differ) | 206 | 0 | break; | 207 | | | 208 | 281 | if (!inputisvalid && name.find("valid") != std::string::npos) { | 209 | | // don't run the conversion step, it requires valid input | 210 | 0 | return; | 211 | 0 | } | 212 | | | 213 | | // step 3 - run the conversion | 214 | 281 | const auto [written, outputs_agree] = | 215 | 281 | do_conversion(from, output_length, inputisvalid); | 216 | 281 | if (!outputs_agree && !allow_implementations_to_differ) | 217 | 0 | break; | 218 | | | 219 | | // coming this far means no problems were found | 220 | 281 | return; | 221 | 281 | } while (0); | 222 | | // if we come here, something failed | 223 | 0 | std::cerr << "something failed, rerun with PRINT_FUZZ_CASE set to print a " | 224 | 0 | "reproducer to stderr\n"; | 225 | 0 | std::abort(); | 226 | 281 | } |
Conversion<(UtfEncodings)0, (UtfEncodings)4, unsigned long (simdutf::implementation::*)(unsigned long) noexcept const, simdutf::result (simdutf::implementation::*)(char16_t const*, unsigned long, char*) noexcept const>::fuzz(std::__1::span<char const, 18446744073709551615ul>) const Line | Count | Source | 175 | 126 | void fuzz(std::span<const char> chardata) const { | 176 | | // assume the input is aligned to FromType | 177 | 126 | const FromSpan from{reinterpret_cast<const FromType*>(chardata.data()), | 178 | 126 | chardata.size() / sizeof(FromType)}; | 179 | | | 180 | 126 | static const bool do_print_testcase = | 181 | 126 | std::getenv("PRINT_FUZZ_CASE") != nullptr; | 182 | | | 183 | 126 | if (do_print_testcase) { | 184 | 0 | dump_testcase(from, std::cerr); | 185 | 0 | std::exit(EXIT_SUCCESS); | 186 | 0 | } | 187 | | | 188 | 126 | do { | 189 | | // step 0 - is the input valid? | 190 | 126 | const auto [inputisvalid, valid_input_agree] = verify_valid_input(from); | 191 | 126 | if (!valid_input_agree && !allow_implementations_to_differ) | 192 | 0 | break; | 193 | | | 194 | | // step 1 - count the input (only makes sense for some of the encodings) | 195 | | if constexpr (From == UtfEncodings::UTF16BE || | 196 | | From == UtfEncodings::UTF16LE || | 197 | 126 | From == UtfEncodings::UTF8) { | 198 | 126 | if (!count_the_input(from) && !allow_implementations_to_differ) | 199 | 0 | break; | 200 | 126 | } | 201 | | | 202 | | // step 2 - what is the required size of the output? | 203 | 126 | const auto [output_length, length_agree] = | 204 | 126 | calculate_length(from, inputisvalid); | 205 | 126 | if (!length_agree && !allow_implementations_to_differ) | 206 | 0 | break; | 207 | | | 208 | 126 | if (!inputisvalid && name.find("valid") != std::string::npos) { | 209 | | // don't run the conversion step, it requires valid input | 210 | 0 | return; | 211 | 0 | } | 212 | | | 213 | | // step 3 - run the conversion | 214 | 126 | const auto [written, outputs_agree] = | 215 | 126 | do_conversion(from, output_length, inputisvalid); | 216 | 126 | if (!outputs_agree && !allow_implementations_to_differ) | 217 | 0 | break; | 218 | | | 219 | | // coming this far means no problems were found | 220 | 126 | return; | 221 | 126 | } while (0); | 222 | | // if we come here, something failed | 223 | 0 | std::cerr << "something failed, rerun with PRINT_FUZZ_CASE set to print a " | 224 | 0 | "reproducer to stderr\n"; | 225 | 0 | std::abort(); | 226 | 126 | } |
Conversion<(UtfEncodings)0, (UtfEncodings)3, unsigned long (simdutf::implementation::*)(char16_t const*, unsigned long) noexcept const, simdutf::result (simdutf::implementation::*)(char16_t const*, unsigned long, char32_t*) noexcept const>::fuzz(std::__1::span<char const, 18446744073709551615ul>) const Line | Count | Source | 175 | 150 | void fuzz(std::span<const char> chardata) const { | 176 | | // assume the input is aligned to FromType | 177 | 150 | const FromSpan from{reinterpret_cast<const FromType*>(chardata.data()), | 178 | 150 | chardata.size() / sizeof(FromType)}; | 179 | | | 180 | 150 | static const bool do_print_testcase = | 181 | 150 | std::getenv("PRINT_FUZZ_CASE") != nullptr; | 182 | | | 183 | 150 | if (do_print_testcase) { | 184 | 0 | dump_testcase(from, std::cerr); | 185 | 0 | std::exit(EXIT_SUCCESS); | 186 | 0 | } | 187 | | | 188 | 150 | do { | 189 | | // step 0 - is the input valid? | 190 | 150 | const auto [inputisvalid, valid_input_agree] = verify_valid_input(from); | 191 | 150 | if (!valid_input_agree && !allow_implementations_to_differ) | 192 | 0 | break; | 193 | | | 194 | | // step 1 - count the input (only makes sense for some of the encodings) | 195 | | if constexpr (From == UtfEncodings::UTF16BE || | 196 | | From == UtfEncodings::UTF16LE || | 197 | 150 | From == UtfEncodings::UTF8) { | 198 | 150 | if (!count_the_input(from) && !allow_implementations_to_differ) | 199 | 0 | break; | 200 | 150 | } | 201 | | | 202 | | // step 2 - what is the required size of the output? | 203 | 150 | const auto [output_length, length_agree] = | 204 | 150 | calculate_length(from, inputisvalid); | 205 | 150 | if (!length_agree && !allow_implementations_to_differ) | 206 | 0 | break; | 207 | | | 208 | 150 | if (!inputisvalid && name.find("valid") != std::string::npos) { | 209 | | // don't run the conversion step, it requires valid input | 210 | 0 | return; | 211 | 0 | } | 212 | | | 213 | | // step 3 - run the conversion | 214 | 150 | const auto [written, outputs_agree] = | 215 | 150 | do_conversion(from, output_length, inputisvalid); | 216 | 150 | if (!outputs_agree && !allow_implementations_to_differ) | 217 | 0 | break; | 218 | | | 219 | | // coming this far means no problems were found | 220 | 150 | return; | 221 | 150 | } while (0); | 222 | | // if we come here, something failed | 223 | 0 | std::cerr << "something failed, rerun with PRINT_FUZZ_CASE set to print a " | 224 | 0 | "reproducer to stderr\n"; | 225 | 0 | std::abort(); | 226 | 150 | } |
Conversion<(UtfEncodings)0, (UtfEncodings)2, unsigned long (simdutf::implementation::*)(char16_t const*, unsigned long) noexcept const, simdutf::result (simdutf::implementation::*)(char16_t const*, unsigned long, char*) noexcept const>::fuzz(std::__1::span<char const, 18446744073709551615ul>) const Line | Count | Source | 175 | 293 | void fuzz(std::span<const char> chardata) const { | 176 | | // assume the input is aligned to FromType | 177 | 293 | const FromSpan from{reinterpret_cast<const FromType*>(chardata.data()), | 178 | 293 | chardata.size() / sizeof(FromType)}; | 179 | | | 180 | 293 | static const bool do_print_testcase = | 181 | 293 | std::getenv("PRINT_FUZZ_CASE") != nullptr; | 182 | | | 183 | 293 | if (do_print_testcase) { | 184 | 0 | dump_testcase(from, std::cerr); | 185 | 0 | std::exit(EXIT_SUCCESS); | 186 | 0 | } | 187 | | | 188 | 293 | do { | 189 | | // step 0 - is the input valid? | 190 | 293 | const auto [inputisvalid, valid_input_agree] = verify_valid_input(from); | 191 | 293 | if (!valid_input_agree && !allow_implementations_to_differ) | 192 | 0 | break; | 193 | | | 194 | | // step 1 - count the input (only makes sense for some of the encodings) | 195 | | if constexpr (From == UtfEncodings::UTF16BE || | 196 | | From == UtfEncodings::UTF16LE || | 197 | 293 | From == UtfEncodings::UTF8) { | 198 | 293 | if (!count_the_input(from) && !allow_implementations_to_differ) | 199 | 0 | break; | 200 | 293 | } | 201 | | | 202 | | // step 2 - what is the required size of the output? | 203 | 293 | const auto [output_length, length_agree] = | 204 | 293 | calculate_length(from, inputisvalid); | 205 | 293 | if (!length_agree && !allow_implementations_to_differ) | 206 | 0 | break; | 207 | | | 208 | 293 | if (!inputisvalid && name.find("valid") != std::string::npos) { | 209 | | // don't run the conversion step, it requires valid input | 210 | 0 | return; | 211 | 0 | } | 212 | | | 213 | | // step 3 - run the conversion | 214 | 293 | const auto [written, outputs_agree] = | 215 | 293 | do_conversion(from, output_length, inputisvalid); | 216 | 293 | if (!outputs_agree && !allow_implementations_to_differ) | 217 | 0 | break; | 218 | | | 219 | | // coming this far means no problems were found | 220 | 293 | return; | 221 | 293 | } while (0); | 222 | | // if we come here, something failed | 223 | 0 | std::cerr << "something failed, rerun with PRINT_FUZZ_CASE set to print a " | 224 | 0 | "reproducer to stderr\n"; | 225 | 0 | std::abort(); | 226 | 293 | } |
Conversion<(UtfEncodings)1, (UtfEncodings)4, unsigned long (simdutf::implementation::*)(unsigned long) noexcept const, simdutf::result (simdutf::implementation::*)(char16_t const*, unsigned long, char*) noexcept const>::fuzz(std::__1::span<char const, 18446744073709551615ul>) const Line | Count | Source | 175 | 115 | void fuzz(std::span<const char> chardata) const { | 176 | | // assume the input is aligned to FromType | 177 | 115 | const FromSpan from{reinterpret_cast<const FromType*>(chardata.data()), | 178 | 115 | chardata.size() / sizeof(FromType)}; | 179 | | | 180 | 115 | static const bool do_print_testcase = | 181 | 115 | std::getenv("PRINT_FUZZ_CASE") != nullptr; | 182 | | | 183 | 115 | if (do_print_testcase) { | 184 | 0 | dump_testcase(from, std::cerr); | 185 | 0 | std::exit(EXIT_SUCCESS); | 186 | 0 | } | 187 | | | 188 | 115 | do { | 189 | | // step 0 - is the input valid? | 190 | 115 | const auto [inputisvalid, valid_input_agree] = verify_valid_input(from); | 191 | 115 | if (!valid_input_agree && !allow_implementations_to_differ) | 192 | 0 | break; | 193 | | | 194 | | // step 1 - count the input (only makes sense for some of the encodings) | 195 | | if constexpr (From == UtfEncodings::UTF16BE || | 196 | | From == UtfEncodings::UTF16LE || | 197 | 115 | From == UtfEncodings::UTF8) { | 198 | 115 | if (!count_the_input(from) && !allow_implementations_to_differ) | 199 | 0 | break; | 200 | 115 | } | 201 | | | 202 | | // step 2 - what is the required size of the output? | 203 | 115 | const auto [output_length, length_agree] = | 204 | 115 | calculate_length(from, inputisvalid); | 205 | 115 | if (!length_agree && !allow_implementations_to_differ) | 206 | 0 | break; | 207 | | | 208 | 115 | if (!inputisvalid && name.find("valid") != std::string::npos) { | 209 | | // don't run the conversion step, it requires valid input | 210 | 0 | return; | 211 | 0 | } | 212 | | | 213 | | // step 3 - run the conversion | 214 | 115 | const auto [written, outputs_agree] = | 215 | 115 | do_conversion(from, output_length, inputisvalid); | 216 | 115 | if (!outputs_agree && !allow_implementations_to_differ) | 217 | 0 | break; | 218 | | | 219 | | // coming this far means no problems were found | 220 | 115 | return; | 221 | 115 | } while (0); | 222 | | // if we come here, something failed | 223 | 0 | std::cerr << "something failed, rerun with PRINT_FUZZ_CASE set to print a " | 224 | 0 | "reproducer to stderr\n"; | 225 | 0 | std::abort(); | 226 | 115 | } |
Conversion<(UtfEncodings)1, (UtfEncodings)3, unsigned long (simdutf::implementation::*)(char16_t const*, unsigned long) noexcept const, simdutf::result (simdutf::implementation::*)(char16_t const*, unsigned long, char32_t*) noexcept const>::fuzz(std::__1::span<char const, 18446744073709551615ul>) const Line | Count | Source | 175 | 207 | void fuzz(std::span<const char> chardata) const { | 176 | | // assume the input is aligned to FromType | 177 | 207 | const FromSpan from{reinterpret_cast<const FromType*>(chardata.data()), | 178 | 207 | chardata.size() / sizeof(FromType)}; | 179 | | | 180 | 207 | static const bool do_print_testcase = | 181 | 207 | std::getenv("PRINT_FUZZ_CASE") != nullptr; | 182 | | | 183 | 207 | if (do_print_testcase) { | 184 | 0 | dump_testcase(from, std::cerr); | 185 | 0 | std::exit(EXIT_SUCCESS); | 186 | 0 | } | 187 | | | 188 | 207 | do { | 189 | | // step 0 - is the input valid? | 190 | 207 | const auto [inputisvalid, valid_input_agree] = verify_valid_input(from); | 191 | 207 | if (!valid_input_agree && !allow_implementations_to_differ) | 192 | 0 | break; | 193 | | | 194 | | // step 1 - count the input (only makes sense for some of the encodings) | 195 | | if constexpr (From == UtfEncodings::UTF16BE || | 196 | | From == UtfEncodings::UTF16LE || | 197 | 207 | From == UtfEncodings::UTF8) { | 198 | 207 | if (!count_the_input(from) && !allow_implementations_to_differ) | 199 | 0 | break; | 200 | 207 | } | 201 | | | 202 | | // step 2 - what is the required size of the output? | 203 | 207 | const auto [output_length, length_agree] = | 204 | 207 | calculate_length(from, inputisvalid); | 205 | 207 | if (!length_agree && !allow_implementations_to_differ) | 206 | 0 | break; | 207 | | | 208 | 207 | if (!inputisvalid && name.find("valid") != std::string::npos) { | 209 | | // don't run the conversion step, it requires valid input | 210 | 0 | return; | 211 | 0 | } | 212 | | | 213 | | // step 3 - run the conversion | 214 | 207 | const auto [written, outputs_agree] = | 215 | 207 | do_conversion(from, output_length, inputisvalid); | 216 | 207 | if (!outputs_agree && !allow_implementations_to_differ) | 217 | 0 | break; | 218 | | | 219 | | // coming this far means no problems were found | 220 | 207 | return; | 221 | 207 | } while (0); | 222 | | // if we come here, something failed | 223 | 0 | std::cerr << "something failed, rerun with PRINT_FUZZ_CASE set to print a " | 224 | 0 | "reproducer to stderr\n"; | 225 | 0 | std::abort(); | 226 | 207 | } |
Conversion<(UtfEncodings)1, (UtfEncodings)2, unsigned long (simdutf::implementation::*)(char16_t const*, unsigned long) noexcept const, simdutf::result (simdutf::implementation::*)(char16_t const*, unsigned long, char*) noexcept const>::fuzz(std::__1::span<char const, 18446744073709551615ul>) const Line | Count | Source | 175 | 315 | void fuzz(std::span<const char> chardata) const { | 176 | | // assume the input is aligned to FromType | 177 | 315 | const FromSpan from{reinterpret_cast<const FromType*>(chardata.data()), | 178 | 315 | chardata.size() / sizeof(FromType)}; | 179 | | | 180 | 315 | static const bool do_print_testcase = | 181 | 315 | std::getenv("PRINT_FUZZ_CASE") != nullptr; | 182 | | | 183 | 315 | if (do_print_testcase) { | 184 | 0 | dump_testcase(from, std::cerr); | 185 | 0 | std::exit(EXIT_SUCCESS); | 186 | 0 | } | 187 | | | 188 | 315 | do { | 189 | | // step 0 - is the input valid? | 190 | 315 | const auto [inputisvalid, valid_input_agree] = verify_valid_input(from); | 191 | 315 | if (!valid_input_agree && !allow_implementations_to_differ) | 192 | 0 | break; | 193 | | | 194 | | // step 1 - count the input (only makes sense for some of the encodings) | 195 | | if constexpr (From == UtfEncodings::UTF16BE || | 196 | | From == UtfEncodings::UTF16LE || | 197 | 315 | From == UtfEncodings::UTF8) { | 198 | 315 | if (!count_the_input(from) && !allow_implementations_to_differ) | 199 | 0 | break; | 200 | 315 | } | 201 | | | 202 | | // step 2 - what is the required size of the output? | 203 | 315 | const auto [output_length, length_agree] = | 204 | 315 | calculate_length(from, inputisvalid); | 205 | 315 | if (!length_agree && !allow_implementations_to_differ) | 206 | 0 | break; | 207 | | | 208 | 315 | if (!inputisvalid && name.find("valid") != std::string::npos) { | 209 | | // don't run the conversion step, it requires valid input | 210 | 0 | return; | 211 | 0 | } | 212 | | | 213 | | // step 3 - run the conversion | 214 | 315 | const auto [written, outputs_agree] = | 215 | 315 | do_conversion(from, output_length, inputisvalid); | 216 | 315 | if (!outputs_agree && !allow_implementations_to_differ) | 217 | 0 | break; | 218 | | | 219 | | // coming this far means no problems were found | 220 | 315 | return; | 221 | 315 | } while (0); | 222 | | // if we come here, something failed | 223 | 0 | std::cerr << "something failed, rerun with PRINT_FUZZ_CASE set to print a " | 224 | 0 | "reproducer to stderr\n"; | 225 | 0 | std::abort(); | 226 | 315 | } |
Conversion<(UtfEncodings)3, (UtfEncodings)4, unsigned long (simdutf::implementation::*)(unsigned long) noexcept const, simdutf::result (simdutf::implementation::*)(char32_t const*, unsigned long, char*) noexcept const>::fuzz(std::__1::span<char const, 18446744073709551615ul>) const Line | Count | Source | 175 | 210 | void fuzz(std::span<const char> chardata) const { | 176 | | // assume the input is aligned to FromType | 177 | 210 | const FromSpan from{reinterpret_cast<const FromType*>(chardata.data()), | 178 | 210 | chardata.size() / sizeof(FromType)}; | 179 | | | 180 | 210 | static const bool do_print_testcase = | 181 | 210 | std::getenv("PRINT_FUZZ_CASE") != nullptr; | 182 | | | 183 | 210 | if (do_print_testcase) { | 184 | 0 | dump_testcase(from, std::cerr); | 185 | 0 | std::exit(EXIT_SUCCESS); | 186 | 0 | } | 187 | | | 188 | 210 | do { | 189 | | // step 0 - is the input valid? | 190 | 210 | const auto [inputisvalid, valid_input_agree] = verify_valid_input(from); | 191 | 210 | if (!valid_input_agree && !allow_implementations_to_differ) | 192 | 0 | break; | 193 | | | 194 | | // step 1 - count the input (only makes sense for some of the encodings) | 195 | | if constexpr (From == UtfEncodings::UTF16BE || | 196 | | From == UtfEncodings::UTF16LE || | 197 | | From == UtfEncodings::UTF8) { | 198 | | if (!count_the_input(from) && !allow_implementations_to_differ) | 199 | | break; | 200 | | } | 201 | | | 202 | | // step 2 - what is the required size of the output? | 203 | 210 | const auto [output_length, length_agree] = | 204 | 210 | calculate_length(from, inputisvalid); | 205 | 210 | if (!length_agree && !allow_implementations_to_differ) | 206 | 0 | break; | 207 | | | 208 | 210 | if (!inputisvalid && name.find("valid") != std::string::npos) { | 209 | | // don't run the conversion step, it requires valid input | 210 | 0 | return; | 211 | 0 | } | 212 | | | 213 | | // step 3 - run the conversion | 214 | 210 | const auto [written, outputs_agree] = | 215 | 210 | do_conversion(from, output_length, inputisvalid); | 216 | 210 | if (!outputs_agree && !allow_implementations_to_differ) | 217 | 0 | break; | 218 | | | 219 | | // coming this far means no problems were found | 220 | 210 | return; | 221 | 210 | } while (0); | 222 | | // if we come here, something failed | 223 | 0 | std::cerr << "something failed, rerun with PRINT_FUZZ_CASE set to print a " | 224 | 0 | "reproducer to stderr\n"; | 225 | 0 | std::abort(); | 226 | 210 | } |
Conversion<(UtfEncodings)3, (UtfEncodings)0, unsigned long (simdutf::implementation::*)(char32_t const*, unsigned long) noexcept const, simdutf::result (simdutf::implementation::*)(char32_t const*, unsigned long, char16_t*) noexcept const>::fuzz(std::__1::span<char const, 18446744073709551615ul>) const Line | Count | Source | 175 | 303 | void fuzz(std::span<const char> chardata) const { | 176 | | // assume the input is aligned to FromType | 177 | 303 | const FromSpan from{reinterpret_cast<const FromType*>(chardata.data()), | 178 | 303 | chardata.size() / sizeof(FromType)}; | 179 | | | 180 | 303 | static const bool do_print_testcase = | 181 | 303 | std::getenv("PRINT_FUZZ_CASE") != nullptr; | 182 | | | 183 | 303 | if (do_print_testcase) { | 184 | 0 | dump_testcase(from, std::cerr); | 185 | 0 | std::exit(EXIT_SUCCESS); | 186 | 0 | } | 187 | | | 188 | 303 | do { | 189 | | // step 0 - is the input valid? | 190 | 303 | const auto [inputisvalid, valid_input_agree] = verify_valid_input(from); | 191 | 303 | if (!valid_input_agree && !allow_implementations_to_differ) | 192 | 0 | break; | 193 | | | 194 | | // step 1 - count the input (only makes sense for some of the encodings) | 195 | | if constexpr (From == UtfEncodings::UTF16BE || | 196 | | From == UtfEncodings::UTF16LE || | 197 | | From == UtfEncodings::UTF8) { | 198 | | if (!count_the_input(from) && !allow_implementations_to_differ) | 199 | | break; | 200 | | } | 201 | | | 202 | | // step 2 - what is the required size of the output? | 203 | 303 | const auto [output_length, length_agree] = | 204 | 303 | calculate_length(from, inputisvalid); | 205 | 303 | if (!length_agree && !allow_implementations_to_differ) | 206 | 0 | break; | 207 | | | 208 | 303 | if (!inputisvalid && name.find("valid") != std::string::npos) { | 209 | | // don't run the conversion step, it requires valid input | 210 | 0 | return; | 211 | 0 | } | 212 | | | 213 | | // step 3 - run the conversion | 214 | 303 | const auto [written, outputs_agree] = | 215 | 303 | do_conversion(from, output_length, inputisvalid); | 216 | 303 | if (!outputs_agree && !allow_implementations_to_differ) | 217 | 0 | break; | 218 | | | 219 | | // coming this far means no problems were found | 220 | 303 | return; | 221 | 303 | } while (0); | 222 | | // if we come here, something failed | 223 | 0 | std::cerr << "something failed, rerun with PRINT_FUZZ_CASE set to print a " | 224 | 0 | "reproducer to stderr\n"; | 225 | 0 | std::abort(); | 226 | 303 | } |
Conversion<(UtfEncodings)3, (UtfEncodings)1, unsigned long (simdutf::implementation::*)(char32_t const*, unsigned long) noexcept const, simdutf::result (simdutf::implementation::*)(char32_t const*, unsigned long, char16_t*) noexcept const>::fuzz(std::__1::span<char const, 18446744073709551615ul>) const Line | Count | Source | 175 | 358 | void fuzz(std::span<const char> chardata) const { | 176 | | // assume the input is aligned to FromType | 177 | 358 | const FromSpan from{reinterpret_cast<const FromType*>(chardata.data()), | 178 | 358 | chardata.size() / sizeof(FromType)}; | 179 | | | 180 | 358 | static const bool do_print_testcase = | 181 | 358 | std::getenv("PRINT_FUZZ_CASE") != nullptr; | 182 | | | 183 | 358 | if (do_print_testcase) { | 184 | 0 | dump_testcase(from, std::cerr); | 185 | 0 | std::exit(EXIT_SUCCESS); | 186 | 0 | } | 187 | | | 188 | 358 | do { | 189 | | // step 0 - is the input valid? | 190 | 358 | const auto [inputisvalid, valid_input_agree] = verify_valid_input(from); | 191 | 358 | if (!valid_input_agree && !allow_implementations_to_differ) | 192 | 0 | break; | 193 | | | 194 | | // step 1 - count the input (only makes sense for some of the encodings) | 195 | | if constexpr (From == UtfEncodings::UTF16BE || | 196 | | From == UtfEncodings::UTF16LE || | 197 | | From == UtfEncodings::UTF8) { | 198 | | if (!count_the_input(from) && !allow_implementations_to_differ) | 199 | | break; | 200 | | } | 201 | | | 202 | | // step 2 - what is the required size of the output? | 203 | 358 | const auto [output_length, length_agree] = | 204 | 358 | calculate_length(from, inputisvalid); | 205 | 358 | if (!length_agree && !allow_implementations_to_differ) | 206 | 0 | break; | 207 | | | 208 | 358 | if (!inputisvalid && name.find("valid") != std::string::npos) { | 209 | | // don't run the conversion step, it requires valid input | 210 | 0 | return; | 211 | 0 | } | 212 | | | 213 | | // step 3 - run the conversion | 214 | 358 | const auto [written, outputs_agree] = | 215 | 358 | do_conversion(from, output_length, inputisvalid); | 216 | 358 | if (!outputs_agree && !allow_implementations_to_differ) | 217 | 0 | break; | 218 | | | 219 | | // coming this far means no problems were found | 220 | 358 | return; | 221 | 358 | } while (0); | 222 | | // if we come here, something failed | 223 | 0 | std::cerr << "something failed, rerun with PRINT_FUZZ_CASE set to print a " | 224 | 0 | "reproducer to stderr\n"; | 225 | 0 | std::abort(); | 226 | 358 | } |
Conversion<(UtfEncodings)3, (UtfEncodings)2, unsigned long (simdutf::implementation::*)(char32_t const*, unsigned long) noexcept const, simdutf::result (simdutf::implementation::*)(char32_t const*, unsigned long, char*) noexcept const>::fuzz(std::__1::span<char const, 18446744073709551615ul>) const Line | Count | Source | 175 | 415 | void fuzz(std::span<const char> chardata) const { | 176 | | // assume the input is aligned to FromType | 177 | 415 | const FromSpan from{reinterpret_cast<const FromType*>(chardata.data()), | 178 | 415 | chardata.size() / sizeof(FromType)}; | 179 | | | 180 | 415 | static const bool do_print_testcase = | 181 | 415 | std::getenv("PRINT_FUZZ_CASE") != nullptr; | 182 | | | 183 | 415 | if (do_print_testcase) { | 184 | 0 | dump_testcase(from, std::cerr); | 185 | 0 | std::exit(EXIT_SUCCESS); | 186 | 0 | } | 187 | | | 188 | 415 | do { | 189 | | // step 0 - is the input valid? | 190 | 415 | const auto [inputisvalid, valid_input_agree] = verify_valid_input(from); | 191 | 415 | if (!valid_input_agree && !allow_implementations_to_differ) | 192 | 0 | break; | 193 | | | 194 | | // step 1 - count the input (only makes sense for some of the encodings) | 195 | | if constexpr (From == UtfEncodings::UTF16BE || | 196 | | From == UtfEncodings::UTF16LE || | 197 | | From == UtfEncodings::UTF8) { | 198 | | if (!count_the_input(from) && !allow_implementations_to_differ) | 199 | | break; | 200 | | } | 201 | | | 202 | | // step 2 - what is the required size of the output? | 203 | 415 | const auto [output_length, length_agree] = | 204 | 415 | calculate_length(from, inputisvalid); | 205 | 415 | if (!length_agree && !allow_implementations_to_differ) | 206 | 0 | break; | 207 | | | 208 | 415 | if (!inputisvalid && name.find("valid") != std::string::npos) { | 209 | | // don't run the conversion step, it requires valid input | 210 | 0 | return; | 211 | 0 | } | 212 | | | 213 | | // step 3 - run the conversion | 214 | 415 | const auto [written, outputs_agree] = | 215 | 415 | do_conversion(from, output_length, inputisvalid); | 216 | 415 | if (!outputs_agree && !allow_implementations_to_differ) | 217 | 0 | break; | 218 | | | 219 | | // coming this far means no problems were found | 220 | 415 | return; | 221 | 415 | } while (0); | 222 | | // if we come here, something failed | 223 | 0 | std::cerr << "something failed, rerun with PRINT_FUZZ_CASE set to print a " | 224 | 0 | "reproducer to stderr\n"; | 225 | 0 | std::abort(); | 226 | 415 | } |
Conversion<(UtfEncodings)2, (UtfEncodings)4, unsigned long (simdutf::implementation::*)(char const*, unsigned long) noexcept const, simdutf::result (simdutf::implementation::*)(char const*, unsigned long, char*) noexcept const>::fuzz(std::__1::span<char const, 18446744073709551615ul>) const Line | Count | Source | 175 | 258 | void fuzz(std::span<const char> chardata) const { | 176 | | // assume the input is aligned to FromType | 177 | 258 | const FromSpan from{reinterpret_cast<const FromType*>(chardata.data()), | 178 | 258 | chardata.size() / sizeof(FromType)}; | 179 | | | 180 | 258 | static const bool do_print_testcase = | 181 | 258 | std::getenv("PRINT_FUZZ_CASE") != nullptr; | 182 | | | 183 | 258 | if (do_print_testcase) { | 184 | 0 | dump_testcase(from, std::cerr); | 185 | 0 | std::exit(EXIT_SUCCESS); | 186 | 0 | } | 187 | | | 188 | 258 | do { | 189 | | // step 0 - is the input valid? | 190 | 258 | const auto [inputisvalid, valid_input_agree] = verify_valid_input(from); | 191 | 258 | if (!valid_input_agree && !allow_implementations_to_differ) | 192 | 0 | break; | 193 | | | 194 | | // step 1 - count the input (only makes sense for some of the encodings) | 195 | | if constexpr (From == UtfEncodings::UTF16BE || | 196 | | From == UtfEncodings::UTF16LE || | 197 | 258 | From == UtfEncodings::UTF8) { | 198 | 258 | if (!count_the_input(from) && !allow_implementations_to_differ) | 199 | 0 | break; | 200 | 258 | } | 201 | | | 202 | | // step 2 - what is the required size of the output? | 203 | 258 | const auto [output_length, length_agree] = | 204 | 258 | calculate_length(from, inputisvalid); | 205 | 258 | if (!length_agree && !allow_implementations_to_differ) | 206 | 0 | break; | 207 | | | 208 | 258 | if (!inputisvalid && name.find("valid") != std::string::npos) { | 209 | | // don't run the conversion step, it requires valid input | 210 | 0 | return; | 211 | 0 | } | 212 | | | 213 | | // step 3 - run the conversion | 214 | 258 | const auto [written, outputs_agree] = | 215 | 258 | do_conversion(from, output_length, inputisvalid); | 216 | 258 | if (!outputs_agree && !allow_implementations_to_differ) | 217 | 0 | break; | 218 | | | 219 | | // coming this far means no problems were found | 220 | 258 | return; | 221 | 258 | } while (0); | 222 | | // if we come here, something failed | 223 | 0 | std::cerr << "something failed, rerun with PRINT_FUZZ_CASE set to print a " | 224 | 0 | "reproducer to stderr\n"; | 225 | 0 | std::abort(); | 226 | 258 | } |
Conversion<(UtfEncodings)2, (UtfEncodings)0, unsigned long (simdutf::implementation::*)(char const*, unsigned long) noexcept const, simdutf::result (simdutf::implementation::*)(char const*, unsigned long, char16_t*) noexcept const>::fuzz(std::__1::span<char const, 18446744073709551615ul>) const Line | Count | Source | 175 | 351 | void fuzz(std::span<const char> chardata) const { | 176 | | // assume the input is aligned to FromType | 177 | 351 | const FromSpan from{reinterpret_cast<const FromType*>(chardata.data()), | 178 | 351 | chardata.size() / sizeof(FromType)}; | 179 | | | 180 | 351 | static const bool do_print_testcase = | 181 | 351 | std::getenv("PRINT_FUZZ_CASE") != nullptr; | 182 | | | 183 | 351 | if (do_print_testcase) { | 184 | 0 | dump_testcase(from, std::cerr); | 185 | 0 | std::exit(EXIT_SUCCESS); | 186 | 0 | } | 187 | | | 188 | 351 | do { | 189 | | // step 0 - is the input valid? | 190 | 351 | const auto [inputisvalid, valid_input_agree] = verify_valid_input(from); | 191 | 351 | if (!valid_input_agree && !allow_implementations_to_differ) | 192 | 0 | break; | 193 | | | 194 | | // step 1 - count the input (only makes sense for some of the encodings) | 195 | | if constexpr (From == UtfEncodings::UTF16BE || | 196 | | From == UtfEncodings::UTF16LE || | 197 | 351 | From == UtfEncodings::UTF8) { | 198 | 351 | if (!count_the_input(from) && !allow_implementations_to_differ) | 199 | 0 | break; | 200 | 351 | } | 201 | | | 202 | | // step 2 - what is the required size of the output? | 203 | 351 | const auto [output_length, length_agree] = | 204 | 351 | calculate_length(from, inputisvalid); | 205 | 351 | if (!length_agree && !allow_implementations_to_differ) | 206 | 0 | break; | 207 | | | 208 | 351 | if (!inputisvalid && name.find("valid") != std::string::npos) { | 209 | | // don't run the conversion step, it requires valid input | 210 | 0 | return; | 211 | 0 | } | 212 | | | 213 | | // step 3 - run the conversion | 214 | 351 | const auto [written, outputs_agree] = | 215 | 351 | do_conversion(from, output_length, inputisvalid); | 216 | 351 | if (!outputs_agree && !allow_implementations_to_differ) | 217 | 0 | break; | 218 | | | 219 | | // coming this far means no problems were found | 220 | 351 | return; | 221 | 351 | } while (0); | 222 | | // if we come here, something failed | 223 | 0 | std::cerr << "something failed, rerun with PRINT_FUZZ_CASE set to print a " | 224 | 0 | "reproducer to stderr\n"; | 225 | 0 | std::abort(); | 226 | 351 | } |
Conversion<(UtfEncodings)2, (UtfEncodings)1, unsigned long (simdutf::implementation::*)(char const*, unsigned long) noexcept const, simdutf::result (simdutf::implementation::*)(char const*, unsigned long, char16_t*) noexcept const>::fuzz(std::__1::span<char const, 18446744073709551615ul>) const Line | Count | Source | 175 | 287 | void fuzz(std::span<const char> chardata) const { | 176 | | // assume the input is aligned to FromType | 177 | 287 | const FromSpan from{reinterpret_cast<const FromType*>(chardata.data()), | 178 | 287 | chardata.size() / sizeof(FromType)}; | 179 | | | 180 | 287 | static const bool do_print_testcase = | 181 | 287 | std::getenv("PRINT_FUZZ_CASE") != nullptr; | 182 | | | 183 | 287 | if (do_print_testcase) { | 184 | 0 | dump_testcase(from, std::cerr); | 185 | 0 | std::exit(EXIT_SUCCESS); | 186 | 0 | } | 187 | | | 188 | 287 | do { | 189 | | // step 0 - is the input valid? | 190 | 287 | const auto [inputisvalid, valid_input_agree] = verify_valid_input(from); | 191 | 287 | if (!valid_input_agree && !allow_implementations_to_differ) | 192 | 0 | break; | 193 | | | 194 | | // step 1 - count the input (only makes sense for some of the encodings) | 195 | | if constexpr (From == UtfEncodings::UTF16BE || | 196 | | From == UtfEncodings::UTF16LE || | 197 | 287 | From == UtfEncodings::UTF8) { | 198 | 287 | if (!count_the_input(from) && !allow_implementations_to_differ) | 199 | 0 | break; | 200 | 287 | } | 201 | | | 202 | | // step 2 - what is the required size of the output? | 203 | 287 | const auto [output_length, length_agree] = | 204 | 287 | calculate_length(from, inputisvalid); | 205 | 287 | if (!length_agree && !allow_implementations_to_differ) | 206 | 0 | break; | 207 | | | 208 | 287 | if (!inputisvalid && name.find("valid") != std::string::npos) { | 209 | | // don't run the conversion step, it requires valid input | 210 | 0 | return; | 211 | 0 | } | 212 | | | 213 | | // step 3 - run the conversion | 214 | 287 | const auto [written, outputs_agree] = | 215 | 287 | do_conversion(from, output_length, inputisvalid); | 216 | 287 | if (!outputs_agree && !allow_implementations_to_differ) | 217 | 0 | break; | 218 | | | 219 | | // coming this far means no problems were found | 220 | 287 | return; | 221 | 287 | } while (0); | 222 | | // if we come here, something failed | 223 | 0 | std::cerr << "something failed, rerun with PRINT_FUZZ_CASE set to print a " | 224 | 0 | "reproducer to stderr\n"; | 225 | 0 | std::abort(); | 226 | 287 | } |
Conversion<(UtfEncodings)2, (UtfEncodings)3, unsigned long (simdutf::implementation::*)(char const*, unsigned long) noexcept const, simdutf::result (simdutf::implementation::*)(char const*, unsigned long, char32_t*) noexcept const>::fuzz(std::__1::span<char const, 18446744073709551615ul>) const Line | Count | Source | 175 | 369 | void fuzz(std::span<const char> chardata) const { | 176 | | // assume the input is aligned to FromType | 177 | 369 | const FromSpan from{reinterpret_cast<const FromType*>(chardata.data()), | 178 | 369 | chardata.size() / sizeof(FromType)}; | 179 | | | 180 | 369 | static const bool do_print_testcase = | 181 | 369 | std::getenv("PRINT_FUZZ_CASE") != nullptr; | 182 | | | 183 | 369 | if (do_print_testcase) { | 184 | 0 | dump_testcase(from, std::cerr); | 185 | 0 | std::exit(EXIT_SUCCESS); | 186 | 0 | } | 187 | | | 188 | 369 | do { | 189 | | // step 0 - is the input valid? | 190 | 369 | const auto [inputisvalid, valid_input_agree] = verify_valid_input(from); | 191 | 369 | if (!valid_input_agree && !allow_implementations_to_differ) | 192 | 0 | break; | 193 | | | 194 | | // step 1 - count the input (only makes sense for some of the encodings) | 195 | | if constexpr (From == UtfEncodings::UTF16BE || | 196 | | From == UtfEncodings::UTF16LE || | 197 | 369 | From == UtfEncodings::UTF8) { | 198 | 369 | if (!count_the_input(from) && !allow_implementations_to_differ) | 199 | 0 | break; | 200 | 369 | } | 201 | | | 202 | | // step 2 - what is the required size of the output? | 203 | 369 | const auto [output_length, length_agree] = | 204 | 369 | calculate_length(from, inputisvalid); | 205 | 369 | if (!length_agree && !allow_implementations_to_differ) | 206 | 0 | break; | 207 | | | 208 | 369 | if (!inputisvalid && name.find("valid") != std::string::npos) { | 209 | | // don't run the conversion step, it requires valid input | 210 | 0 | return; | 211 | 0 | } | 212 | | | 213 | | // step 3 - run the conversion | 214 | 369 | const auto [written, outputs_agree] = | 215 | 369 | do_conversion(from, output_length, inputisvalid); | 216 | 369 | if (!outputs_agree && !allow_implementations_to_differ) | 217 | 0 | break; | 218 | | | 219 | | // coming this far means no problems were found | 220 | 369 | return; | 221 | 369 | } while (0); | 222 | | // if we come here, something failed | 223 | 0 | std::cerr << "something failed, rerun with PRINT_FUZZ_CASE set to print a " | 224 | 0 | "reproducer to stderr\n"; | 225 | 0 | std::abort(); | 226 | 369 | } |
Conversion<(UtfEncodings)4, (UtfEncodings)3, unsigned long (simdutf::implementation::*)(unsigned long) noexcept const, unsigned long (simdutf::implementation::*)(char const*, unsigned long, char32_t*) noexcept const>::fuzz(std::__1::span<char const, 18446744073709551615ul>) const Line | Count | Source | 175 | 45 | void fuzz(std::span<const char> chardata) const { | 176 | | // assume the input is aligned to FromType | 177 | 45 | const FromSpan from{reinterpret_cast<const FromType*>(chardata.data()), | 178 | 45 | chardata.size() / sizeof(FromType)}; | 179 | | | 180 | 45 | static const bool do_print_testcase = | 181 | 45 | std::getenv("PRINT_FUZZ_CASE") != nullptr; | 182 | | | 183 | 45 | if (do_print_testcase) { | 184 | 0 | dump_testcase(from, std::cerr); | 185 | 0 | std::exit(EXIT_SUCCESS); | 186 | 0 | } | 187 | | | 188 | 45 | do { | 189 | | // step 0 - is the input valid? | 190 | 45 | const auto [inputisvalid, valid_input_agree] = verify_valid_input(from); | 191 | 45 | if (!valid_input_agree && !allow_implementations_to_differ) | 192 | 0 | break; | 193 | | | 194 | | // step 1 - count the input (only makes sense for some of the encodings) | 195 | | if constexpr (From == UtfEncodings::UTF16BE || | 196 | | From == UtfEncodings::UTF16LE || | 197 | | From == UtfEncodings::UTF8) { | 198 | | if (!count_the_input(from) && !allow_implementations_to_differ) | 199 | | break; | 200 | | } | 201 | | | 202 | | // step 2 - what is the required size of the output? | 203 | 45 | const auto [output_length, length_agree] = | 204 | 45 | calculate_length(from, inputisvalid); | 205 | 45 | if (!length_agree && !allow_implementations_to_differ) | 206 | 0 | break; | 207 | | | 208 | 45 | if (!inputisvalid && name.find("valid") != std::string::npos) { | 209 | | // don't run the conversion step, it requires valid input | 210 | 0 | return; | 211 | 0 | } | 212 | | | 213 | | // step 3 - run the conversion | 214 | 45 | const auto [written, outputs_agree] = | 215 | 45 | do_conversion(from, output_length, inputisvalid); | 216 | 45 | if (!outputs_agree && !allow_implementations_to_differ) | 217 | 0 | break; | 218 | | | 219 | | // coming this far means no problems were found | 220 | 45 | return; | 221 | 45 | } while (0); | 222 | | // if we come here, something failed | 223 | 0 | std::cerr << "something failed, rerun with PRINT_FUZZ_CASE set to print a " | 224 | 0 | "reproducer to stderr\n"; | 225 | 0 | std::abort(); | 226 | 45 | } |
Conversion<(UtfEncodings)4, (UtfEncodings)0, unsigned long (simdutf::implementation::*)(unsigned long) noexcept const, unsigned long (simdutf::implementation::*)(char const*, unsigned long, char16_t*) noexcept const>::fuzz(std::__1::span<char const, 18446744073709551615ul>) const Line | Count | Source | 175 | 40 | void fuzz(std::span<const char> chardata) const { | 176 | | // assume the input is aligned to FromType | 177 | 40 | const FromSpan from{reinterpret_cast<const FromType*>(chardata.data()), | 178 | 40 | chardata.size() / sizeof(FromType)}; | 179 | | | 180 | 40 | static const bool do_print_testcase = | 181 | 40 | std::getenv("PRINT_FUZZ_CASE") != nullptr; | 182 | | | 183 | 40 | if (do_print_testcase) { | 184 | 0 | dump_testcase(from, std::cerr); | 185 | 0 | std::exit(EXIT_SUCCESS); | 186 | 0 | } | 187 | | | 188 | 40 | do { | 189 | | // step 0 - is the input valid? | 190 | 40 | const auto [inputisvalid, valid_input_agree] = verify_valid_input(from); | 191 | 40 | if (!valid_input_agree && !allow_implementations_to_differ) | 192 | 0 | break; | 193 | | | 194 | | // step 1 - count the input (only makes sense for some of the encodings) | 195 | | if constexpr (From == UtfEncodings::UTF16BE || | 196 | | From == UtfEncodings::UTF16LE || | 197 | | From == UtfEncodings::UTF8) { | 198 | | if (!count_the_input(from) && !allow_implementations_to_differ) | 199 | | break; | 200 | | } | 201 | | | 202 | | // step 2 - what is the required size of the output? | 203 | 40 | const auto [output_length, length_agree] = | 204 | 40 | calculate_length(from, inputisvalid); | 205 | 40 | if (!length_agree && !allow_implementations_to_differ) | 206 | 0 | break; | 207 | | | 208 | 40 | if (!inputisvalid && name.find("valid") != std::string::npos) { | 209 | | // don't run the conversion step, it requires valid input | 210 | 0 | return; | 211 | 0 | } | 212 | | | 213 | | // step 3 - run the conversion | 214 | 40 | const auto [written, outputs_agree] = | 215 | 40 | do_conversion(from, output_length, inputisvalid); | 216 | 40 | if (!outputs_agree && !allow_implementations_to_differ) | 217 | 0 | break; | 218 | | | 219 | | // coming this far means no problems were found | 220 | 40 | return; | 221 | 40 | } while (0); | 222 | | // if we come here, something failed | 223 | 0 | std::cerr << "something failed, rerun with PRINT_FUZZ_CASE set to print a " | 224 | 0 | "reproducer to stderr\n"; | 225 | 0 | std::abort(); | 226 | 40 | } |
Conversion<(UtfEncodings)4, (UtfEncodings)1, unsigned long (simdutf::implementation::*)(unsigned long) noexcept const, unsigned long (simdutf::implementation::*)(char const*, unsigned long, char16_t*) noexcept const>::fuzz(std::__1::span<char const, 18446744073709551615ul>) const Line | Count | Source | 175 | 40 | void fuzz(std::span<const char> chardata) const { | 176 | | // assume the input is aligned to FromType | 177 | 40 | const FromSpan from{reinterpret_cast<const FromType*>(chardata.data()), | 178 | 40 | chardata.size() / sizeof(FromType)}; | 179 | | | 180 | 40 | static const bool do_print_testcase = | 181 | 40 | std::getenv("PRINT_FUZZ_CASE") != nullptr; | 182 | | | 183 | 40 | if (do_print_testcase) { | 184 | 0 | dump_testcase(from, std::cerr); | 185 | 0 | std::exit(EXIT_SUCCESS); | 186 | 0 | } | 187 | | | 188 | 40 | do { | 189 | | // step 0 - is the input valid? | 190 | 40 | const auto [inputisvalid, valid_input_agree] = verify_valid_input(from); | 191 | 40 | if (!valid_input_agree && !allow_implementations_to_differ) | 192 | 0 | break; | 193 | | | 194 | | // step 1 - count the input (only makes sense for some of the encodings) | 195 | | if constexpr (From == UtfEncodings::UTF16BE || | 196 | | From == UtfEncodings::UTF16LE || | 197 | | From == UtfEncodings::UTF8) { | 198 | | if (!count_the_input(from) && !allow_implementations_to_differ) | 199 | | break; | 200 | | } | 201 | | | 202 | | // step 2 - what is the required size of the output? | 203 | 40 | const auto [output_length, length_agree] = | 204 | 40 | calculate_length(from, inputisvalid); | 205 | 40 | if (!length_agree && !allow_implementations_to_differ) | 206 | 0 | break; | 207 | | | 208 | 40 | if (!inputisvalid && name.find("valid") != std::string::npos) { | 209 | | // don't run the conversion step, it requires valid input | 210 | 0 | return; | 211 | 0 | } | 212 | | | 213 | | // step 3 - run the conversion | 214 | 40 | const auto [written, outputs_agree] = | 215 | 40 | do_conversion(from, output_length, inputisvalid); | 216 | 40 | if (!outputs_agree && !allow_implementations_to_differ) | 217 | 0 | break; | 218 | | | 219 | | // coming this far means no problems were found | 220 | 40 | return; | 221 | 40 | } while (0); | 222 | | // if we come here, something failed | 223 | 0 | std::cerr << "something failed, rerun with PRINT_FUZZ_CASE set to print a " | 224 | 0 | "reproducer to stderr\n"; | 225 | 0 | std::abort(); | 226 | 40 | } |
Conversion<(UtfEncodings)4, (UtfEncodings)2, unsigned long (simdutf::implementation::*)(char const*, unsigned long) noexcept const, unsigned long (simdutf::implementation::*)(char const*, unsigned long, char*) noexcept const>::fuzz(std::__1::span<char const, 18446744073709551615ul>) const Line | Count | Source | 175 | 269 | void fuzz(std::span<const char> chardata) const { | 176 | | // assume the input is aligned to FromType | 177 | 269 | const FromSpan from{reinterpret_cast<const FromType*>(chardata.data()), | 178 | 269 | chardata.size() / sizeof(FromType)}; | 179 | | | 180 | 269 | static const bool do_print_testcase = | 181 | 269 | std::getenv("PRINT_FUZZ_CASE") != nullptr; | 182 | | | 183 | 269 | if (do_print_testcase) { | 184 | 0 | dump_testcase(from, std::cerr); | 185 | 0 | std::exit(EXIT_SUCCESS); | 186 | 0 | } | 187 | | | 188 | 269 | do { | 189 | | // step 0 - is the input valid? | 190 | 269 | const auto [inputisvalid, valid_input_agree] = verify_valid_input(from); | 191 | 269 | if (!valid_input_agree && !allow_implementations_to_differ) | 192 | 0 | break; | 193 | | | 194 | | // step 1 - count the input (only makes sense for some of the encodings) | 195 | | if constexpr (From == UtfEncodings::UTF16BE || | 196 | | From == UtfEncodings::UTF16LE || | 197 | | From == UtfEncodings::UTF8) { | 198 | | if (!count_the_input(from) && !allow_implementations_to_differ) | 199 | | break; | 200 | | } | 201 | | | 202 | | // step 2 - what is the required size of the output? | 203 | 269 | const auto [output_length, length_agree] = | 204 | 269 | calculate_length(from, inputisvalid); | 205 | 269 | if (!length_agree && !allow_implementations_to_differ) | 206 | 0 | break; | 207 | | | 208 | 269 | if (!inputisvalid && name.find("valid") != std::string::npos) { | 209 | | // don't run the conversion step, it requires valid input | 210 | 0 | return; | 211 | 0 | } | 212 | | | 213 | | // step 3 - run the conversion | 214 | 269 | const auto [written, outputs_agree] = | 215 | 269 | do_conversion(from, output_length, inputisvalid); | 216 | 269 | if (!outputs_agree && !allow_implementations_to_differ) | 217 | 0 | break; | 218 | | | 219 | | // coming this far means no problems were found | 220 | 269 | return; | 221 | 269 | } while (0); | 222 | | // if we come here, something failed | 223 | 0 | std::cerr << "something failed, rerun with PRINT_FUZZ_CASE set to print a " | 224 | 0 | "reproducer to stderr\n"; | 225 | 0 | std::abort(); | 226 | 269 | } |
|
227 | | |
228 | | template <typename Dummy = void> |
229 | | requires(From != UtfEncodings::LATIN1) |
230 | 8.18k | validation_result verify_valid_input(FromSpan src) const { |
231 | 8.18k | validation_result ret{}; |
232 | | |
233 | 8.18k | auto input_validation = ValidationFunctionTrait<From>::ValidationWithErrors; |
234 | 8.18k | const auto implementations = get_supported_implementations(); |
235 | 8.18k | std::vector<simdutf::result> results; |
236 | 8.18k | results.reserve(implementations.size()); |
237 | | |
238 | 24.5k | for (auto impl : implementations) { |
239 | 24.5k | results.push_back( |
240 | 24.5k | std::invoke(input_validation, impl, src.data(), src.size())); |
241 | | |
242 | | // make sure the validation variant that returns a bool agrees |
243 | 24.5k | const bool validation1 = results.back().error == simdutf::SUCCESS; |
244 | 24.5k | const bool validation2 = |
245 | 24.5k | std::invoke(ValidationFunctionTrait<From>::Validation, impl, |
246 | 24.5k | src.data(), src.size()); |
247 | 24.5k | if (validation1 != validation2) { |
248 | 0 | std::cerr << "begin errormessage for verify_valid_input()\n"; |
249 | 0 | std::cerr << ValidationFunctionTrait<From>::ValidationWithErrorsName |
250 | 0 | << " gives " << validation1 << " while " |
251 | 0 | << ValidationFunctionTrait<From>::ValidationName << " gave " |
252 | 0 | << validation2 << " for implementation " << impl->name() |
253 | 0 | << '\n'; |
254 | 0 | std::cerr << "end errormessage\n"; |
255 | 0 | std::abort(); |
256 | 0 | } |
257 | 24.5k | } |
258 | | |
259 | 16.3k | auto neq = [](const auto& a, const auto& b) { return a != b; };_ZZNK10ConversionIL12UtfEncodings0ELS0_3EMN7simdutf14implementationEKDoFmPKDsmEMS2_KDoFmS4_mPDiEE18verify_valid_inputIvQneT_LS0_4EEENSA_17validation_resultENSt3__14spanIS3_Lm18446744073709551615EEEENKUlRKT_RKT0_E_clINS1_6resultESO_EEDaSI_SL_ Line | Count | Source | 259 | 402 | auto neq = [](const auto& a, const auto& b) { return a != b; }; |
_ZZNK10ConversionIL12UtfEncodings0ELS0_2EMN7simdutf14implementationEKDoFmPKDsmEMS2_KDoFmS4_mPcEE18verify_valid_inputIvQneT_LS0_4EEENSA_17validation_resultENSt3__14spanIS3_Lm18446744073709551615EEEENKUlRKT_RKT0_E_clINS1_6resultESO_EEDaSI_SL_ Line | Count | Source | 259 | 806 | auto neq = [](const auto& a, const auto& b) { return a != b; }; |
_ZZNK10ConversionIL12UtfEncodings1ELS0_3EMN7simdutf14implementationEKDoFmPKDsmEMS2_KDoFmS4_mPDiEE18verify_valid_inputIvQneT_LS0_4EEENSA_17validation_resultENSt3__14spanIS3_Lm18446744073709551615EEEENKUlRKT_RKT0_E_clINS1_6resultESO_EEDaSI_SL_ Line | Count | Source | 259 | 394 | auto neq = [](const auto& a, const auto& b) { return a != b; }; |
_ZZNK10ConversionIL12UtfEncodings1ELS0_2EMN7simdutf14implementationEKDoFmPKDsmEMS2_KDoFmS4_mPcEE18verify_valid_inputIvQneT_LS0_4EEENSA_17validation_resultENSt3__14spanIS3_Lm18446744073709551615EEEENKUlRKT_RKT0_E_clINS1_6resultESO_EEDaSI_SL_ Line | Count | Source | 259 | 824 | auto neq = [](const auto& a, const auto& b) { return a != b; }; |
_ZZNK10ConversionIL12UtfEncodings3ELS0_0EMN7simdutf14implementationEKDoFmPKDimEMS2_KDoFmS4_mPDsEE18verify_valid_inputIvQneT_LS0_4EEENSA_17validation_resultENSt3__14spanIS3_Lm18446744073709551615EEEENKUlRKT_RKT0_E_clINS1_6resultESO_EEDaSI_SL_ Line | Count | Source | 259 | 536 | auto neq = [](const auto& a, const auto& b) { return a != b; }; |
_ZZNK10ConversionIL12UtfEncodings3ELS0_1EMN7simdutf14implementationEKDoFmPKDimEMS2_KDoFmS4_mPDsEE18verify_valid_inputIvQneT_LS0_4EEENSA_17validation_resultENSt3__14spanIS3_Lm18446744073709551615EEEENKUlRKT_RKT0_E_clINS1_6resultESO_EEDaSI_SL_ Line | Count | Source | 259 | 732 | auto neq = [](const auto& a, const auto& b) { return a != b; }; |
_ZZNK10ConversionIL12UtfEncodings3ELS0_2EMN7simdutf14implementationEKDoFmPKDimEMS2_KDoFmS4_mPcEE18verify_valid_inputIvQneT_LS0_4EEENSA_17validation_resultENSt3__14spanIS3_Lm18446744073709551615EEEENKUlRKT_RKT0_E_clINS1_6resultESO_EEDaSI_SL_ Line | Count | Source | 259 | 808 | auto neq = [](const auto& a, const auto& b) { return a != b; }; |
_ZZNK10ConversionIL12UtfEncodings2ELS0_0EMN7simdutf14implementationEKDoFmPKcmEMS2_KDoFmS4_mPDsEE18verify_valid_inputIvQneT_LS0_4EEENSA_17validation_resultENSt3__14spanIS3_Lm18446744073709551615EEEENKUlRKT_RKT0_E_clINS1_6resultESO_EEDaSI_SL_ Line | Count | Source | 259 | 1.16k | auto neq = [](const auto& a, const auto& b) { return a != b; }; |
_ZZNK10ConversionIL12UtfEncodings2ELS0_1EMN7simdutf14implementationEKDoFmPKcmEMS2_KDoFmS4_mPDsEE18verify_valid_inputIvQneT_LS0_4EEENSA_17validation_resultENSt3__14spanIS3_Lm18446744073709551615EEEENKUlRKT_RKT0_E_clINS1_6resultESO_EEDaSI_SL_ Line | Count | Source | 259 | 1.05k | auto neq = [](const auto& a, const auto& b) { return a != b; }; |
_ZZNK10ConversionIL12UtfEncodings2ELS0_3EMN7simdutf14implementationEKDoFmPKcmEMS2_KDoFmS4_mPDiEE18verify_valid_inputIvQneT_LS0_4EEENSA_17validation_resultENSt3__14spanIS3_Lm18446744073709551615EEEENKUlRKT_RKT0_E_clINS1_6resultESO_EEDaSI_SL_ Line | Count | Source | 259 | 1.12k | auto neq = [](const auto& a, const auto& b) { return a != b; }; |
_ZZNK10ConversionIL12UtfEncodings0ELS0_4EMN7simdutf14implementationEKDoFmmEMS2_KDoFmPKDsmPcEE18verify_valid_inputIvQneT_LS0_4EEENSA_17validation_resultENSt3__14spanIS5_Lm18446744073709551615EEEENKUlRKT_RKT0_E_clINS1_6resultESO_EEDaSI_SL_ Line | Count | Source | 259 | 126 | auto neq = [](const auto& a, const auto& b) { return a != b; }; |
_ZZNK10ConversionIL12UtfEncodings1ELS0_4EMN7simdutf14implementationEKDoFmmEMS2_KDoFmPKDsmPcEE18verify_valid_inputIvQneT_LS0_4EEENSA_17validation_resultENSt3__14spanIS5_Lm18446744073709551615EEEENKUlRKT_RKT0_E_clINS1_6resultESO_EEDaSI_SL_ Line | Count | Source | 259 | 124 | auto neq = [](const auto& a, const auto& b) { return a != b; }; |
_ZZNK10ConversionIL12UtfEncodings3ELS0_4EMN7simdutf14implementationEKDoFmmEMS2_KDoFmPKDimPcEE18verify_valid_inputIvQneT_LS0_4EEENSA_17validation_resultENSt3__14spanIS5_Lm18446744073709551615EEEENKUlRKT_RKT0_E_clINS1_6resultESO_EEDaSI_SL_ Line | Count | Source | 259 | 188 | auto neq = [](const auto& a, const auto& b) { return a != b; }; |
_ZZNK10ConversionIL12UtfEncodings2ELS0_4EMN7simdutf14implementationEKDoFmPKcmEMS2_KDoFmS4_mPcEE18verify_valid_inputIvQneT_LS0_4EEENSA_17validation_resultENSt3__14spanIS3_Lm18446744073709551615EEEENKUlRKT_RKT0_E_clINS1_6resultESO_EEDaSI_SL_ Line | Count | Source | 259 | 562 | auto neq = [](const auto& a, const auto& b) { return a != b; }; |
_ZZNK10ConversionIL12UtfEncodings0ELS0_4EMN7simdutf14implementationEKDoFmmEMS2_KDoFNS1_6resultEPKDsmPcEE18verify_valid_inputIvQneT_LS0_4EEENSB_17validation_resultENSt3__14spanIS6_Lm18446744073709551615EEEENKUlRKT_RKT0_E_clIS5_S5_EEDaSJ_SM_ Line | Count | Source | 259 | 252 | auto neq = [](const auto& a, const auto& b) { return a != b; }; |
_ZZNK10ConversionIL12UtfEncodings0ELS0_3EMN7simdutf14implementationEKDoFmPKDsmEMS2_KDoFNS1_6resultES4_mPDiEE18verify_valid_inputIvQneT_LS0_4EEENSB_17validation_resultENSt3__14spanIS3_Lm18446744073709551615EEEENKUlRKT_RKT0_E_clIS7_S7_EEDaSJ_SM_ Line | Count | Source | 259 | 300 | auto neq = [](const auto& a, const auto& b) { return a != b; }; |
_ZZNK10ConversionIL12UtfEncodings0ELS0_2EMN7simdutf14implementationEKDoFmPKDsmEMS2_KDoFNS1_6resultES4_mPcEE18verify_valid_inputIvQneT_LS0_4EEENSB_17validation_resultENSt3__14spanIS3_Lm18446744073709551615EEEENKUlRKT_RKT0_E_clIS7_S7_EEDaSJ_SM_ Line | Count | Source | 259 | 586 | auto neq = [](const auto& a, const auto& b) { return a != b; }; |
_ZZNK10ConversionIL12UtfEncodings1ELS0_4EMN7simdutf14implementationEKDoFmmEMS2_KDoFNS1_6resultEPKDsmPcEE18verify_valid_inputIvQneT_LS0_4EEENSB_17validation_resultENSt3__14spanIS6_Lm18446744073709551615EEEENKUlRKT_RKT0_E_clIS5_S5_EEDaSJ_SM_ Line | Count | Source | 259 | 230 | auto neq = [](const auto& a, const auto& b) { return a != b; }; |
_ZZNK10ConversionIL12UtfEncodings1ELS0_3EMN7simdutf14implementationEKDoFmPKDsmEMS2_KDoFNS1_6resultES4_mPDiEE18verify_valid_inputIvQneT_LS0_4EEENSB_17validation_resultENSt3__14spanIS3_Lm18446744073709551615EEEENKUlRKT_RKT0_E_clIS7_S7_EEDaSJ_SM_ Line | Count | Source | 259 | 414 | auto neq = [](const auto& a, const auto& b) { return a != b; }; |
_ZZNK10ConversionIL12UtfEncodings1ELS0_2EMN7simdutf14implementationEKDoFmPKDsmEMS2_KDoFNS1_6resultES4_mPcEE18verify_valid_inputIvQneT_LS0_4EEENSB_17validation_resultENSt3__14spanIS3_Lm18446744073709551615EEEENKUlRKT_RKT0_E_clIS7_S7_EEDaSJ_SM_ Line | Count | Source | 259 | 630 | auto neq = [](const auto& a, const auto& b) { return a != b; }; |
_ZZNK10ConversionIL12UtfEncodings3ELS0_4EMN7simdutf14implementationEKDoFmmEMS2_KDoFNS1_6resultEPKDimPcEE18verify_valid_inputIvQneT_LS0_4EEENSB_17validation_resultENSt3__14spanIS6_Lm18446744073709551615EEEENKUlRKT_RKT0_E_clIS5_S5_EEDaSJ_SM_ Line | Count | Source | 259 | 420 | auto neq = [](const auto& a, const auto& b) { return a != b; }; |
_ZZNK10ConversionIL12UtfEncodings3ELS0_0EMN7simdutf14implementationEKDoFmPKDimEMS2_KDoFNS1_6resultES4_mPDsEE18verify_valid_inputIvQneT_LS0_4EEENSB_17validation_resultENSt3__14spanIS3_Lm18446744073709551615EEEENKUlRKT_RKT0_E_clIS7_S7_EEDaSJ_SM_ Line | Count | Source | 259 | 606 | auto neq = [](const auto& a, const auto& b) { return a != b; }; |
_ZZNK10ConversionIL12UtfEncodings3ELS0_1EMN7simdutf14implementationEKDoFmPKDimEMS2_KDoFNS1_6resultES4_mPDsEE18verify_valid_inputIvQneT_LS0_4EEENSB_17validation_resultENSt3__14spanIS3_Lm18446744073709551615EEEENKUlRKT_RKT0_E_clIS7_S7_EEDaSJ_SM_ Line | Count | Source | 259 | 716 | auto neq = [](const auto& a, const auto& b) { return a != b; }; |
_ZZNK10ConversionIL12UtfEncodings3ELS0_2EMN7simdutf14implementationEKDoFmPKDimEMS2_KDoFNS1_6resultES4_mPcEE18verify_valid_inputIvQneT_LS0_4EEENSB_17validation_resultENSt3__14spanIS3_Lm18446744073709551615EEEENKUlRKT_RKT0_E_clIS7_S7_EEDaSJ_SM_ Line | Count | Source | 259 | 830 | auto neq = [](const auto& a, const auto& b) { return a != b; }; |
_ZZNK10ConversionIL12UtfEncodings2ELS0_4EMN7simdutf14implementationEKDoFmPKcmEMS2_KDoFNS1_6resultES4_mPcEE18verify_valid_inputIvQneT_LS0_4EEENSB_17validation_resultENSt3__14spanIS3_Lm18446744073709551615EEEENKUlRKT_RKT0_E_clIS7_S7_EEDaSJ_SM_ Line | Count | Source | 259 | 516 | auto neq = [](const auto& a, const auto& b) { return a != b; }; |
_ZZNK10ConversionIL12UtfEncodings2ELS0_0EMN7simdutf14implementationEKDoFmPKcmEMS2_KDoFNS1_6resultES4_mPDsEE18verify_valid_inputIvQneT_LS0_4EEENSB_17validation_resultENSt3__14spanIS3_Lm18446744073709551615EEEENKUlRKT_RKT0_E_clIS7_S7_EEDaSJ_SM_ Line | Count | Source | 259 | 702 | auto neq = [](const auto& a, const auto& b) { return a != b; }; |
_ZZNK10ConversionIL12UtfEncodings2ELS0_1EMN7simdutf14implementationEKDoFmPKcmEMS2_KDoFNS1_6resultES4_mPDsEE18verify_valid_inputIvQneT_LS0_4EEENSB_17validation_resultENSt3__14spanIS3_Lm18446744073709551615EEEENKUlRKT_RKT0_E_clIS7_S7_EEDaSJ_SM_ Line | Count | Source | 259 | 574 | auto neq = [](const auto& a, const auto& b) { return a != b; }; |
_ZZNK10ConversionIL12UtfEncodings2ELS0_3EMN7simdutf14implementationEKDoFmPKcmEMS2_KDoFNS1_6resultES4_mPDiEE18verify_valid_inputIvQneT_LS0_4EEENSB_17validation_resultENSt3__14spanIS3_Lm18446744073709551615EEEENKUlRKT_RKT0_E_clIS7_S7_EEDaSJ_SM_ Line | Count | Source | 259 | 738 | auto neq = [](const auto& a, const auto& b) { return a != b; }; |
|
260 | 8.18k | if (std::ranges::adjacent_find(results, neq) != results.end()) { |
261 | 0 | std::cerr << "begin errormessage for verify_valid_input()\n"; |
262 | 0 | std::cerr << "in fuzz case for " |
263 | 0 | << ValidationFunctionTrait<From>::ValidationWithErrorsName |
264 | 0 | << " invoked with " << src.size() << " elements:\n"; |
265 | 0 | for (std::size_t i = 0; i < results.size(); ++i) { |
266 | 0 | std::cerr << "got return " << std::dec << results[i] |
267 | 0 | << " from implementation " << implementations[i]->name() |
268 | 0 | << '\n'; |
269 | 0 | } |
270 | 0 | std::cerr << "end errormessage\n"; |
271 | 0 | ret.implementations_agree = false; |
272 | 8.18k | } else { |
273 | 8.18k | ret.implementations_agree = true; |
274 | 8.18k | } |
275 | 16.4k | ret.valid = std::ranges::all_of(results, [](const simdutf::result& r) { |
276 | 16.4k | return r.error == simdutf::SUCCESS; |
277 | 16.4k | }); _ZZNK10ConversionIL12UtfEncodings0ELS0_3EMN7simdutf14implementationEKDoFmPKDsmEMS2_KDoFmS4_mPDiEE18verify_valid_inputIvQneT_LS0_4EEENSA_17validation_resultENSt3__14spanIS3_Lm18446744073709551615EEEENKUlRKNS1_6resultEE_clESI_ Line | Count | Source | 275 | 419 | ret.valid = std::ranges::all_of(results, [](const simdutf::result& r) { | 276 | 419 | return r.error == simdutf::SUCCESS; | 277 | 419 | }); |
_ZZNK10ConversionIL12UtfEncodings0ELS0_2EMN7simdutf14implementationEKDoFmPKDsmEMS2_KDoFmS4_mPcEE18verify_valid_inputIvQneT_LS0_4EEENSA_17validation_resultENSt3__14spanIS3_Lm18446744073709551615EEEENKUlRKNS1_6resultEE_clESI_ Line | Count | Source | 275 | 1.03k | ret.valid = std::ranges::all_of(results, [](const simdutf::result& r) { | 276 | 1.03k | return r.error == simdutf::SUCCESS; | 277 | 1.03k | }); |
_ZZNK10ConversionIL12UtfEncodings1ELS0_3EMN7simdutf14implementationEKDoFmPKDsmEMS2_KDoFmS4_mPDiEE18verify_valid_inputIvQneT_LS0_4EEENSA_17validation_resultENSt3__14spanIS3_Lm18446744073709551615EEEENKUlRKNS1_6resultEE_clESI_ Line | Count | Source | 275 | 411 | ret.valid = std::ranges::all_of(results, [](const simdutf::result& r) { | 276 | 411 | return r.error == simdutf::SUCCESS; | 277 | 411 | }); |
_ZZNK10ConversionIL12UtfEncodings1ELS0_2EMN7simdutf14implementationEKDoFmPKDsmEMS2_KDoFmS4_mPcEE18verify_valid_inputIvQneT_LS0_4EEENSA_17validation_resultENSt3__14spanIS3_Lm18446744073709551615EEEENKUlRKNS1_6resultEE_clESI_ Line | Count | Source | 275 | 1.05k | ret.valid = std::ranges::all_of(results, [](const simdutf::result& r) { | 276 | 1.05k | return r.error == simdutf::SUCCESS; | 277 | 1.05k | }); |
_ZZNK10ConversionIL12UtfEncodings3ELS0_0EMN7simdutf14implementationEKDoFmPKDimEMS2_KDoFmS4_mPDsEE18verify_valid_inputIvQneT_LS0_4EEENSA_17validation_resultENSt3__14spanIS3_Lm18446744073709551615EEEENKUlRKNS1_6resultEE_clESI_ Line | Count | Source | 275 | 468 | ret.valid = std::ranges::all_of(results, [](const simdutf::result& r) { | 276 | 468 | return r.error == simdutf::SUCCESS; | 277 | 468 | }); |
_ZZNK10ConversionIL12UtfEncodings3ELS0_1EMN7simdutf14implementationEKDoFmPKDimEMS2_KDoFmS4_mPDsEE18verify_valid_inputIvQneT_LS0_4EEENSA_17validation_resultENSt3__14spanIS3_Lm18446744073709551615EEEENKUlRKNS1_6resultEE_clESI_ Line | Count | Source | 275 | 806 | ret.valid = std::ranges::all_of(results, [](const simdutf::result& r) { | 276 | 806 | return r.error == simdutf::SUCCESS; | 277 | 806 | }); |
_ZZNK10ConversionIL12UtfEncodings3ELS0_2EMN7simdutf14implementationEKDoFmPKDimEMS2_KDoFmS4_mPcEE18verify_valid_inputIvQneT_LS0_4EEENSA_17validation_resultENSt3__14spanIS3_Lm18446744073709551615EEEENKUlRKNS1_6resultEE_clESI_ Line | Count | Source | 275 | 700 | ret.valid = std::ranges::all_of(results, [](const simdutf::result& r) { | 276 | 700 | return r.error == simdutf::SUCCESS; | 277 | 700 | }); |
_ZZNK10ConversionIL12UtfEncodings2ELS0_0EMN7simdutf14implementationEKDoFmPKcmEMS2_KDoFmS4_mPDsEE18verify_valid_inputIvQneT_LS0_4EEENSA_17validation_resultENSt3__14spanIS3_Lm18446744073709551615EEEENKUlRKNS1_6resultEE_clESI_ Line | Count | Source | 275 | 1.21k | ret.valid = std::ranges::all_of(results, [](const simdutf::result& r) { | 276 | 1.21k | return r.error == simdutf::SUCCESS; | 277 | 1.21k | }); |
_ZZNK10ConversionIL12UtfEncodings2ELS0_1EMN7simdutf14implementationEKDoFmPKcmEMS2_KDoFmS4_mPDsEE18verify_valid_inputIvQneT_LS0_4EEENSA_17validation_resultENSt3__14spanIS3_Lm18446744073709551615EEEENKUlRKNS1_6resultEE_clESI_ Line | Count | Source | 275 | 1.12k | ret.valid = std::ranges::all_of(results, [](const simdutf::result& r) { | 276 | 1.12k | return r.error == simdutf::SUCCESS; | 277 | 1.12k | }); |
_ZZNK10ConversionIL12UtfEncodings2ELS0_3EMN7simdutf14implementationEKDoFmPKcmEMS2_KDoFmS4_mPDiEE18verify_valid_inputIvQneT_LS0_4EEENSA_17validation_resultENSt3__14spanIS3_Lm18446744073709551615EEEENKUlRKNS1_6resultEE_clESI_ Line | Count | Source | 275 | 1.23k | ret.valid = std::ranges::all_of(results, [](const simdutf::result& r) { | 276 | 1.23k | return r.error == simdutf::SUCCESS; | 277 | 1.23k | }); |
_ZZNK10ConversionIL12UtfEncodings0ELS0_4EMN7simdutf14implementationEKDoFmmEMS2_KDoFmPKDsmPcEE18verify_valid_inputIvQneT_LS0_4EEENSA_17validation_resultENSt3__14spanIS5_Lm18446744073709551615EEEENKUlRKNS1_6resultEE_clESI_ Line | Count | Source | 275 | 171 | ret.valid = std::ranges::all_of(results, [](const simdutf::result& r) { | 276 | 171 | return r.error == simdutf::SUCCESS; | 277 | 171 | }); |
_ZZNK10ConversionIL12UtfEncodings1ELS0_4EMN7simdutf14implementationEKDoFmmEMS2_KDoFmPKDsmPcEE18verify_valid_inputIvQneT_LS0_4EEENSA_17validation_resultENSt3__14spanIS5_Lm18446744073709551615EEEENKUlRKNS1_6resultEE_clESI_ Line | Count | Source | 275 | 154 | ret.valid = std::ranges::all_of(results, [](const simdutf::result& r) { | 276 | 154 | return r.error == simdutf::SUCCESS; | 277 | 154 | }); |
_ZZNK10ConversionIL12UtfEncodings3ELS0_4EMN7simdutf14implementationEKDoFmmEMS2_KDoFmPKDimPcEE18verify_valid_inputIvQneT_LS0_4EEENSA_17validation_resultENSt3__14spanIS5_Lm18446744073709551615EEEENKUlRKNS1_6resultEE_clESI_ Line | Count | Source | 275 | 158 | ret.valid = std::ranges::all_of(results, [](const simdutf::result& r) { | 276 | 158 | return r.error == simdutf::SUCCESS; | 277 | 158 | }); |
_ZZNK10ConversionIL12UtfEncodings2ELS0_4EMN7simdutf14implementationEKDoFmPKcmEMS2_KDoFmS4_mPcEE18verify_valid_inputIvQneT_LS0_4EEENSA_17validation_resultENSt3__14spanIS3_Lm18446744073709551615EEEENKUlRKNS1_6resultEE_clESI_ Line | Count | Source | 275 | 471 | ret.valid = std::ranges::all_of(results, [](const simdutf::result& r) { | 276 | 471 | return r.error == simdutf::SUCCESS; | 277 | 471 | }); |
_ZZNK10ConversionIL12UtfEncodings0ELS0_4EMN7simdutf14implementationEKDoFmmEMS2_KDoFNS1_6resultEPKDsmPcEE18verify_valid_inputIvQneT_LS0_4EEENSB_17validation_resultENSt3__14spanIS6_Lm18446744073709551615EEEENKUlRKS5_E_clESI_ Line | Count | Source | 275 | 336 | ret.valid = std::ranges::all_of(results, [](const simdutf::result& r) { | 276 | 336 | return r.error == simdutf::SUCCESS; | 277 | 336 | }); |
_ZZNK10ConversionIL12UtfEncodings0ELS0_3EMN7simdutf14implementationEKDoFmPKDsmEMS2_KDoFNS1_6resultES4_mPDiEE18verify_valid_inputIvQneT_LS0_4EEENSB_17validation_resultENSt3__14spanIS3_Lm18446744073709551615EEEENKUlRKS7_E_clESI_ Line | Count | Source | 275 | 310 | ret.valid = std::ranges::all_of(results, [](const simdutf::result& r) { | 276 | 310 | return r.error == simdutf::SUCCESS; | 277 | 310 | }); |
_ZZNK10ConversionIL12UtfEncodings0ELS0_2EMN7simdutf14implementationEKDoFmPKDsmEMS2_KDoFNS1_6resultES4_mPcEE18verify_valid_inputIvQneT_LS0_4EEENSB_17validation_resultENSt3__14spanIS3_Lm18446744073709551615EEEENKUlRKS7_E_clESI_ Line | Count | Source | 275 | 629 | ret.valid = std::ranges::all_of(results, [](const simdutf::result& r) { | 276 | 629 | return r.error == simdutf::SUCCESS; | 277 | 629 | }); |
_ZZNK10ConversionIL12UtfEncodings1ELS0_4EMN7simdutf14implementationEKDoFmmEMS2_KDoFNS1_6resultEPKDsmPcEE18verify_valid_inputIvQneT_LS0_4EEENSB_17validation_resultENSt3__14spanIS6_Lm18446744073709551615EEEENKUlRKS5_E_clESI_ Line | Count | Source | 275 | 303 | ret.valid = std::ranges::all_of(results, [](const simdutf::result& r) { | 276 | 303 | return r.error == simdutf::SUCCESS; | 277 | 303 | }); |
_ZZNK10ConversionIL12UtfEncodings1ELS0_3EMN7simdutf14implementationEKDoFmPKDsmEMS2_KDoFNS1_6resultES4_mPDiEE18verify_valid_inputIvQneT_LS0_4EEENSB_17validation_resultENSt3__14spanIS3_Lm18446744073709551615EEEENKUlRKS7_E_clESI_ Line | Count | Source | 275 | 397 | ret.valid = std::ranges::all_of(results, [](const simdutf::result& r) { | 276 | 397 | return r.error == simdutf::SUCCESS; | 277 | 397 | }); |
_ZZNK10ConversionIL12UtfEncodings1ELS0_2EMN7simdutf14implementationEKDoFmPKDsmEMS2_KDoFNS1_6resultES4_mPcEE18verify_valid_inputIvQneT_LS0_4EEENSB_17validation_resultENSt3__14spanIS3_Lm18446744073709551615EEEENKUlRKS7_E_clESI_ Line | Count | Source | 275 | 729 | ret.valid = std::ranges::all_of(results, [](const simdutf::result& r) { | 276 | 729 | return r.error == simdutf::SUCCESS; | 277 | 729 | }); |
_ZZNK10ConversionIL12UtfEncodings3ELS0_4EMN7simdutf14implementationEKDoFmmEMS2_KDoFNS1_6resultEPKDimPcEE18verify_valid_inputIvQneT_LS0_4EEENSB_17validation_resultENSt3__14spanIS6_Lm18446744073709551615EEEENKUlRKS5_E_clESI_ Line | Count | Source | 275 | 278 | ret.valid = std::ranges::all_of(results, [](const simdutf::result& r) { | 276 | 278 | return r.error == simdutf::SUCCESS; | 277 | 278 | }); |
_ZZNK10ConversionIL12UtfEncodings3ELS0_0EMN7simdutf14implementationEKDoFmPKDimEMS2_KDoFNS1_6resultES4_mPDsEE18verify_valid_inputIvQneT_LS0_4EEENSB_17validation_resultENSt3__14spanIS3_Lm18446744073709551615EEEENKUlRKS7_E_clESI_ Line | Count | Source | 275 | 475 | ret.valid = std::ranges::all_of(results, [](const simdutf::result& r) { | 276 | 475 | return r.error == simdutf::SUCCESS; | 277 | 475 | }); |
_ZZNK10ConversionIL12UtfEncodings3ELS0_1EMN7simdutf14implementationEKDoFmPKDimEMS2_KDoFNS1_6resultES4_mPDsEE18verify_valid_inputIvQneT_LS0_4EEENSB_17validation_resultENSt3__14spanIS3_Lm18446744073709551615EEEENKUlRKS7_E_clESI_ Line | Count | Source | 275 | 544 | ret.valid = std::ranges::all_of(results, [](const simdutf::result& r) { | 276 | 544 | return r.error == simdutf::SUCCESS; | 277 | 544 | }); |
_ZZNK10ConversionIL12UtfEncodings3ELS0_2EMN7simdutf14implementationEKDoFmPKDimEMS2_KDoFNS1_6resultES4_mPcEE18verify_valid_inputIvQneT_LS0_4EEENSB_17validation_resultENSt3__14spanIS3_Lm18446744073709551615EEEENKUlRKS7_E_clESI_ Line | Count | Source | 275 | 613 | ret.valid = std::ranges::all_of(results, [](const simdutf::result& r) { | 276 | 613 | return r.error == simdutf::SUCCESS; | 277 | 613 | }); |
_ZZNK10ConversionIL12UtfEncodings2ELS0_4EMN7simdutf14implementationEKDoFmPKcmEMS2_KDoFNS1_6resultES4_mPcEE18verify_valid_inputIvQneT_LS0_4EEENSB_17validation_resultENSt3__14spanIS3_Lm18446744073709551615EEEENKUlRKS7_E_clESI_ Line | Count | Source | 275 | 504 | ret.valid = std::ranges::all_of(results, [](const simdutf::result& r) { | 276 | 504 | return r.error == simdutf::SUCCESS; | 277 | 504 | }); |
_ZZNK10ConversionIL12UtfEncodings2ELS0_0EMN7simdutf14implementationEKDoFmPKcmEMS2_KDoFNS1_6resultES4_mPDsEE18verify_valid_inputIvQneT_LS0_4EEENSB_17validation_resultENSt3__14spanIS3_Lm18446744073709551615EEEENKUlRKS7_E_clESI_ Line | Count | Source | 275 | 665 | ret.valid = std::ranges::all_of(results, [](const simdutf::result& r) { | 276 | 665 | return r.error == simdutf::SUCCESS; | 277 | 665 | }); |
_ZZNK10ConversionIL12UtfEncodings2ELS0_1EMN7simdutf14implementationEKDoFmPKcmEMS2_KDoFNS1_6resultES4_mPDsEE18verify_valid_inputIvQneT_LS0_4EEENSB_17validation_resultENSt3__14spanIS3_Lm18446744073709551615EEEENKUlRKS7_E_clESI_ Line | Count | Source | 275 | 533 | ret.valid = std::ranges::all_of(results, [](const simdutf::result& r) { | 276 | 533 | return r.error == simdutf::SUCCESS; | 277 | 533 | }); |
_ZZNK10ConversionIL12UtfEncodings2ELS0_3EMN7simdutf14implementationEKDoFmPKcmEMS2_KDoFNS1_6resultES4_mPDiEE18verify_valid_inputIvQneT_LS0_4EEENSB_17validation_resultENSt3__14spanIS3_Lm18446744073709551615EEEENKUlRKS7_E_clESI_ Line | Count | Source | 275 | 709 | ret.valid = std::ranges::all_of(results, [](const simdutf::result& r) { | 276 | 709 | return r.error == simdutf::SUCCESS; | 277 | 709 | }); |
|
278 | 8.18k | return ret; |
279 | 8.18k | } _ZNK10ConversionIL12UtfEncodings0ELS0_3EMN7simdutf14implementationEKDoFmPKDsmEMS2_KDoFmS4_mPDiEE18verify_valid_inputIvQneT_LS0_4EEENSA_17validation_resultENSt3__14spanIS3_Lm18446744073709551615EEE Line | Count | Source | 230 | 201 | validation_result verify_valid_input(FromSpan src) const { | 231 | 201 | validation_result ret{}; | 232 | | | 233 | 201 | auto input_validation = ValidationFunctionTrait<From>::ValidationWithErrors; | 234 | 201 | const auto implementations = get_supported_implementations(); | 235 | 201 | std::vector<simdutf::result> results; | 236 | 201 | results.reserve(implementations.size()); | 237 | | | 238 | 603 | for (auto impl : implementations) { | 239 | 603 | results.push_back( | 240 | 603 | std::invoke(input_validation, impl, src.data(), src.size())); | 241 | | | 242 | | // make sure the validation variant that returns a bool agrees | 243 | 603 | const bool validation1 = results.back().error == simdutf::SUCCESS; | 244 | 603 | const bool validation2 = | 245 | 603 | std::invoke(ValidationFunctionTrait<From>::Validation, impl, | 246 | 603 | src.data(), src.size()); | 247 | 603 | if (validation1 != validation2) { | 248 | 0 | std::cerr << "begin errormessage for verify_valid_input()\n"; | 249 | 0 | std::cerr << ValidationFunctionTrait<From>::ValidationWithErrorsName | 250 | 0 | << " gives " << validation1 << " while " | 251 | 0 | << ValidationFunctionTrait<From>::ValidationName << " gave " | 252 | 0 | << validation2 << " for implementation " << impl->name() | 253 | 0 | << '\n'; | 254 | 0 | std::cerr << "end errormessage\n"; | 255 | 0 | std::abort(); | 256 | 0 | } | 257 | 603 | } | 258 | | | 259 | 201 | auto neq = [](const auto& a, const auto& b) { return a != b; }; | 260 | 201 | if (std::ranges::adjacent_find(results, neq) != results.end()) { | 261 | 0 | std::cerr << "begin errormessage for verify_valid_input()\n"; | 262 | 0 | std::cerr << "in fuzz case for " | 263 | 0 | << ValidationFunctionTrait<From>::ValidationWithErrorsName | 264 | 0 | << " invoked with " << src.size() << " elements:\n"; | 265 | 0 | for (std::size_t i = 0; i < results.size(); ++i) { | 266 | 0 | std::cerr << "got return " << std::dec << results[i] | 267 | 0 | << " from implementation " << implementations[i]->name() | 268 | 0 | << '\n'; | 269 | 0 | } | 270 | 0 | std::cerr << "end errormessage\n"; | 271 | 0 | ret.implementations_agree = false; | 272 | 201 | } else { | 273 | 201 | ret.implementations_agree = true; | 274 | 201 | } | 275 | 201 | ret.valid = std::ranges::all_of(results, [](const simdutf::result& r) { | 276 | 201 | return r.error == simdutf::SUCCESS; | 277 | 201 | }); | 278 | 201 | return ret; | 279 | 201 | } |
_ZNK10ConversionIL12UtfEncodings0ELS0_2EMN7simdutf14implementationEKDoFmPKDsmEMS2_KDoFmS4_mPcEE18verify_valid_inputIvQneT_LS0_4EEENSA_17validation_resultENSt3__14spanIS3_Lm18446744073709551615EEE Line | Count | Source | 230 | 403 | validation_result verify_valid_input(FromSpan src) const { | 231 | 403 | validation_result ret{}; | 232 | | | 233 | 403 | auto input_validation = ValidationFunctionTrait<From>::ValidationWithErrors; | 234 | 403 | const auto implementations = get_supported_implementations(); | 235 | 403 | std::vector<simdutf::result> results; | 236 | 403 | results.reserve(implementations.size()); | 237 | | | 238 | 1.20k | for (auto impl : implementations) { | 239 | 1.20k | results.push_back( | 240 | 1.20k | std::invoke(input_validation, impl, src.data(), src.size())); | 241 | | | 242 | | // make sure the validation variant that returns a bool agrees | 243 | 1.20k | const bool validation1 = results.back().error == simdutf::SUCCESS; | 244 | 1.20k | const bool validation2 = | 245 | 1.20k | std::invoke(ValidationFunctionTrait<From>::Validation, impl, | 246 | 1.20k | src.data(), src.size()); | 247 | 1.20k | if (validation1 != validation2) { | 248 | 0 | std::cerr << "begin errormessage for verify_valid_input()\n"; | 249 | 0 | std::cerr << ValidationFunctionTrait<From>::ValidationWithErrorsName | 250 | 0 | << " gives " << validation1 << " while " | 251 | 0 | << ValidationFunctionTrait<From>::ValidationName << " gave " | 252 | 0 | << validation2 << " for implementation " << impl->name() | 253 | 0 | << '\n'; | 254 | 0 | std::cerr << "end errormessage\n"; | 255 | 0 | std::abort(); | 256 | 0 | } | 257 | 1.20k | } | 258 | | | 259 | 403 | auto neq = [](const auto& a, const auto& b) { return a != b; }; | 260 | 403 | if (std::ranges::adjacent_find(results, neq) != results.end()) { | 261 | 0 | std::cerr << "begin errormessage for verify_valid_input()\n"; | 262 | 0 | std::cerr << "in fuzz case for " | 263 | 0 | << ValidationFunctionTrait<From>::ValidationWithErrorsName | 264 | 0 | << " invoked with " << src.size() << " elements:\n"; | 265 | 0 | for (std::size_t i = 0; i < results.size(); ++i) { | 266 | 0 | std::cerr << "got return " << std::dec << results[i] | 267 | 0 | << " from implementation " << implementations[i]->name() | 268 | 0 | << '\n'; | 269 | 0 | } | 270 | 0 | std::cerr << "end errormessage\n"; | 271 | 0 | ret.implementations_agree = false; | 272 | 403 | } else { | 273 | 403 | ret.implementations_agree = true; | 274 | 403 | } | 275 | 403 | ret.valid = std::ranges::all_of(results, [](const simdutf::result& r) { | 276 | 403 | return r.error == simdutf::SUCCESS; | 277 | 403 | }); | 278 | 403 | return ret; | 279 | 403 | } |
_ZNK10ConversionIL12UtfEncodings1ELS0_3EMN7simdutf14implementationEKDoFmPKDsmEMS2_KDoFmS4_mPDiEE18verify_valid_inputIvQneT_LS0_4EEENSA_17validation_resultENSt3__14spanIS3_Lm18446744073709551615EEE Line | Count | Source | 230 | 197 | validation_result verify_valid_input(FromSpan src) const { | 231 | 197 | validation_result ret{}; | 232 | | | 233 | 197 | auto input_validation = ValidationFunctionTrait<From>::ValidationWithErrors; | 234 | 197 | const auto implementations = get_supported_implementations(); | 235 | 197 | std::vector<simdutf::result> results; | 236 | 197 | results.reserve(implementations.size()); | 237 | | | 238 | 591 | for (auto impl : implementations) { | 239 | 591 | results.push_back( | 240 | 591 | std::invoke(input_validation, impl, src.data(), src.size())); | 241 | | | 242 | | // make sure the validation variant that returns a bool agrees | 243 | 591 | const bool validation1 = results.back().error == simdutf::SUCCESS; | 244 | 591 | const bool validation2 = | 245 | 591 | std::invoke(ValidationFunctionTrait<From>::Validation, impl, | 246 | 591 | src.data(), src.size()); | 247 | 591 | if (validation1 != validation2) { | 248 | 0 | std::cerr << "begin errormessage for verify_valid_input()\n"; | 249 | 0 | std::cerr << ValidationFunctionTrait<From>::ValidationWithErrorsName | 250 | 0 | << " gives " << validation1 << " while " | 251 | 0 | << ValidationFunctionTrait<From>::ValidationName << " gave " | 252 | 0 | << validation2 << " for implementation " << impl->name() | 253 | 0 | << '\n'; | 254 | 0 | std::cerr << "end errormessage\n"; | 255 | 0 | std::abort(); | 256 | 0 | } | 257 | 591 | } | 258 | | | 259 | 197 | auto neq = [](const auto& a, const auto& b) { return a != b; }; | 260 | 197 | if (std::ranges::adjacent_find(results, neq) != results.end()) { | 261 | 0 | std::cerr << "begin errormessage for verify_valid_input()\n"; | 262 | 0 | std::cerr << "in fuzz case for " | 263 | 0 | << ValidationFunctionTrait<From>::ValidationWithErrorsName | 264 | 0 | << " invoked with " << src.size() << " elements:\n"; | 265 | 0 | for (std::size_t i = 0; i < results.size(); ++i) { | 266 | 0 | std::cerr << "got return " << std::dec << results[i] | 267 | 0 | << " from implementation " << implementations[i]->name() | 268 | 0 | << '\n'; | 269 | 0 | } | 270 | 0 | std::cerr << "end errormessage\n"; | 271 | 0 | ret.implementations_agree = false; | 272 | 197 | } else { | 273 | 197 | ret.implementations_agree = true; | 274 | 197 | } | 275 | 197 | ret.valid = std::ranges::all_of(results, [](const simdutf::result& r) { | 276 | 197 | return r.error == simdutf::SUCCESS; | 277 | 197 | }); | 278 | 197 | return ret; | 279 | 197 | } |
_ZNK10ConversionIL12UtfEncodings1ELS0_2EMN7simdutf14implementationEKDoFmPKDsmEMS2_KDoFmS4_mPcEE18verify_valid_inputIvQneT_LS0_4EEENSA_17validation_resultENSt3__14spanIS3_Lm18446744073709551615EEE Line | Count | Source | 230 | 412 | validation_result verify_valid_input(FromSpan src) const { | 231 | 412 | validation_result ret{}; | 232 | | | 233 | 412 | auto input_validation = ValidationFunctionTrait<From>::ValidationWithErrors; | 234 | 412 | const auto implementations = get_supported_implementations(); | 235 | 412 | std::vector<simdutf::result> results; | 236 | 412 | results.reserve(implementations.size()); | 237 | | | 238 | 1.23k | for (auto impl : implementations) { | 239 | 1.23k | results.push_back( | 240 | 1.23k | std::invoke(input_validation, impl, src.data(), src.size())); | 241 | | | 242 | | // make sure the validation variant that returns a bool agrees | 243 | 1.23k | const bool validation1 = results.back().error == simdutf::SUCCESS; | 244 | 1.23k | const bool validation2 = | 245 | 1.23k | std::invoke(ValidationFunctionTrait<From>::Validation, impl, | 246 | 1.23k | src.data(), src.size()); | 247 | 1.23k | if (validation1 != validation2) { | 248 | 0 | std::cerr << "begin errormessage for verify_valid_input()\n"; | 249 | 0 | std::cerr << ValidationFunctionTrait<From>::ValidationWithErrorsName | 250 | 0 | << " gives " << validation1 << " while " | 251 | 0 | << ValidationFunctionTrait<From>::ValidationName << " gave " | 252 | 0 | << validation2 << " for implementation " << impl->name() | 253 | 0 | << '\n'; | 254 | 0 | std::cerr << "end errormessage\n"; | 255 | 0 | std::abort(); | 256 | 0 | } | 257 | 1.23k | } | 258 | | | 259 | 412 | auto neq = [](const auto& a, const auto& b) { return a != b; }; | 260 | 412 | if (std::ranges::adjacent_find(results, neq) != results.end()) { | 261 | 0 | std::cerr << "begin errormessage for verify_valid_input()\n"; | 262 | 0 | std::cerr << "in fuzz case for " | 263 | 0 | << ValidationFunctionTrait<From>::ValidationWithErrorsName | 264 | 0 | << " invoked with " << src.size() << " elements:\n"; | 265 | 0 | for (std::size_t i = 0; i < results.size(); ++i) { | 266 | 0 | std::cerr << "got return " << std::dec << results[i] | 267 | 0 | << " from implementation " << implementations[i]->name() | 268 | 0 | << '\n'; | 269 | 0 | } | 270 | 0 | std::cerr << "end errormessage\n"; | 271 | 0 | ret.implementations_agree = false; | 272 | 412 | } else { | 273 | 412 | ret.implementations_agree = true; | 274 | 412 | } | 275 | 412 | ret.valid = std::ranges::all_of(results, [](const simdutf::result& r) { | 276 | 412 | return r.error == simdutf::SUCCESS; | 277 | 412 | }); | 278 | 412 | return ret; | 279 | 412 | } |
_ZNK10ConversionIL12UtfEncodings3ELS0_0EMN7simdutf14implementationEKDoFmPKDimEMS2_KDoFmS4_mPDsEE18verify_valid_inputIvQneT_LS0_4EEENSA_17validation_resultENSt3__14spanIS3_Lm18446744073709551615EEE Line | Count | Source | 230 | 268 | validation_result verify_valid_input(FromSpan src) const { | 231 | 268 | validation_result ret{}; | 232 | | | 233 | 268 | auto input_validation = ValidationFunctionTrait<From>::ValidationWithErrors; | 234 | 268 | const auto implementations = get_supported_implementations(); | 235 | 268 | std::vector<simdutf::result> results; | 236 | 268 | results.reserve(implementations.size()); | 237 | | | 238 | 804 | for (auto impl : implementations) { | 239 | 804 | results.push_back( | 240 | 804 | std::invoke(input_validation, impl, src.data(), src.size())); | 241 | | | 242 | | // make sure the validation variant that returns a bool agrees | 243 | 804 | const bool validation1 = results.back().error == simdutf::SUCCESS; | 244 | 804 | const bool validation2 = | 245 | 804 | std::invoke(ValidationFunctionTrait<From>::Validation, impl, | 246 | 804 | src.data(), src.size()); | 247 | 804 | if (validation1 != validation2) { | 248 | 0 | std::cerr << "begin errormessage for verify_valid_input()\n"; | 249 | 0 | std::cerr << ValidationFunctionTrait<From>::ValidationWithErrorsName | 250 | 0 | << " gives " << validation1 << " while " | 251 | 0 | << ValidationFunctionTrait<From>::ValidationName << " gave " | 252 | 0 | << validation2 << " for implementation " << impl->name() | 253 | 0 | << '\n'; | 254 | 0 | std::cerr << "end errormessage\n"; | 255 | 0 | std::abort(); | 256 | 0 | } | 257 | 804 | } | 258 | | | 259 | 268 | auto neq = [](const auto& a, const auto& b) { return a != b; }; | 260 | 268 | if (std::ranges::adjacent_find(results, neq) != results.end()) { | 261 | 0 | std::cerr << "begin errormessage for verify_valid_input()\n"; | 262 | 0 | std::cerr << "in fuzz case for " | 263 | 0 | << ValidationFunctionTrait<From>::ValidationWithErrorsName | 264 | 0 | << " invoked with " << src.size() << " elements:\n"; | 265 | 0 | for (std::size_t i = 0; i < results.size(); ++i) { | 266 | 0 | std::cerr << "got return " << std::dec << results[i] | 267 | 0 | << " from implementation " << implementations[i]->name() | 268 | 0 | << '\n'; | 269 | 0 | } | 270 | 0 | std::cerr << "end errormessage\n"; | 271 | 0 | ret.implementations_agree = false; | 272 | 268 | } else { | 273 | 268 | ret.implementations_agree = true; | 274 | 268 | } | 275 | 268 | ret.valid = std::ranges::all_of(results, [](const simdutf::result& r) { | 276 | 268 | return r.error == simdutf::SUCCESS; | 277 | 268 | }); | 278 | 268 | return ret; | 279 | 268 | } |
_ZNK10ConversionIL12UtfEncodings3ELS0_1EMN7simdutf14implementationEKDoFmPKDimEMS2_KDoFmS4_mPDsEE18verify_valid_inputIvQneT_LS0_4EEENSA_17validation_resultENSt3__14spanIS3_Lm18446744073709551615EEE Line | Count | Source | 230 | 366 | validation_result verify_valid_input(FromSpan src) const { | 231 | 366 | validation_result ret{}; | 232 | | | 233 | 366 | auto input_validation = ValidationFunctionTrait<From>::ValidationWithErrors; | 234 | 366 | const auto implementations = get_supported_implementations(); | 235 | 366 | std::vector<simdutf::result> results; | 236 | 366 | results.reserve(implementations.size()); | 237 | | | 238 | 1.09k | for (auto impl : implementations) { | 239 | 1.09k | results.push_back( | 240 | 1.09k | std::invoke(input_validation, impl, src.data(), src.size())); | 241 | | | 242 | | // make sure the validation variant that returns a bool agrees | 243 | 1.09k | const bool validation1 = results.back().error == simdutf::SUCCESS; | 244 | 1.09k | const bool validation2 = | 245 | 1.09k | std::invoke(ValidationFunctionTrait<From>::Validation, impl, | 246 | 1.09k | src.data(), src.size()); | 247 | 1.09k | if (validation1 != validation2) { | 248 | 0 | std::cerr << "begin errormessage for verify_valid_input()\n"; | 249 | 0 | std::cerr << ValidationFunctionTrait<From>::ValidationWithErrorsName | 250 | 0 | << " gives " << validation1 << " while " | 251 | 0 | << ValidationFunctionTrait<From>::ValidationName << " gave " | 252 | 0 | << validation2 << " for implementation " << impl->name() | 253 | 0 | << '\n'; | 254 | 0 | std::cerr << "end errormessage\n"; | 255 | 0 | std::abort(); | 256 | 0 | } | 257 | 1.09k | } | 258 | | | 259 | 366 | auto neq = [](const auto& a, const auto& b) { return a != b; }; | 260 | 366 | if (std::ranges::adjacent_find(results, neq) != results.end()) { | 261 | 0 | std::cerr << "begin errormessage for verify_valid_input()\n"; | 262 | 0 | std::cerr << "in fuzz case for " | 263 | 0 | << ValidationFunctionTrait<From>::ValidationWithErrorsName | 264 | 0 | << " invoked with " << src.size() << " elements:\n"; | 265 | 0 | for (std::size_t i = 0; i < results.size(); ++i) { | 266 | 0 | std::cerr << "got return " << std::dec << results[i] | 267 | 0 | << " from implementation " << implementations[i]->name() | 268 | 0 | << '\n'; | 269 | 0 | } | 270 | 0 | std::cerr << "end errormessage\n"; | 271 | 0 | ret.implementations_agree = false; | 272 | 366 | } else { | 273 | 366 | ret.implementations_agree = true; | 274 | 366 | } | 275 | 366 | ret.valid = std::ranges::all_of(results, [](const simdutf::result& r) { | 276 | 366 | return r.error == simdutf::SUCCESS; | 277 | 366 | }); | 278 | 366 | return ret; | 279 | 366 | } |
_ZNK10ConversionIL12UtfEncodings3ELS0_2EMN7simdutf14implementationEKDoFmPKDimEMS2_KDoFmS4_mPcEE18verify_valid_inputIvQneT_LS0_4EEENSA_17validation_resultENSt3__14spanIS3_Lm18446744073709551615EEE Line | Count | Source | 230 | 404 | validation_result verify_valid_input(FromSpan src) const { | 231 | 404 | validation_result ret{}; | 232 | | | 233 | 404 | auto input_validation = ValidationFunctionTrait<From>::ValidationWithErrors; | 234 | 404 | const auto implementations = get_supported_implementations(); | 235 | 404 | std::vector<simdutf::result> results; | 236 | 404 | results.reserve(implementations.size()); | 237 | | | 238 | 1.21k | for (auto impl : implementations) { | 239 | 1.21k | results.push_back( | 240 | 1.21k | std::invoke(input_validation, impl, src.data(), src.size())); | 241 | | | 242 | | // make sure the validation variant that returns a bool agrees | 243 | 1.21k | const bool validation1 = results.back().error == simdutf::SUCCESS; | 244 | 1.21k | const bool validation2 = | 245 | 1.21k | std::invoke(ValidationFunctionTrait<From>::Validation, impl, | 246 | 1.21k | src.data(), src.size()); | 247 | 1.21k | if (validation1 != validation2) { | 248 | 0 | std::cerr << "begin errormessage for verify_valid_input()\n"; | 249 | 0 | std::cerr << ValidationFunctionTrait<From>::ValidationWithErrorsName | 250 | 0 | << " gives " << validation1 << " while " | 251 | 0 | << ValidationFunctionTrait<From>::ValidationName << " gave " | 252 | 0 | << validation2 << " for implementation " << impl->name() | 253 | 0 | << '\n'; | 254 | 0 | std::cerr << "end errormessage\n"; | 255 | 0 | std::abort(); | 256 | 0 | } | 257 | 1.21k | } | 258 | | | 259 | 404 | auto neq = [](const auto& a, const auto& b) { return a != b; }; | 260 | 404 | if (std::ranges::adjacent_find(results, neq) != results.end()) { | 261 | 0 | std::cerr << "begin errormessage for verify_valid_input()\n"; | 262 | 0 | std::cerr << "in fuzz case for " | 263 | 0 | << ValidationFunctionTrait<From>::ValidationWithErrorsName | 264 | 0 | << " invoked with " << src.size() << " elements:\n"; | 265 | 0 | for (std::size_t i = 0; i < results.size(); ++i) { | 266 | 0 | std::cerr << "got return " << std::dec << results[i] | 267 | 0 | << " from implementation " << implementations[i]->name() | 268 | 0 | << '\n'; | 269 | 0 | } | 270 | 0 | std::cerr << "end errormessage\n"; | 271 | 0 | ret.implementations_agree = false; | 272 | 404 | } else { | 273 | 404 | ret.implementations_agree = true; | 274 | 404 | } | 275 | 404 | ret.valid = std::ranges::all_of(results, [](const simdutf::result& r) { | 276 | 404 | return r.error == simdutf::SUCCESS; | 277 | 404 | }); | 278 | 404 | return ret; | 279 | 404 | } |
_ZNK10ConversionIL12UtfEncodings2ELS0_0EMN7simdutf14implementationEKDoFmPKcmEMS2_KDoFmS4_mPDsEE18verify_valid_inputIvQneT_LS0_4EEENSA_17validation_resultENSt3__14spanIS3_Lm18446744073709551615EEE Line | Count | Source | 230 | 584 | validation_result verify_valid_input(FromSpan src) const { | 231 | 584 | validation_result ret{}; | 232 | | | 233 | 584 | auto input_validation = ValidationFunctionTrait<From>::ValidationWithErrors; | 234 | 584 | const auto implementations = get_supported_implementations(); | 235 | 584 | std::vector<simdutf::result> results; | 236 | 584 | results.reserve(implementations.size()); | 237 | | | 238 | 1.75k | for (auto impl : implementations) { | 239 | 1.75k | results.push_back( | 240 | 1.75k | std::invoke(input_validation, impl, src.data(), src.size())); | 241 | | | 242 | | // make sure the validation variant that returns a bool agrees | 243 | 1.75k | const bool validation1 = results.back().error == simdutf::SUCCESS; | 244 | 1.75k | const bool validation2 = | 245 | 1.75k | std::invoke(ValidationFunctionTrait<From>::Validation, impl, | 246 | 1.75k | src.data(), src.size()); | 247 | 1.75k | if (validation1 != validation2) { | 248 | 0 | std::cerr << "begin errormessage for verify_valid_input()\n"; | 249 | 0 | std::cerr << ValidationFunctionTrait<From>::ValidationWithErrorsName | 250 | 0 | << " gives " << validation1 << " while " | 251 | 0 | << ValidationFunctionTrait<From>::ValidationName << " gave " | 252 | 0 | << validation2 << " for implementation " << impl->name() | 253 | 0 | << '\n'; | 254 | 0 | std::cerr << "end errormessage\n"; | 255 | 0 | std::abort(); | 256 | 0 | } | 257 | 1.75k | } | 258 | | | 259 | 584 | auto neq = [](const auto& a, const auto& b) { return a != b; }; | 260 | 584 | if (std::ranges::adjacent_find(results, neq) != results.end()) { | 261 | 0 | std::cerr << "begin errormessage for verify_valid_input()\n"; | 262 | 0 | std::cerr << "in fuzz case for " | 263 | 0 | << ValidationFunctionTrait<From>::ValidationWithErrorsName | 264 | 0 | << " invoked with " << src.size() << " elements:\n"; | 265 | 0 | for (std::size_t i = 0; i < results.size(); ++i) { | 266 | 0 | std::cerr << "got return " << std::dec << results[i] | 267 | 0 | << " from implementation " << implementations[i]->name() | 268 | 0 | << '\n'; | 269 | 0 | } | 270 | 0 | std::cerr << "end errormessage\n"; | 271 | 0 | ret.implementations_agree = false; | 272 | 584 | } else { | 273 | 584 | ret.implementations_agree = true; | 274 | 584 | } | 275 | 584 | ret.valid = std::ranges::all_of(results, [](const simdutf::result& r) { | 276 | 584 | return r.error == simdutf::SUCCESS; | 277 | 584 | }); | 278 | 584 | return ret; | 279 | 584 | } |
_ZNK10ConversionIL12UtfEncodings2ELS0_1EMN7simdutf14implementationEKDoFmPKcmEMS2_KDoFmS4_mPDsEE18verify_valid_inputIvQneT_LS0_4EEENSA_17validation_resultENSt3__14spanIS3_Lm18446744073709551615EEE Line | Count | Source | 230 | 527 | validation_result verify_valid_input(FromSpan src) const { | 231 | 527 | validation_result ret{}; | 232 | | | 233 | 527 | auto input_validation = ValidationFunctionTrait<From>::ValidationWithErrors; | 234 | 527 | const auto implementations = get_supported_implementations(); | 235 | 527 | std::vector<simdutf::result> results; | 236 | 527 | results.reserve(implementations.size()); | 237 | | | 238 | 1.58k | for (auto impl : implementations) { | 239 | 1.58k | results.push_back( | 240 | 1.58k | std::invoke(input_validation, impl, src.data(), src.size())); | 241 | | | 242 | | // make sure the validation variant that returns a bool agrees | 243 | 1.58k | const bool validation1 = results.back().error == simdutf::SUCCESS; | 244 | 1.58k | const bool validation2 = | 245 | 1.58k | std::invoke(ValidationFunctionTrait<From>::Validation, impl, | 246 | 1.58k | src.data(), src.size()); | 247 | 1.58k | if (validation1 != validation2) { | 248 | 0 | std::cerr << "begin errormessage for verify_valid_input()\n"; | 249 | 0 | std::cerr << ValidationFunctionTrait<From>::ValidationWithErrorsName | 250 | 0 | << " gives " << validation1 << " while " | 251 | 0 | << ValidationFunctionTrait<From>::ValidationName << " gave " | 252 | 0 | << validation2 << " for implementation " << impl->name() | 253 | 0 | << '\n'; | 254 | 0 | std::cerr << "end errormessage\n"; | 255 | 0 | std::abort(); | 256 | 0 | } | 257 | 1.58k | } | 258 | | | 259 | 527 | auto neq = [](const auto& a, const auto& b) { return a != b; }; | 260 | 527 | if (std::ranges::adjacent_find(results, neq) != results.end()) { | 261 | 0 | std::cerr << "begin errormessage for verify_valid_input()\n"; | 262 | 0 | std::cerr << "in fuzz case for " | 263 | 0 | << ValidationFunctionTrait<From>::ValidationWithErrorsName | 264 | 0 | << " invoked with " << src.size() << " elements:\n"; | 265 | 0 | for (std::size_t i = 0; i < results.size(); ++i) { | 266 | 0 | std::cerr << "got return " << std::dec << results[i] | 267 | 0 | << " from implementation " << implementations[i]->name() | 268 | 0 | << '\n'; | 269 | 0 | } | 270 | 0 | std::cerr << "end errormessage\n"; | 271 | 0 | ret.implementations_agree = false; | 272 | 527 | } else { | 273 | 527 | ret.implementations_agree = true; | 274 | 527 | } | 275 | 527 | ret.valid = std::ranges::all_of(results, [](const simdutf::result& r) { | 276 | 527 | return r.error == simdutf::SUCCESS; | 277 | 527 | }); | 278 | 527 | return ret; | 279 | 527 | } |
_ZNK10ConversionIL12UtfEncodings2ELS0_3EMN7simdutf14implementationEKDoFmPKcmEMS2_KDoFmS4_mPDiEE18verify_valid_inputIvQneT_LS0_4EEENSA_17validation_resultENSt3__14spanIS3_Lm18446744073709551615EEE Line | Count | Source | 230 | 564 | validation_result verify_valid_input(FromSpan src) const { | 231 | 564 | validation_result ret{}; | 232 | | | 233 | 564 | auto input_validation = ValidationFunctionTrait<From>::ValidationWithErrors; | 234 | 564 | const auto implementations = get_supported_implementations(); | 235 | 564 | std::vector<simdutf::result> results; | 236 | 564 | results.reserve(implementations.size()); | 237 | | | 238 | 1.69k | for (auto impl : implementations) { | 239 | 1.69k | results.push_back( | 240 | 1.69k | std::invoke(input_validation, impl, src.data(), src.size())); | 241 | | | 242 | | // make sure the validation variant that returns a bool agrees | 243 | 1.69k | const bool validation1 = results.back().error == simdutf::SUCCESS; | 244 | 1.69k | const bool validation2 = | 245 | 1.69k | std::invoke(ValidationFunctionTrait<From>::Validation, impl, | 246 | 1.69k | src.data(), src.size()); | 247 | 1.69k | if (validation1 != validation2) { | 248 | 0 | std::cerr << "begin errormessage for verify_valid_input()\n"; | 249 | 0 | std::cerr << ValidationFunctionTrait<From>::ValidationWithErrorsName | 250 | 0 | << " gives " << validation1 << " while " | 251 | 0 | << ValidationFunctionTrait<From>::ValidationName << " gave " | 252 | 0 | << validation2 << " for implementation " << impl->name() | 253 | 0 | << '\n'; | 254 | 0 | std::cerr << "end errormessage\n"; | 255 | 0 | std::abort(); | 256 | 0 | } | 257 | 1.69k | } | 258 | | | 259 | 564 | auto neq = [](const auto& a, const auto& b) { return a != b; }; | 260 | 564 | if (std::ranges::adjacent_find(results, neq) != results.end()) { | 261 | 0 | std::cerr << "begin errormessage for verify_valid_input()\n"; | 262 | 0 | std::cerr << "in fuzz case for " | 263 | 0 | << ValidationFunctionTrait<From>::ValidationWithErrorsName | 264 | 0 | << " invoked with " << src.size() << " elements:\n"; | 265 | 0 | for (std::size_t i = 0; i < results.size(); ++i) { | 266 | 0 | std::cerr << "got return " << std::dec << results[i] | 267 | 0 | << " from implementation " << implementations[i]->name() | 268 | 0 | << '\n'; | 269 | 0 | } | 270 | 0 | std::cerr << "end errormessage\n"; | 271 | 0 | ret.implementations_agree = false; | 272 | 564 | } else { | 273 | 564 | ret.implementations_agree = true; | 274 | 564 | } | 275 | 564 | ret.valid = std::ranges::all_of(results, [](const simdutf::result& r) { | 276 | 564 | return r.error == simdutf::SUCCESS; | 277 | 564 | }); | 278 | 564 | return ret; | 279 | 564 | } |
_ZNK10ConversionIL12UtfEncodings0ELS0_4EMN7simdutf14implementationEKDoFmmEMS2_KDoFmPKDsmPcEE18verify_valid_inputIvQneT_LS0_4EEENSA_17validation_resultENSt3__14spanIS5_Lm18446744073709551615EEE Line | Count | Source | 230 | 63 | validation_result verify_valid_input(FromSpan src) const { | 231 | 63 | validation_result ret{}; | 232 | | | 233 | 63 | auto input_validation = ValidationFunctionTrait<From>::ValidationWithErrors; | 234 | 63 | const auto implementations = get_supported_implementations(); | 235 | 63 | std::vector<simdutf::result> results; | 236 | 63 | results.reserve(implementations.size()); | 237 | | | 238 | 189 | for (auto impl : implementations) { | 239 | 189 | results.push_back( | 240 | 189 | std::invoke(input_validation, impl, src.data(), src.size())); | 241 | | | 242 | | // make sure the validation variant that returns a bool agrees | 243 | 189 | const bool validation1 = results.back().error == simdutf::SUCCESS; | 244 | 189 | const bool validation2 = | 245 | 189 | std::invoke(ValidationFunctionTrait<From>::Validation, impl, | 246 | 189 | src.data(), src.size()); | 247 | 189 | if (validation1 != validation2) { | 248 | 0 | std::cerr << "begin errormessage for verify_valid_input()\n"; | 249 | 0 | std::cerr << ValidationFunctionTrait<From>::ValidationWithErrorsName | 250 | 0 | << " gives " << validation1 << " while " | 251 | 0 | << ValidationFunctionTrait<From>::ValidationName << " gave " | 252 | 0 | << validation2 << " for implementation " << impl->name() | 253 | 0 | << '\n'; | 254 | 0 | std::cerr << "end errormessage\n"; | 255 | 0 | std::abort(); | 256 | 0 | } | 257 | 189 | } | 258 | | | 259 | 63 | auto neq = [](const auto& a, const auto& b) { return a != b; }; | 260 | 63 | if (std::ranges::adjacent_find(results, neq) != results.end()) { | 261 | 0 | std::cerr << "begin errormessage for verify_valid_input()\n"; | 262 | 0 | std::cerr << "in fuzz case for " | 263 | 0 | << ValidationFunctionTrait<From>::ValidationWithErrorsName | 264 | 0 | << " invoked with " << src.size() << " elements:\n"; | 265 | 0 | for (std::size_t i = 0; i < results.size(); ++i) { | 266 | 0 | std::cerr << "got return " << std::dec << results[i] | 267 | 0 | << " from implementation " << implementations[i]->name() | 268 | 0 | << '\n'; | 269 | 0 | } | 270 | 0 | std::cerr << "end errormessage\n"; | 271 | 0 | ret.implementations_agree = false; | 272 | 63 | } else { | 273 | 63 | ret.implementations_agree = true; | 274 | 63 | } | 275 | 63 | ret.valid = std::ranges::all_of(results, [](const simdutf::result& r) { | 276 | 63 | return r.error == simdutf::SUCCESS; | 277 | 63 | }); | 278 | 63 | return ret; | 279 | 63 | } |
_ZNK10ConversionIL12UtfEncodings1ELS0_4EMN7simdutf14implementationEKDoFmmEMS2_KDoFmPKDsmPcEE18verify_valid_inputIvQneT_LS0_4EEENSA_17validation_resultENSt3__14spanIS5_Lm18446744073709551615EEE Line | Count | Source | 230 | 62 | validation_result verify_valid_input(FromSpan src) const { | 231 | 62 | validation_result ret{}; | 232 | | | 233 | 62 | auto input_validation = ValidationFunctionTrait<From>::ValidationWithErrors; | 234 | 62 | const auto implementations = get_supported_implementations(); | 235 | 62 | std::vector<simdutf::result> results; | 236 | 62 | results.reserve(implementations.size()); | 237 | | | 238 | 186 | for (auto impl : implementations) { | 239 | 186 | results.push_back( | 240 | 186 | std::invoke(input_validation, impl, src.data(), src.size())); | 241 | | | 242 | | // make sure the validation variant that returns a bool agrees | 243 | 186 | const bool validation1 = results.back().error == simdutf::SUCCESS; | 244 | 186 | const bool validation2 = | 245 | 186 | std::invoke(ValidationFunctionTrait<From>::Validation, impl, | 246 | 186 | src.data(), src.size()); | 247 | 186 | if (validation1 != validation2) { | 248 | 0 | std::cerr << "begin errormessage for verify_valid_input()\n"; | 249 | 0 | std::cerr << ValidationFunctionTrait<From>::ValidationWithErrorsName | 250 | 0 | << " gives " << validation1 << " while " | 251 | 0 | << ValidationFunctionTrait<From>::ValidationName << " gave " | 252 | 0 | << validation2 << " for implementation " << impl->name() | 253 | 0 | << '\n'; | 254 | 0 | std::cerr << "end errormessage\n"; | 255 | 0 | std::abort(); | 256 | 0 | } | 257 | 186 | } | 258 | | | 259 | 62 | auto neq = [](const auto& a, const auto& b) { return a != b; }; | 260 | 62 | if (std::ranges::adjacent_find(results, neq) != results.end()) { | 261 | 0 | std::cerr << "begin errormessage for verify_valid_input()\n"; | 262 | 0 | std::cerr << "in fuzz case for " | 263 | 0 | << ValidationFunctionTrait<From>::ValidationWithErrorsName | 264 | 0 | << " invoked with " << src.size() << " elements:\n"; | 265 | 0 | for (std::size_t i = 0; i < results.size(); ++i) { | 266 | 0 | std::cerr << "got return " << std::dec << results[i] | 267 | 0 | << " from implementation " << implementations[i]->name() | 268 | 0 | << '\n'; | 269 | 0 | } | 270 | 0 | std::cerr << "end errormessage\n"; | 271 | 0 | ret.implementations_agree = false; | 272 | 62 | } else { | 273 | 62 | ret.implementations_agree = true; | 274 | 62 | } | 275 | 62 | ret.valid = std::ranges::all_of(results, [](const simdutf::result& r) { | 276 | 62 | return r.error == simdutf::SUCCESS; | 277 | 62 | }); | 278 | 62 | return ret; | 279 | 62 | } |
_ZNK10ConversionIL12UtfEncodings3ELS0_4EMN7simdutf14implementationEKDoFmmEMS2_KDoFmPKDimPcEE18verify_valid_inputIvQneT_LS0_4EEENSA_17validation_resultENSt3__14spanIS5_Lm18446744073709551615EEE Line | Count | Source | 230 | 94 | validation_result verify_valid_input(FromSpan src) const { | 231 | 94 | validation_result ret{}; | 232 | | | 233 | 94 | auto input_validation = ValidationFunctionTrait<From>::ValidationWithErrors; | 234 | 94 | const auto implementations = get_supported_implementations(); | 235 | 94 | std::vector<simdutf::result> results; | 236 | 94 | results.reserve(implementations.size()); | 237 | | | 238 | 282 | for (auto impl : implementations) { | 239 | 282 | results.push_back( | 240 | 282 | std::invoke(input_validation, impl, src.data(), src.size())); | 241 | | | 242 | | // make sure the validation variant that returns a bool agrees | 243 | 282 | const bool validation1 = results.back().error == simdutf::SUCCESS; | 244 | 282 | const bool validation2 = | 245 | 282 | std::invoke(ValidationFunctionTrait<From>::Validation, impl, | 246 | 282 | src.data(), src.size()); | 247 | 282 | if (validation1 != validation2) { | 248 | 0 | std::cerr << "begin errormessage for verify_valid_input()\n"; | 249 | 0 | std::cerr << ValidationFunctionTrait<From>::ValidationWithErrorsName | 250 | 0 | << " gives " << validation1 << " while " | 251 | 0 | << ValidationFunctionTrait<From>::ValidationName << " gave " | 252 | 0 | << validation2 << " for implementation " << impl->name() | 253 | 0 | << '\n'; | 254 | 0 | std::cerr << "end errormessage\n"; | 255 | 0 | std::abort(); | 256 | 0 | } | 257 | 282 | } | 258 | | | 259 | 94 | auto neq = [](const auto& a, const auto& b) { return a != b; }; | 260 | 94 | if (std::ranges::adjacent_find(results, neq) != results.end()) { | 261 | 0 | std::cerr << "begin errormessage for verify_valid_input()\n"; | 262 | 0 | std::cerr << "in fuzz case for " | 263 | 0 | << ValidationFunctionTrait<From>::ValidationWithErrorsName | 264 | 0 | << " invoked with " << src.size() << " elements:\n"; | 265 | 0 | for (std::size_t i = 0; i < results.size(); ++i) { | 266 | 0 | std::cerr << "got return " << std::dec << results[i] | 267 | 0 | << " from implementation " << implementations[i]->name() | 268 | 0 | << '\n'; | 269 | 0 | } | 270 | 0 | std::cerr << "end errormessage\n"; | 271 | 0 | ret.implementations_agree = false; | 272 | 94 | } else { | 273 | 94 | ret.implementations_agree = true; | 274 | 94 | } | 275 | 94 | ret.valid = std::ranges::all_of(results, [](const simdutf::result& r) { | 276 | 94 | return r.error == simdutf::SUCCESS; | 277 | 94 | }); | 278 | 94 | return ret; | 279 | 94 | } |
_ZNK10ConversionIL12UtfEncodings2ELS0_4EMN7simdutf14implementationEKDoFmPKcmEMS2_KDoFmS4_mPcEE18verify_valid_inputIvQneT_LS0_4EEENSA_17validation_resultENSt3__14spanIS3_Lm18446744073709551615EEE Line | Count | Source | 230 | 281 | validation_result verify_valid_input(FromSpan src) const { | 231 | 281 | validation_result ret{}; | 232 | | | 233 | 281 | auto input_validation = ValidationFunctionTrait<From>::ValidationWithErrors; | 234 | 281 | const auto implementations = get_supported_implementations(); | 235 | 281 | std::vector<simdutf::result> results; | 236 | 281 | results.reserve(implementations.size()); | 237 | | | 238 | 843 | for (auto impl : implementations) { | 239 | 843 | results.push_back( | 240 | 843 | std::invoke(input_validation, impl, src.data(), src.size())); | 241 | | | 242 | | // make sure the validation variant that returns a bool agrees | 243 | 843 | const bool validation1 = results.back().error == simdutf::SUCCESS; | 244 | 843 | const bool validation2 = | 245 | 843 | std::invoke(ValidationFunctionTrait<From>::Validation, impl, | 246 | 843 | src.data(), src.size()); | 247 | 843 | if (validation1 != validation2) { | 248 | 0 | std::cerr << "begin errormessage for verify_valid_input()\n"; | 249 | 0 | std::cerr << ValidationFunctionTrait<From>::ValidationWithErrorsName | 250 | 0 | << " gives " << validation1 << " while " | 251 | 0 | << ValidationFunctionTrait<From>::ValidationName << " gave " | 252 | 0 | << validation2 << " for implementation " << impl->name() | 253 | 0 | << '\n'; | 254 | 0 | std::cerr << "end errormessage\n"; | 255 | 0 | std::abort(); | 256 | 0 | } | 257 | 843 | } | 258 | | | 259 | 281 | auto neq = [](const auto& a, const auto& b) { return a != b; }; | 260 | 281 | if (std::ranges::adjacent_find(results, neq) != results.end()) { | 261 | 0 | std::cerr << "begin errormessage for verify_valid_input()\n"; | 262 | 0 | std::cerr << "in fuzz case for " | 263 | 0 | << ValidationFunctionTrait<From>::ValidationWithErrorsName | 264 | 0 | << " invoked with " << src.size() << " elements:\n"; | 265 | 0 | for (std::size_t i = 0; i < results.size(); ++i) { | 266 | 0 | std::cerr << "got return " << std::dec << results[i] | 267 | 0 | << " from implementation " << implementations[i]->name() | 268 | 0 | << '\n'; | 269 | 0 | } | 270 | 0 | std::cerr << "end errormessage\n"; | 271 | 0 | ret.implementations_agree = false; | 272 | 281 | } else { | 273 | 281 | ret.implementations_agree = true; | 274 | 281 | } | 275 | 281 | ret.valid = std::ranges::all_of(results, [](const simdutf::result& r) { | 276 | 281 | return r.error == simdutf::SUCCESS; | 277 | 281 | }); | 278 | 281 | return ret; | 279 | 281 | } |
_ZNK10ConversionIL12UtfEncodings0ELS0_4EMN7simdutf14implementationEKDoFmmEMS2_KDoFNS1_6resultEPKDsmPcEE18verify_valid_inputIvQneT_LS0_4EEENSB_17validation_resultENSt3__14spanIS6_Lm18446744073709551615EEE Line | Count | Source | 230 | 126 | validation_result verify_valid_input(FromSpan src) const { | 231 | 126 | validation_result ret{}; | 232 | | | 233 | 126 | auto input_validation = ValidationFunctionTrait<From>::ValidationWithErrors; | 234 | 126 | const auto implementations = get_supported_implementations(); | 235 | 126 | std::vector<simdutf::result> results; | 236 | 126 | results.reserve(implementations.size()); | 237 | | | 238 | 378 | for (auto impl : implementations) { | 239 | 378 | results.push_back( | 240 | 378 | std::invoke(input_validation, impl, src.data(), src.size())); | 241 | | | 242 | | // make sure the validation variant that returns a bool agrees | 243 | 378 | const bool validation1 = results.back().error == simdutf::SUCCESS; | 244 | 378 | const bool validation2 = | 245 | 378 | std::invoke(ValidationFunctionTrait<From>::Validation, impl, | 246 | 378 | src.data(), src.size()); | 247 | 378 | if (validation1 != validation2) { | 248 | 0 | std::cerr << "begin errormessage for verify_valid_input()\n"; | 249 | 0 | std::cerr << ValidationFunctionTrait<From>::ValidationWithErrorsName | 250 | 0 | << " gives " << validation1 << " while " | 251 | 0 | << ValidationFunctionTrait<From>::ValidationName << " gave " | 252 | 0 | << validation2 << " for implementation " << impl->name() | 253 | 0 | << '\n'; | 254 | 0 | std::cerr << "end errormessage\n"; | 255 | 0 | std::abort(); | 256 | 0 | } | 257 | 378 | } | 258 | | | 259 | 126 | auto neq = [](const auto& a, const auto& b) { return a != b; }; | 260 | 126 | if (std::ranges::adjacent_find(results, neq) != results.end()) { | 261 | 0 | std::cerr << "begin errormessage for verify_valid_input()\n"; | 262 | 0 | std::cerr << "in fuzz case for " | 263 | 0 | << ValidationFunctionTrait<From>::ValidationWithErrorsName | 264 | 0 | << " invoked with " << src.size() << " elements:\n"; | 265 | 0 | for (std::size_t i = 0; i < results.size(); ++i) { | 266 | 0 | std::cerr << "got return " << std::dec << results[i] | 267 | 0 | << " from implementation " << implementations[i]->name() | 268 | 0 | << '\n'; | 269 | 0 | } | 270 | 0 | std::cerr << "end errormessage\n"; | 271 | 0 | ret.implementations_agree = false; | 272 | 126 | } else { | 273 | 126 | ret.implementations_agree = true; | 274 | 126 | } | 275 | 126 | ret.valid = std::ranges::all_of(results, [](const simdutf::result& r) { | 276 | 126 | return r.error == simdutf::SUCCESS; | 277 | 126 | }); | 278 | 126 | return ret; | 279 | 126 | } |
_ZNK10ConversionIL12UtfEncodings0ELS0_3EMN7simdutf14implementationEKDoFmPKDsmEMS2_KDoFNS1_6resultES4_mPDiEE18verify_valid_inputIvQneT_LS0_4EEENSB_17validation_resultENSt3__14spanIS3_Lm18446744073709551615EEE Line | Count | Source | 230 | 150 | validation_result verify_valid_input(FromSpan src) const { | 231 | 150 | validation_result ret{}; | 232 | | | 233 | 150 | auto input_validation = ValidationFunctionTrait<From>::ValidationWithErrors; | 234 | 150 | const auto implementations = get_supported_implementations(); | 235 | 150 | std::vector<simdutf::result> results; | 236 | 150 | results.reserve(implementations.size()); | 237 | | | 238 | 450 | for (auto impl : implementations) { | 239 | 450 | results.push_back( | 240 | 450 | std::invoke(input_validation, impl, src.data(), src.size())); | 241 | | | 242 | | // make sure the validation variant that returns a bool agrees | 243 | 450 | const bool validation1 = results.back().error == simdutf::SUCCESS; | 244 | 450 | const bool validation2 = | 245 | 450 | std::invoke(ValidationFunctionTrait<From>::Validation, impl, | 246 | 450 | src.data(), src.size()); | 247 | 450 | if (validation1 != validation2) { | 248 | 0 | std::cerr << "begin errormessage for verify_valid_input()\n"; | 249 | 0 | std::cerr << ValidationFunctionTrait<From>::ValidationWithErrorsName | 250 | 0 | << " gives " << validation1 << " while " | 251 | 0 | << ValidationFunctionTrait<From>::ValidationName << " gave " | 252 | 0 | << validation2 << " for implementation " << impl->name() | 253 | 0 | << '\n'; | 254 | 0 | std::cerr << "end errormessage\n"; | 255 | 0 | std::abort(); | 256 | 0 | } | 257 | 450 | } | 258 | | | 259 | 150 | auto neq = [](const auto& a, const auto& b) { return a != b; }; | 260 | 150 | if (std::ranges::adjacent_find(results, neq) != results.end()) { | 261 | 0 | std::cerr << "begin errormessage for verify_valid_input()\n"; | 262 | 0 | std::cerr << "in fuzz case for " | 263 | 0 | << ValidationFunctionTrait<From>::ValidationWithErrorsName | 264 | 0 | << " invoked with " << src.size() << " elements:\n"; | 265 | 0 | for (std::size_t i = 0; i < results.size(); ++i) { | 266 | 0 | std::cerr << "got return " << std::dec << results[i] | 267 | 0 | << " from implementation " << implementations[i]->name() | 268 | 0 | << '\n'; | 269 | 0 | } | 270 | 0 | std::cerr << "end errormessage\n"; | 271 | 0 | ret.implementations_agree = false; | 272 | 150 | } else { | 273 | 150 | ret.implementations_agree = true; | 274 | 150 | } | 275 | 150 | ret.valid = std::ranges::all_of(results, [](const simdutf::result& r) { | 276 | 150 | return r.error == simdutf::SUCCESS; | 277 | 150 | }); | 278 | 150 | return ret; | 279 | 150 | } |
_ZNK10ConversionIL12UtfEncodings0ELS0_2EMN7simdutf14implementationEKDoFmPKDsmEMS2_KDoFNS1_6resultES4_mPcEE18verify_valid_inputIvQneT_LS0_4EEENSB_17validation_resultENSt3__14spanIS3_Lm18446744073709551615EEE Line | Count | Source | 230 | 293 | validation_result verify_valid_input(FromSpan src) const { | 231 | 293 | validation_result ret{}; | 232 | | | 233 | 293 | auto input_validation = ValidationFunctionTrait<From>::ValidationWithErrors; | 234 | 293 | const auto implementations = get_supported_implementations(); | 235 | 293 | std::vector<simdutf::result> results; | 236 | 293 | results.reserve(implementations.size()); | 237 | | | 238 | 879 | for (auto impl : implementations) { | 239 | 879 | results.push_back( | 240 | 879 | std::invoke(input_validation, impl, src.data(), src.size())); | 241 | | | 242 | | // make sure the validation variant that returns a bool agrees | 243 | 879 | const bool validation1 = results.back().error == simdutf::SUCCESS; | 244 | 879 | const bool validation2 = | 245 | 879 | std::invoke(ValidationFunctionTrait<From>::Validation, impl, | 246 | 879 | src.data(), src.size()); | 247 | 879 | if (validation1 != validation2) { | 248 | 0 | std::cerr << "begin errormessage for verify_valid_input()\n"; | 249 | 0 | std::cerr << ValidationFunctionTrait<From>::ValidationWithErrorsName | 250 | 0 | << " gives " << validation1 << " while " | 251 | 0 | << ValidationFunctionTrait<From>::ValidationName << " gave " | 252 | 0 | << validation2 << " for implementation " << impl->name() | 253 | 0 | << '\n'; | 254 | 0 | std::cerr << "end errormessage\n"; | 255 | 0 | std::abort(); | 256 | 0 | } | 257 | 879 | } | 258 | | | 259 | 293 | auto neq = [](const auto& a, const auto& b) { return a != b; }; | 260 | 293 | if (std::ranges::adjacent_find(results, neq) != results.end()) { | 261 | 0 | std::cerr << "begin errormessage for verify_valid_input()\n"; | 262 | 0 | std::cerr << "in fuzz case for " | 263 | 0 | << ValidationFunctionTrait<From>::ValidationWithErrorsName | 264 | 0 | << " invoked with " << src.size() << " elements:\n"; | 265 | 0 | for (std::size_t i = 0; i < results.size(); ++i) { | 266 | 0 | std::cerr << "got return " << std::dec << results[i] | 267 | 0 | << " from implementation " << implementations[i]->name() | 268 | 0 | << '\n'; | 269 | 0 | } | 270 | 0 | std::cerr << "end errormessage\n"; | 271 | 0 | ret.implementations_agree = false; | 272 | 293 | } else { | 273 | 293 | ret.implementations_agree = true; | 274 | 293 | } | 275 | 293 | ret.valid = std::ranges::all_of(results, [](const simdutf::result& r) { | 276 | 293 | return r.error == simdutf::SUCCESS; | 277 | 293 | }); | 278 | 293 | return ret; | 279 | 293 | } |
_ZNK10ConversionIL12UtfEncodings1ELS0_4EMN7simdutf14implementationEKDoFmmEMS2_KDoFNS1_6resultEPKDsmPcEE18verify_valid_inputIvQneT_LS0_4EEENSB_17validation_resultENSt3__14spanIS6_Lm18446744073709551615EEE Line | Count | Source | 230 | 115 | validation_result verify_valid_input(FromSpan src) const { | 231 | 115 | validation_result ret{}; | 232 | | | 233 | 115 | auto input_validation = ValidationFunctionTrait<From>::ValidationWithErrors; | 234 | 115 | const auto implementations = get_supported_implementations(); | 235 | 115 | std::vector<simdutf::result> results; | 236 | 115 | results.reserve(implementations.size()); | 237 | | | 238 | 345 | for (auto impl : implementations) { | 239 | 345 | results.push_back( | 240 | 345 | std::invoke(input_validation, impl, src.data(), src.size())); | 241 | | | 242 | | // make sure the validation variant that returns a bool agrees | 243 | 345 | const bool validation1 = results.back().error == simdutf::SUCCESS; | 244 | 345 | const bool validation2 = | 245 | 345 | std::invoke(ValidationFunctionTrait<From>::Validation, impl, | 246 | 345 | src.data(), src.size()); | 247 | 345 | if (validation1 != validation2) { | 248 | 0 | std::cerr << "begin errormessage for verify_valid_input()\n"; | 249 | 0 | std::cerr << ValidationFunctionTrait<From>::ValidationWithErrorsName | 250 | 0 | << " gives " << validation1 << " while " | 251 | 0 | << ValidationFunctionTrait<From>::ValidationName << " gave " | 252 | 0 | << validation2 << " for implementation " << impl->name() | 253 | 0 | << '\n'; | 254 | 0 | std::cerr << "end errormessage\n"; | 255 | 0 | std::abort(); | 256 | 0 | } | 257 | 345 | } | 258 | | | 259 | 115 | auto neq = [](const auto& a, const auto& b) { return a != b; }; | 260 | 115 | if (std::ranges::adjacent_find(results, neq) != results.end()) { | 261 | 0 | std::cerr << "begin errormessage for verify_valid_input()\n"; | 262 | 0 | std::cerr << "in fuzz case for " | 263 | 0 | << ValidationFunctionTrait<From>::ValidationWithErrorsName | 264 | 0 | << " invoked with " << src.size() << " elements:\n"; | 265 | 0 | for (std::size_t i = 0; i < results.size(); ++i) { | 266 | 0 | std::cerr << "got return " << std::dec << results[i] | 267 | 0 | << " from implementation " << implementations[i]->name() | 268 | 0 | << '\n'; | 269 | 0 | } | 270 | 0 | std::cerr << "end errormessage\n"; | 271 | 0 | ret.implementations_agree = false; | 272 | 115 | } else { | 273 | 115 | ret.implementations_agree = true; | 274 | 115 | } | 275 | 115 | ret.valid = std::ranges::all_of(results, [](const simdutf::result& r) { | 276 | 115 | return r.error == simdutf::SUCCESS; | 277 | 115 | }); | 278 | 115 | return ret; | 279 | 115 | } |
_ZNK10ConversionIL12UtfEncodings1ELS0_3EMN7simdutf14implementationEKDoFmPKDsmEMS2_KDoFNS1_6resultES4_mPDiEE18verify_valid_inputIvQneT_LS0_4EEENSB_17validation_resultENSt3__14spanIS3_Lm18446744073709551615EEE Line | Count | Source | 230 | 207 | validation_result verify_valid_input(FromSpan src) const { | 231 | 207 | validation_result ret{}; | 232 | | | 233 | 207 | auto input_validation = ValidationFunctionTrait<From>::ValidationWithErrors; | 234 | 207 | const auto implementations = get_supported_implementations(); | 235 | 207 | std::vector<simdutf::result> results; | 236 | 207 | results.reserve(implementations.size()); | 237 | | | 238 | 621 | for (auto impl : implementations) { | 239 | 621 | results.push_back( | 240 | 621 | std::invoke(input_validation, impl, src.data(), src.size())); | 241 | | | 242 | | // make sure the validation variant that returns a bool agrees | 243 | 621 | const bool validation1 = results.back().error == simdutf::SUCCESS; | 244 | 621 | const bool validation2 = | 245 | 621 | std::invoke(ValidationFunctionTrait<From>::Validation, impl, | 246 | 621 | src.data(), src.size()); | 247 | 621 | if (validation1 != validation2) { | 248 | 0 | std::cerr << "begin errormessage for verify_valid_input()\n"; | 249 | 0 | std::cerr << ValidationFunctionTrait<From>::ValidationWithErrorsName | 250 | 0 | << " gives " << validation1 << " while " | 251 | 0 | << ValidationFunctionTrait<From>::ValidationName << " gave " | 252 | 0 | << validation2 << " for implementation " << impl->name() | 253 | 0 | << '\n'; | 254 | 0 | std::cerr << "end errormessage\n"; | 255 | 0 | std::abort(); | 256 | 0 | } | 257 | 621 | } | 258 | | | 259 | 207 | auto neq = [](const auto& a, const auto& b) { return a != b; }; | 260 | 207 | if (std::ranges::adjacent_find(results, neq) != results.end()) { | 261 | 0 | std::cerr << "begin errormessage for verify_valid_input()\n"; | 262 | 0 | std::cerr << "in fuzz case for " | 263 | 0 | << ValidationFunctionTrait<From>::ValidationWithErrorsName | 264 | 0 | << " invoked with " << src.size() << " elements:\n"; | 265 | 0 | for (std::size_t i = 0; i < results.size(); ++i) { | 266 | 0 | std::cerr << "got return " << std::dec << results[i] | 267 | 0 | << " from implementation " << implementations[i]->name() | 268 | 0 | << '\n'; | 269 | 0 | } | 270 | 0 | std::cerr << "end errormessage\n"; | 271 | 0 | ret.implementations_agree = false; | 272 | 207 | } else { | 273 | 207 | ret.implementations_agree = true; | 274 | 207 | } | 275 | 207 | ret.valid = std::ranges::all_of(results, [](const simdutf::result& r) { | 276 | 207 | return r.error == simdutf::SUCCESS; | 277 | 207 | }); | 278 | 207 | return ret; | 279 | 207 | } |
_ZNK10ConversionIL12UtfEncodings1ELS0_2EMN7simdutf14implementationEKDoFmPKDsmEMS2_KDoFNS1_6resultES4_mPcEE18verify_valid_inputIvQneT_LS0_4EEENSB_17validation_resultENSt3__14spanIS3_Lm18446744073709551615EEE Line | Count | Source | 230 | 315 | validation_result verify_valid_input(FromSpan src) const { | 231 | 315 | validation_result ret{}; | 232 | | | 233 | 315 | auto input_validation = ValidationFunctionTrait<From>::ValidationWithErrors; | 234 | 315 | const auto implementations = get_supported_implementations(); | 235 | 315 | std::vector<simdutf::result> results; | 236 | 315 | results.reserve(implementations.size()); | 237 | | | 238 | 945 | for (auto impl : implementations) { | 239 | 945 | results.push_back( | 240 | 945 | std::invoke(input_validation, impl, src.data(), src.size())); | 241 | | | 242 | | // make sure the validation variant that returns a bool agrees | 243 | 945 | const bool validation1 = results.back().error == simdutf::SUCCESS; | 244 | 945 | const bool validation2 = | 245 | 945 | std::invoke(ValidationFunctionTrait<From>::Validation, impl, | 246 | 945 | src.data(), src.size()); | 247 | 945 | if (validation1 != validation2) { | 248 | 0 | std::cerr << "begin errormessage for verify_valid_input()\n"; | 249 | 0 | std::cerr << ValidationFunctionTrait<From>::ValidationWithErrorsName | 250 | 0 | << " gives " << validation1 << " while " | 251 | 0 | << ValidationFunctionTrait<From>::ValidationName << " gave " | 252 | 0 | << validation2 << " for implementation " << impl->name() | 253 | 0 | << '\n'; | 254 | 0 | std::cerr << "end errormessage\n"; | 255 | 0 | std::abort(); | 256 | 0 | } | 257 | 945 | } | 258 | | | 259 | 315 | auto neq = [](const auto& a, const auto& b) { return a != b; }; | 260 | 315 | if (std::ranges::adjacent_find(results, neq) != results.end()) { | 261 | 0 | std::cerr << "begin errormessage for verify_valid_input()\n"; | 262 | 0 | std::cerr << "in fuzz case for " | 263 | 0 | << ValidationFunctionTrait<From>::ValidationWithErrorsName | 264 | 0 | << " invoked with " << src.size() << " elements:\n"; | 265 | 0 | for (std::size_t i = 0; i < results.size(); ++i) { | 266 | 0 | std::cerr << "got return " << std::dec << results[i] | 267 | 0 | << " from implementation " << implementations[i]->name() | 268 | 0 | << '\n'; | 269 | 0 | } | 270 | 0 | std::cerr << "end errormessage\n"; | 271 | 0 | ret.implementations_agree = false; | 272 | 315 | } else { | 273 | 315 | ret.implementations_agree = true; | 274 | 315 | } | 275 | 315 | ret.valid = std::ranges::all_of(results, [](const simdutf::result& r) { | 276 | 315 | return r.error == simdutf::SUCCESS; | 277 | 315 | }); | 278 | 315 | return ret; | 279 | 315 | } |
_ZNK10ConversionIL12UtfEncodings3ELS0_4EMN7simdutf14implementationEKDoFmmEMS2_KDoFNS1_6resultEPKDimPcEE18verify_valid_inputIvQneT_LS0_4EEENSB_17validation_resultENSt3__14spanIS6_Lm18446744073709551615EEE Line | Count | Source | 230 | 210 | validation_result verify_valid_input(FromSpan src) const { | 231 | 210 | validation_result ret{}; | 232 | | | 233 | 210 | auto input_validation = ValidationFunctionTrait<From>::ValidationWithErrors; | 234 | 210 | const auto implementations = get_supported_implementations(); | 235 | 210 | std::vector<simdutf::result> results; | 236 | 210 | results.reserve(implementations.size()); | 237 | | | 238 | 630 | for (auto impl : implementations) { | 239 | 630 | results.push_back( | 240 | 630 | std::invoke(input_validation, impl, src.data(), src.size())); | 241 | | | 242 | | // make sure the validation variant that returns a bool agrees | 243 | 630 | const bool validation1 = results.back().error == simdutf::SUCCESS; | 244 | 630 | const bool validation2 = | 245 | 630 | std::invoke(ValidationFunctionTrait<From>::Validation, impl, | 246 | 630 | src.data(), src.size()); | 247 | 630 | if (validation1 != validation2) { | 248 | 0 | std::cerr << "begin errormessage for verify_valid_input()\n"; | 249 | 0 | std::cerr << ValidationFunctionTrait<From>::ValidationWithErrorsName | 250 | 0 | << " gives " << validation1 << " while " | 251 | 0 | << ValidationFunctionTrait<From>::ValidationName << " gave " | 252 | 0 | << validation2 << " for implementation " << impl->name() | 253 | 0 | << '\n'; | 254 | 0 | std::cerr << "end errormessage\n"; | 255 | 0 | std::abort(); | 256 | 0 | } | 257 | 630 | } | 258 | | | 259 | 210 | auto neq = [](const auto& a, const auto& b) { return a != b; }; | 260 | 210 | if (std::ranges::adjacent_find(results, neq) != results.end()) { | 261 | 0 | std::cerr << "begin errormessage for verify_valid_input()\n"; | 262 | 0 | std::cerr << "in fuzz case for " | 263 | 0 | << ValidationFunctionTrait<From>::ValidationWithErrorsName | 264 | 0 | << " invoked with " << src.size() << " elements:\n"; | 265 | 0 | for (std::size_t i = 0; i < results.size(); ++i) { | 266 | 0 | std::cerr << "got return " << std::dec << results[i] | 267 | 0 | << " from implementation " << implementations[i]->name() | 268 | 0 | << '\n'; | 269 | 0 | } | 270 | 0 | std::cerr << "end errormessage\n"; | 271 | 0 | ret.implementations_agree = false; | 272 | 210 | } else { | 273 | 210 | ret.implementations_agree = true; | 274 | 210 | } | 275 | 210 | ret.valid = std::ranges::all_of(results, [](const simdutf::result& r) { | 276 | 210 | return r.error == simdutf::SUCCESS; | 277 | 210 | }); | 278 | 210 | return ret; | 279 | 210 | } |
_ZNK10ConversionIL12UtfEncodings3ELS0_0EMN7simdutf14implementationEKDoFmPKDimEMS2_KDoFNS1_6resultES4_mPDsEE18verify_valid_inputIvQneT_LS0_4EEENSB_17validation_resultENSt3__14spanIS3_Lm18446744073709551615EEE Line | Count | Source | 230 | 303 | validation_result verify_valid_input(FromSpan src) const { | 231 | 303 | validation_result ret{}; | 232 | | | 233 | 303 | auto input_validation = ValidationFunctionTrait<From>::ValidationWithErrors; | 234 | 303 | const auto implementations = get_supported_implementations(); | 235 | 303 | std::vector<simdutf::result> results; | 236 | 303 | results.reserve(implementations.size()); | 237 | | | 238 | 909 | for (auto impl : implementations) { | 239 | 909 | results.push_back( | 240 | 909 | std::invoke(input_validation, impl, src.data(), src.size())); | 241 | | | 242 | | // make sure the validation variant that returns a bool agrees | 243 | 909 | const bool validation1 = results.back().error == simdutf::SUCCESS; | 244 | 909 | const bool validation2 = | 245 | 909 | std::invoke(ValidationFunctionTrait<From>::Validation, impl, | 246 | 909 | src.data(), src.size()); | 247 | 909 | if (validation1 != validation2) { | 248 | 0 | std::cerr << "begin errormessage for verify_valid_input()\n"; | 249 | 0 | std::cerr << ValidationFunctionTrait<From>::ValidationWithErrorsName | 250 | 0 | << " gives " << validation1 << " while " | 251 | 0 | << ValidationFunctionTrait<From>::ValidationName << " gave " | 252 | 0 | << validation2 << " for implementation " << impl->name() | 253 | 0 | << '\n'; | 254 | 0 | std::cerr << "end errormessage\n"; | 255 | 0 | std::abort(); | 256 | 0 | } | 257 | 909 | } | 258 | | | 259 | 303 | auto neq = [](const auto& a, const auto& b) { return a != b; }; | 260 | 303 | if (std::ranges::adjacent_find(results, neq) != results.end()) { | 261 | 0 | std::cerr << "begin errormessage for verify_valid_input()\n"; | 262 | 0 | std::cerr << "in fuzz case for " | 263 | 0 | << ValidationFunctionTrait<From>::ValidationWithErrorsName | 264 | 0 | << " invoked with " << src.size() << " elements:\n"; | 265 | 0 | for (std::size_t i = 0; i < results.size(); ++i) { | 266 | 0 | std::cerr << "got return " << std::dec << results[i] | 267 | 0 | << " from implementation " << implementations[i]->name() | 268 | 0 | << '\n'; | 269 | 0 | } | 270 | 0 | std::cerr << "end errormessage\n"; | 271 | 0 | ret.implementations_agree = false; | 272 | 303 | } else { | 273 | 303 | ret.implementations_agree = true; | 274 | 303 | } | 275 | 303 | ret.valid = std::ranges::all_of(results, [](const simdutf::result& r) { | 276 | 303 | return r.error == simdutf::SUCCESS; | 277 | 303 | }); | 278 | 303 | return ret; | 279 | 303 | } |
_ZNK10ConversionIL12UtfEncodings3ELS0_1EMN7simdutf14implementationEKDoFmPKDimEMS2_KDoFNS1_6resultES4_mPDsEE18verify_valid_inputIvQneT_LS0_4EEENSB_17validation_resultENSt3__14spanIS3_Lm18446744073709551615EEE Line | Count | Source | 230 | 358 | validation_result verify_valid_input(FromSpan src) const { | 231 | 358 | validation_result ret{}; | 232 | | | 233 | 358 | auto input_validation = ValidationFunctionTrait<From>::ValidationWithErrors; | 234 | 358 | const auto implementations = get_supported_implementations(); | 235 | 358 | std::vector<simdutf::result> results; | 236 | 358 | results.reserve(implementations.size()); | 237 | | | 238 | 1.07k | for (auto impl : implementations) { | 239 | 1.07k | results.push_back( | 240 | 1.07k | std::invoke(input_validation, impl, src.data(), src.size())); | 241 | | | 242 | | // make sure the validation variant that returns a bool agrees | 243 | 1.07k | const bool validation1 = results.back().error == simdutf::SUCCESS; | 244 | 1.07k | const bool validation2 = | 245 | 1.07k | std::invoke(ValidationFunctionTrait<From>::Validation, impl, | 246 | 1.07k | src.data(), src.size()); | 247 | 1.07k | if (validation1 != validation2) { | 248 | 0 | std::cerr << "begin errormessage for verify_valid_input()\n"; | 249 | 0 | std::cerr << ValidationFunctionTrait<From>::ValidationWithErrorsName | 250 | 0 | << " gives " << validation1 << " while " | 251 | 0 | << ValidationFunctionTrait<From>::ValidationName << " gave " | 252 | 0 | << validation2 << " for implementation " << impl->name() | 253 | 0 | << '\n'; | 254 | 0 | std::cerr << "end errormessage\n"; | 255 | 0 | std::abort(); | 256 | 0 | } | 257 | 1.07k | } | 258 | | | 259 | 358 | auto neq = [](const auto& a, const auto& b) { return a != b; }; | 260 | 358 | if (std::ranges::adjacent_find(results, neq) != results.end()) { | 261 | 0 | std::cerr << "begin errormessage for verify_valid_input()\n"; | 262 | 0 | std::cerr << "in fuzz case for " | 263 | 0 | << ValidationFunctionTrait<From>::ValidationWithErrorsName | 264 | 0 | << " invoked with " << src.size() << " elements:\n"; | 265 | 0 | for (std::size_t i = 0; i < results.size(); ++i) { | 266 | 0 | std::cerr << "got return " << std::dec << results[i] | 267 | 0 | << " from implementation " << implementations[i]->name() | 268 | 0 | << '\n'; | 269 | 0 | } | 270 | 0 | std::cerr << "end errormessage\n"; | 271 | 0 | ret.implementations_agree = false; | 272 | 358 | } else { | 273 | 358 | ret.implementations_agree = true; | 274 | 358 | } | 275 | 358 | ret.valid = std::ranges::all_of(results, [](const simdutf::result& r) { | 276 | 358 | return r.error == simdutf::SUCCESS; | 277 | 358 | }); | 278 | 358 | return ret; | 279 | 358 | } |
_ZNK10ConversionIL12UtfEncodings3ELS0_2EMN7simdutf14implementationEKDoFmPKDimEMS2_KDoFNS1_6resultES4_mPcEE18verify_valid_inputIvQneT_LS0_4EEENSB_17validation_resultENSt3__14spanIS3_Lm18446744073709551615EEE Line | Count | Source | 230 | 415 | validation_result verify_valid_input(FromSpan src) const { | 231 | 415 | validation_result ret{}; | 232 | | | 233 | 415 | auto input_validation = ValidationFunctionTrait<From>::ValidationWithErrors; | 234 | 415 | const auto implementations = get_supported_implementations(); | 235 | 415 | std::vector<simdutf::result> results; | 236 | 415 | results.reserve(implementations.size()); | 237 | | | 238 | 1.24k | for (auto impl : implementations) { | 239 | 1.24k | results.push_back( | 240 | 1.24k | std::invoke(input_validation, impl, src.data(), src.size())); | 241 | | | 242 | | // make sure the validation variant that returns a bool agrees | 243 | 1.24k | const bool validation1 = results.back().error == simdutf::SUCCESS; | 244 | 1.24k | const bool validation2 = | 245 | 1.24k | std::invoke(ValidationFunctionTrait<From>::Validation, impl, | 246 | 1.24k | src.data(), src.size()); | 247 | 1.24k | if (validation1 != validation2) { | 248 | 0 | std::cerr << "begin errormessage for verify_valid_input()\n"; | 249 | 0 | std::cerr << ValidationFunctionTrait<From>::ValidationWithErrorsName | 250 | 0 | << " gives " << validation1 << " while " | 251 | 0 | << ValidationFunctionTrait<From>::ValidationName << " gave " | 252 | 0 | << validation2 << " for implementation " << impl->name() | 253 | 0 | << '\n'; | 254 | 0 | std::cerr << "end errormessage\n"; | 255 | 0 | std::abort(); | 256 | 0 | } | 257 | 1.24k | } | 258 | | | 259 | 415 | auto neq = [](const auto& a, const auto& b) { return a != b; }; | 260 | 415 | if (std::ranges::adjacent_find(results, neq) != results.end()) { | 261 | 0 | std::cerr << "begin errormessage for verify_valid_input()\n"; | 262 | 0 | std::cerr << "in fuzz case for " | 263 | 0 | << ValidationFunctionTrait<From>::ValidationWithErrorsName | 264 | 0 | << " invoked with " << src.size() << " elements:\n"; | 265 | 0 | for (std::size_t i = 0; i < results.size(); ++i) { | 266 | 0 | std::cerr << "got return " << std::dec << results[i] | 267 | 0 | << " from implementation " << implementations[i]->name() | 268 | 0 | << '\n'; | 269 | 0 | } | 270 | 0 | std::cerr << "end errormessage\n"; | 271 | 0 | ret.implementations_agree = false; | 272 | 415 | } else { | 273 | 415 | ret.implementations_agree = true; | 274 | 415 | } | 275 | 415 | ret.valid = std::ranges::all_of(results, [](const simdutf::result& r) { | 276 | 415 | return r.error == simdutf::SUCCESS; | 277 | 415 | }); | 278 | 415 | return ret; | 279 | 415 | } |
_ZNK10ConversionIL12UtfEncodings2ELS0_4EMN7simdutf14implementationEKDoFmPKcmEMS2_KDoFNS1_6resultES4_mPcEE18verify_valid_inputIvQneT_LS0_4EEENSB_17validation_resultENSt3__14spanIS3_Lm18446744073709551615EEE Line | Count | Source | 230 | 258 | validation_result verify_valid_input(FromSpan src) const { | 231 | 258 | validation_result ret{}; | 232 | | | 233 | 258 | auto input_validation = ValidationFunctionTrait<From>::ValidationWithErrors; | 234 | 258 | const auto implementations = get_supported_implementations(); | 235 | 258 | std::vector<simdutf::result> results; | 236 | 258 | results.reserve(implementations.size()); | 237 | | | 238 | 774 | for (auto impl : implementations) { | 239 | 774 | results.push_back( | 240 | 774 | std::invoke(input_validation, impl, src.data(), src.size())); | 241 | | | 242 | | // make sure the validation variant that returns a bool agrees | 243 | 774 | const bool validation1 = results.back().error == simdutf::SUCCESS; | 244 | 774 | const bool validation2 = | 245 | 774 | std::invoke(ValidationFunctionTrait<From>::Validation, impl, | 246 | 774 | src.data(), src.size()); | 247 | 774 | if (validation1 != validation2) { | 248 | 0 | std::cerr << "begin errormessage for verify_valid_input()\n"; | 249 | 0 | std::cerr << ValidationFunctionTrait<From>::ValidationWithErrorsName | 250 | 0 | << " gives " << validation1 << " while " | 251 | 0 | << ValidationFunctionTrait<From>::ValidationName << " gave " | 252 | 0 | << validation2 << " for implementation " << impl->name() | 253 | 0 | << '\n'; | 254 | 0 | std::cerr << "end errormessage\n"; | 255 | 0 | std::abort(); | 256 | 0 | } | 257 | 774 | } | 258 | | | 259 | 258 | auto neq = [](const auto& a, const auto& b) { return a != b; }; | 260 | 258 | if (std::ranges::adjacent_find(results, neq) != results.end()) { | 261 | 0 | std::cerr << "begin errormessage for verify_valid_input()\n"; | 262 | 0 | std::cerr << "in fuzz case for " | 263 | 0 | << ValidationFunctionTrait<From>::ValidationWithErrorsName | 264 | 0 | << " invoked with " << src.size() << " elements:\n"; | 265 | 0 | for (std::size_t i = 0; i < results.size(); ++i) { | 266 | 0 | std::cerr << "got return " << std::dec << results[i] | 267 | 0 | << " from implementation " << implementations[i]->name() | 268 | 0 | << '\n'; | 269 | 0 | } | 270 | 0 | std::cerr << "end errormessage\n"; | 271 | 0 | ret.implementations_agree = false; | 272 | 258 | } else { | 273 | 258 | ret.implementations_agree = true; | 274 | 258 | } | 275 | 258 | ret.valid = std::ranges::all_of(results, [](const simdutf::result& r) { | 276 | 258 | return r.error == simdutf::SUCCESS; | 277 | 258 | }); | 278 | 258 | return ret; | 279 | 258 | } |
_ZNK10ConversionIL12UtfEncodings2ELS0_0EMN7simdutf14implementationEKDoFmPKcmEMS2_KDoFNS1_6resultES4_mPDsEE18verify_valid_inputIvQneT_LS0_4EEENSB_17validation_resultENSt3__14spanIS3_Lm18446744073709551615EEE Line | Count | Source | 230 | 351 | validation_result verify_valid_input(FromSpan src) const { | 231 | 351 | validation_result ret{}; | 232 | | | 233 | 351 | auto input_validation = ValidationFunctionTrait<From>::ValidationWithErrors; | 234 | 351 | const auto implementations = get_supported_implementations(); | 235 | 351 | std::vector<simdutf::result> results; | 236 | 351 | results.reserve(implementations.size()); | 237 | | | 238 | 1.05k | for (auto impl : implementations) { | 239 | 1.05k | results.push_back( | 240 | 1.05k | std::invoke(input_validation, impl, src.data(), src.size())); | 241 | | | 242 | | // make sure the validation variant that returns a bool agrees | 243 | 1.05k | const bool validation1 = results.back().error == simdutf::SUCCESS; | 244 | 1.05k | const bool validation2 = | 245 | 1.05k | std::invoke(ValidationFunctionTrait<From>::Validation, impl, | 246 | 1.05k | src.data(), src.size()); | 247 | 1.05k | if (validation1 != validation2) { | 248 | 0 | std::cerr << "begin errormessage for verify_valid_input()\n"; | 249 | 0 | std::cerr << ValidationFunctionTrait<From>::ValidationWithErrorsName | 250 | 0 | << " gives " << validation1 << " while " | 251 | 0 | << ValidationFunctionTrait<From>::ValidationName << " gave " | 252 | 0 | << validation2 << " for implementation " << impl->name() | 253 | 0 | << '\n'; | 254 | 0 | std::cerr << "end errormessage\n"; | 255 | 0 | std::abort(); | 256 | 0 | } | 257 | 1.05k | } | 258 | | | 259 | 351 | auto neq = [](const auto& a, const auto& b) { return a != b; }; | 260 | 351 | if (std::ranges::adjacent_find(results, neq) != results.end()) { | 261 | 0 | std::cerr << "begin errormessage for verify_valid_input()\n"; | 262 | 0 | std::cerr << "in fuzz case for " | 263 | 0 | << ValidationFunctionTrait<From>::ValidationWithErrorsName | 264 | 0 | << " invoked with " << src.size() << " elements:\n"; | 265 | 0 | for (std::size_t i = 0; i < results.size(); ++i) { | 266 | 0 | std::cerr << "got return " << std::dec << results[i] | 267 | 0 | << " from implementation " << implementations[i]->name() | 268 | 0 | << '\n'; | 269 | 0 | } | 270 | 0 | std::cerr << "end errormessage\n"; | 271 | 0 | ret.implementations_agree = false; | 272 | 351 | } else { | 273 | 351 | ret.implementations_agree = true; | 274 | 351 | } | 275 | 351 | ret.valid = std::ranges::all_of(results, [](const simdutf::result& r) { | 276 | 351 | return r.error == simdutf::SUCCESS; | 277 | 351 | }); | 278 | 351 | return ret; | 279 | 351 | } |
_ZNK10ConversionIL12UtfEncodings2ELS0_1EMN7simdutf14implementationEKDoFmPKcmEMS2_KDoFNS1_6resultES4_mPDsEE18verify_valid_inputIvQneT_LS0_4EEENSB_17validation_resultENSt3__14spanIS3_Lm18446744073709551615EEE Line | Count | Source | 230 | 287 | validation_result verify_valid_input(FromSpan src) const { | 231 | 287 | validation_result ret{}; | 232 | | | 233 | 287 | auto input_validation = ValidationFunctionTrait<From>::ValidationWithErrors; | 234 | 287 | const auto implementations = get_supported_implementations(); | 235 | 287 | std::vector<simdutf::result> results; | 236 | 287 | results.reserve(implementations.size()); | 237 | | | 238 | 861 | for (auto impl : implementations) { | 239 | 861 | results.push_back( | 240 | 861 | std::invoke(input_validation, impl, src.data(), src.size())); | 241 | | | 242 | | // make sure the validation variant that returns a bool agrees | 243 | 861 | const bool validation1 = results.back().error == simdutf::SUCCESS; | 244 | 861 | const bool validation2 = | 245 | 861 | std::invoke(ValidationFunctionTrait<From>::Validation, impl, | 246 | 861 | src.data(), src.size()); | 247 | 861 | if (validation1 != validation2) { | 248 | 0 | std::cerr << "begin errormessage for verify_valid_input()\n"; | 249 | 0 | std::cerr << ValidationFunctionTrait<From>::ValidationWithErrorsName | 250 | 0 | << " gives " << validation1 << " while " | 251 | 0 | << ValidationFunctionTrait<From>::ValidationName << " gave " | 252 | 0 | << validation2 << " for implementation " << impl->name() | 253 | 0 | << '\n'; | 254 | 0 | std::cerr << "end errormessage\n"; | 255 | 0 | std::abort(); | 256 | 0 | } | 257 | 861 | } | 258 | | | 259 | 287 | auto neq = [](const auto& a, const auto& b) { return a != b; }; | 260 | 287 | if (std::ranges::adjacent_find(results, neq) != results.end()) { | 261 | 0 | std::cerr << "begin errormessage for verify_valid_input()\n"; | 262 | 0 | std::cerr << "in fuzz case for " | 263 | 0 | << ValidationFunctionTrait<From>::ValidationWithErrorsName | 264 | 0 | << " invoked with " << src.size() << " elements:\n"; | 265 | 0 | for (std::size_t i = 0; i < results.size(); ++i) { | 266 | 0 | std::cerr << "got return " << std::dec << results[i] | 267 | 0 | << " from implementation " << implementations[i]->name() | 268 | 0 | << '\n'; | 269 | 0 | } | 270 | 0 | std::cerr << "end errormessage\n"; | 271 | 0 | ret.implementations_agree = false; | 272 | 287 | } else { | 273 | 287 | ret.implementations_agree = true; | 274 | 287 | } | 275 | 287 | ret.valid = std::ranges::all_of(results, [](const simdutf::result& r) { | 276 | 287 | return r.error == simdutf::SUCCESS; | 277 | 287 | }); | 278 | 287 | return ret; | 279 | 287 | } |
_ZNK10ConversionIL12UtfEncodings2ELS0_3EMN7simdutf14implementationEKDoFmPKcmEMS2_KDoFNS1_6resultES4_mPDiEE18verify_valid_inputIvQneT_LS0_4EEENSB_17validation_resultENSt3__14spanIS3_Lm18446744073709551615EEE Line | Count | Source | 230 | 369 | validation_result verify_valid_input(FromSpan src) const { | 231 | 369 | validation_result ret{}; | 232 | | | 233 | 369 | auto input_validation = ValidationFunctionTrait<From>::ValidationWithErrors; | 234 | 369 | const auto implementations = get_supported_implementations(); | 235 | 369 | std::vector<simdutf::result> results; | 236 | 369 | results.reserve(implementations.size()); | 237 | | | 238 | 1.10k | for (auto impl : implementations) { | 239 | 1.10k | results.push_back( | 240 | 1.10k | std::invoke(input_validation, impl, src.data(), src.size())); | 241 | | | 242 | | // make sure the validation variant that returns a bool agrees | 243 | 1.10k | const bool validation1 = results.back().error == simdutf::SUCCESS; | 244 | 1.10k | const bool validation2 = | 245 | 1.10k | std::invoke(ValidationFunctionTrait<From>::Validation, impl, | 246 | 1.10k | src.data(), src.size()); | 247 | 1.10k | if (validation1 != validation2) { | 248 | 0 | std::cerr << "begin errormessage for verify_valid_input()\n"; | 249 | 0 | std::cerr << ValidationFunctionTrait<From>::ValidationWithErrorsName | 250 | 0 | << " gives " << validation1 << " while " | 251 | 0 | << ValidationFunctionTrait<From>::ValidationName << " gave " | 252 | 0 | << validation2 << " for implementation " << impl->name() | 253 | 0 | << '\n'; | 254 | 0 | std::cerr << "end errormessage\n"; | 255 | 0 | std::abort(); | 256 | 0 | } | 257 | 1.10k | } | 258 | | | 259 | 369 | auto neq = [](const auto& a, const auto& b) { return a != b; }; | 260 | 369 | if (std::ranges::adjacent_find(results, neq) != results.end()) { | 261 | 0 | std::cerr << "begin errormessage for verify_valid_input()\n"; | 262 | 0 | std::cerr << "in fuzz case for " | 263 | 0 | << ValidationFunctionTrait<From>::ValidationWithErrorsName | 264 | 0 | << " invoked with " << src.size() << " elements:\n"; | 265 | 0 | for (std::size_t i = 0; i < results.size(); ++i) { | 266 | 0 | std::cerr << "got return " << std::dec << results[i] | 267 | 0 | << " from implementation " << implementations[i]->name() | 268 | 0 | << '\n'; | 269 | 0 | } | 270 | 0 | std::cerr << "end errormessage\n"; | 271 | 0 | ret.implementations_agree = false; | 272 | 369 | } else { | 273 | 369 | ret.implementations_agree = true; | 274 | 369 | } | 275 | 369 | ret.valid = std::ranges::all_of(results, [](const simdutf::result& r) { | 276 | 369 | return r.error == simdutf::SUCCESS; | 277 | 369 | }); | 278 | 369 | return ret; | 279 | 369 | } |
|
280 | | |
281 | | template <typename Dummy = void> |
282 | | requires(From == UtfEncodings::LATIN1) |
283 | 394 | validation_result verify_valid_input(FromSpan) const { |
284 | | // all latin1 input is valid. there is no simdutf validation function for |
285 | | // it. |
286 | 394 | return validation_result{.valid = true, .implementations_agree = true}; |
287 | 394 | } _ZNK10ConversionIL12UtfEncodings4ELS0_3EMN7simdutf14implementationEKDoFmmEMS2_KDoFmPKcmPDiEE18verify_valid_inputIvQeqT_LS0_4EEENSA_17validation_resultENSt3__14spanIS5_Lm18446744073709551615EEE Line | Count | Source | 283 | 45 | validation_result verify_valid_input(FromSpan) const { | 284 | | // all latin1 input is valid. there is no simdutf validation function for | 285 | | // it. | 286 | 45 | return validation_result{.valid = true, .implementations_agree = true}; | 287 | 45 | } |
_ZNK10ConversionIL12UtfEncodings4ELS0_0EMN7simdutf14implementationEKDoFmmEMS2_KDoFmPKcmPDsEE18verify_valid_inputIvQeqT_LS0_4EEENSA_17validation_resultENSt3__14spanIS5_Lm18446744073709551615EEE Line | Count | Source | 283 | 40 | validation_result verify_valid_input(FromSpan) const { | 284 | | // all latin1 input is valid. there is no simdutf validation function for | 285 | | // it. | 286 | 40 | return validation_result{.valid = true, .implementations_agree = true}; | 287 | 40 | } |
_ZNK10ConversionIL12UtfEncodings4ELS0_1EMN7simdutf14implementationEKDoFmmEMS2_KDoFmPKcmPDsEE18verify_valid_inputIvQeqT_LS0_4EEENSA_17validation_resultENSt3__14spanIS5_Lm18446744073709551615EEE Line | Count | Source | 283 | 40 | validation_result verify_valid_input(FromSpan) const { | 284 | | // all latin1 input is valid. there is no simdutf validation function for | 285 | | // it. | 286 | 40 | return validation_result{.valid = true, .implementations_agree = true}; | 287 | 40 | } |
_ZNK10ConversionIL12UtfEncodings4ELS0_2EMN7simdutf14implementationEKDoFmPKcmEMS2_KDoFmS4_mPcEE18verify_valid_inputIvQeqT_LS0_4EEENSA_17validation_resultENSt3__14spanIS3_Lm18446744073709551615EEE Line | Count | Source | 283 | 269 | validation_result verify_valid_input(FromSpan) const { | 284 | | // all latin1 input is valid. there is no simdutf validation function for | 285 | | // it. | 286 | 269 | return validation_result{.valid = true, .implementations_agree = true}; | 287 | 269 | } |
|
288 | | |
289 | 5.76k | bool count_the_input(FromSpan src) const { |
290 | 5.76k | const auto implementations = get_supported_implementations(); |
291 | 5.76k | std::vector<std::size_t> results; |
292 | 5.76k | results.reserve(implementations.size()); |
293 | | |
294 | 17.2k | for (auto impl : implementations) { |
295 | 17.2k | std::size_t ret; |
296 | 17.2k | if constexpr (From == UtfEncodings::UTF16BE) { |
297 | 3.70k | ret = impl->count_utf16be(src.data(), src.size()); |
298 | 3.92k | } else if constexpr (From == UtfEncodings::UTF16LE) { |
299 | 3.92k | ret = impl->count_utf16le(src.data(), src.size()); |
300 | 9.66k | } else if constexpr (From == UtfEncodings::UTF8) { |
301 | 9.66k | ret = impl->count_utf8(src.data(), src.size()); |
302 | 9.66k | } |
303 | 17.2k | results.push_back(ret); |
304 | 17.2k | } |
305 | 11.5k | auto neq = [](const auto& a, const auto& b) { return a != b; };auto Conversion<(UtfEncodings)0, (UtfEncodings)3, unsigned long (simdutf::implementation::*)(char16_t const*, unsigned long) noexcept const, unsigned long (simdutf::implementation::*)(char16_t const*, unsigned long, char32_t*) noexcept const>::count_the_input(std::__1::span<char16_t const, 18446744073709551615ul>) const::{lambda(auto:1 const&, auto:2 const&)#1}::operator()<unsigned long, unsigned long>(unsigned long const&, unsigned long const&) constLine | Count | Source | 305 | 402 | auto neq = [](const auto& a, const auto& b) { return a != b; }; |
auto Conversion<(UtfEncodings)0, (UtfEncodings)2, unsigned long (simdutf::implementation::*)(char16_t const*, unsigned long) noexcept const, unsigned long (simdutf::implementation::*)(char16_t const*, unsigned long, char*) noexcept const>::count_the_input(std::__1::span<char16_t const, 18446744073709551615ul>) const::{lambda(auto:1 const&, auto:2 const&)#1}::operator()<unsigned long, unsigned long>(unsigned long const&, unsigned long const&) constLine | Count | Source | 305 | 806 | auto neq = [](const auto& a, const auto& b) { return a != b; }; |
auto Conversion<(UtfEncodings)1, (UtfEncodings)3, unsigned long (simdutf::implementation::*)(char16_t const*, unsigned long) noexcept const, unsigned long (simdutf::implementation::*)(char16_t const*, unsigned long, char32_t*) noexcept const>::count_the_input(std::__1::span<char16_t const, 18446744073709551615ul>) const::{lambda(auto:1 const&, auto:2 const&)#1}::operator()<unsigned long, unsigned long>(unsigned long const&, unsigned long const&) constLine | Count | Source | 305 | 394 | auto neq = [](const auto& a, const auto& b) { return a != b; }; |
auto Conversion<(UtfEncodings)1, (UtfEncodings)2, unsigned long (simdutf::implementation::*)(char16_t const*, unsigned long) noexcept const, unsigned long (simdutf::implementation::*)(char16_t const*, unsigned long, char*) noexcept const>::count_the_input(std::__1::span<char16_t const, 18446744073709551615ul>) const::{lambda(auto:1 const&, auto:2 const&)#1}::operator()<unsigned long, unsigned long>(unsigned long const&, unsigned long const&) constLine | Count | Source | 305 | 824 | auto neq = [](const auto& a, const auto& b) { return a != b; }; |
auto Conversion<(UtfEncodings)2, (UtfEncodings)0, unsigned long (simdutf::implementation::*)(char const*, unsigned long) noexcept const, unsigned long (simdutf::implementation::*)(char const*, unsigned long, char16_t*) noexcept const>::count_the_input(std::__1::span<char const, 18446744073709551615ul>) const::{lambda(auto:1 const&, auto:2 const&)#1}::operator()<unsigned long, unsigned long>(unsigned long const&, unsigned long const&) constLine | Count | Source | 305 | 1.16k | auto neq = [](const auto& a, const auto& b) { return a != b; }; |
auto Conversion<(UtfEncodings)2, (UtfEncodings)1, unsigned long (simdutf::implementation::*)(char const*, unsigned long) noexcept const, unsigned long (simdutf::implementation::*)(char const*, unsigned long, char16_t*) noexcept const>::count_the_input(std::__1::span<char const, 18446744073709551615ul>) const::{lambda(auto:1 const&, auto:2 const&)#1}::operator()<unsigned long, unsigned long>(unsigned long const&, unsigned long const&) constLine | Count | Source | 305 | 1.05k | auto neq = [](const auto& a, const auto& b) { return a != b; }; |
auto Conversion<(UtfEncodings)2, (UtfEncodings)3, unsigned long (simdutf::implementation::*)(char const*, unsigned long) noexcept const, unsigned long (simdutf::implementation::*)(char const*, unsigned long, char32_t*) noexcept const>::count_the_input(std::__1::span<char const, 18446744073709551615ul>) const::{lambda(auto:1 const&, auto:2 const&)#1}::operator()<unsigned long, unsigned long>(unsigned long const&, unsigned long const&) constLine | Count | Source | 305 | 1.12k | auto neq = [](const auto& a, const auto& b) { return a != b; }; |
auto Conversion<(UtfEncodings)0, (UtfEncodings)4, unsigned long (simdutf::implementation::*)(unsigned long) noexcept const, unsigned long (simdutf::implementation::*)(char16_t const*, unsigned long, char*) noexcept const>::count_the_input(std::__1::span<char16_t const, 18446744073709551615ul>) const::{lambda(auto:1 const&, auto:2 const&)#1}::operator()<unsigned long, unsigned long>(unsigned long const&, unsigned long const&) constLine | Count | Source | 305 | 126 | auto neq = [](const auto& a, const auto& b) { return a != b; }; |
auto Conversion<(UtfEncodings)1, (UtfEncodings)4, unsigned long (simdutf::implementation::*)(unsigned long) noexcept const, unsigned long (simdutf::implementation::*)(char16_t const*, unsigned long, char*) noexcept const>::count_the_input(std::__1::span<char16_t const, 18446744073709551615ul>) const::{lambda(auto:1 const&, auto:2 const&)#1}::operator()<unsigned long, unsigned long>(unsigned long const&, unsigned long const&) constLine | Count | Source | 305 | 124 | auto neq = [](const auto& a, const auto& b) { return a != b; }; |
auto Conversion<(UtfEncodings)2, (UtfEncodings)4, unsigned long (simdutf::implementation::*)(char const*, unsigned long) noexcept const, unsigned long (simdutf::implementation::*)(char const*, unsigned long, char*) noexcept const>::count_the_input(std::__1::span<char const, 18446744073709551615ul>) const::{lambda(auto:1 const&, auto:2 const&)#1}::operator()<unsigned long, unsigned long>(unsigned long const&, unsigned long const&) constLine | Count | Source | 305 | 562 | auto neq = [](const auto& a, const auto& b) { return a != b; }; |
auto Conversion<(UtfEncodings)0, (UtfEncodings)4, unsigned long (simdutf::implementation::*)(unsigned long) noexcept const, simdutf::result (simdutf::implementation::*)(char16_t const*, unsigned long, char*) noexcept const>::count_the_input(std::__1::span<char16_t const, 18446744073709551615ul>) const::{lambda(auto:1 const&, auto:2 const&)#1}::operator()<unsigned long, unsigned long>(unsigned long const&, unsigned long const&) constLine | Count | Source | 305 | 252 | auto neq = [](const auto& a, const auto& b) { return a != b; }; |
auto Conversion<(UtfEncodings)0, (UtfEncodings)3, unsigned long (simdutf::implementation::*)(char16_t const*, unsigned long) noexcept const, simdutf::result (simdutf::implementation::*)(char16_t const*, unsigned long, char32_t*) noexcept const>::count_the_input(std::__1::span<char16_t const, 18446744073709551615ul>) const::{lambda(auto:1 const&, auto:2 const&)#1}::operator()<unsigned long, unsigned long>(unsigned long const&, unsigned long const&) constLine | Count | Source | 305 | 300 | auto neq = [](const auto& a, const auto& b) { return a != b; }; |
auto Conversion<(UtfEncodings)0, (UtfEncodings)2, unsigned long (simdutf::implementation::*)(char16_t const*, unsigned long) noexcept const, simdutf::result (simdutf::implementation::*)(char16_t const*, unsigned long, char*) noexcept const>::count_the_input(std::__1::span<char16_t const, 18446744073709551615ul>) const::{lambda(auto:1 const&, auto:2 const&)#1}::operator()<unsigned long, unsigned long>(unsigned long const&, unsigned long const&) constLine | Count | Source | 305 | 586 | auto neq = [](const auto& a, const auto& b) { return a != b; }; |
auto Conversion<(UtfEncodings)1, (UtfEncodings)4, unsigned long (simdutf::implementation::*)(unsigned long) noexcept const, simdutf::result (simdutf::implementation::*)(char16_t const*, unsigned long, char*) noexcept const>::count_the_input(std::__1::span<char16_t const, 18446744073709551615ul>) const::{lambda(auto:1 const&, auto:2 const&)#1}::operator()<unsigned long, unsigned long>(unsigned long const&, unsigned long const&) constLine | Count | Source | 305 | 230 | auto neq = [](const auto& a, const auto& b) { return a != b; }; |
auto Conversion<(UtfEncodings)1, (UtfEncodings)3, unsigned long (simdutf::implementation::*)(char16_t const*, unsigned long) noexcept const, simdutf::result (simdutf::implementation::*)(char16_t const*, unsigned long, char32_t*) noexcept const>::count_the_input(std::__1::span<char16_t const, 18446744073709551615ul>) const::{lambda(auto:1 const&, auto:2 const&)#1}::operator()<unsigned long, unsigned long>(unsigned long const&, unsigned long const&) constLine | Count | Source | 305 | 414 | auto neq = [](const auto& a, const auto& b) { return a != b; }; |
auto Conversion<(UtfEncodings)1, (UtfEncodings)2, unsigned long (simdutf::implementation::*)(char16_t const*, unsigned long) noexcept const, simdutf::result (simdutf::implementation::*)(char16_t const*, unsigned long, char*) noexcept const>::count_the_input(std::__1::span<char16_t const, 18446744073709551615ul>) const::{lambda(auto:1 const&, auto:2 const&)#1}::operator()<unsigned long, unsigned long>(unsigned long const&, unsigned long const&) constLine | Count | Source | 305 | 630 | auto neq = [](const auto& a, const auto& b) { return a != b; }; |
auto Conversion<(UtfEncodings)2, (UtfEncodings)4, unsigned long (simdutf::implementation::*)(char const*, unsigned long) noexcept const, simdutf::result (simdutf::implementation::*)(char const*, unsigned long, char*) noexcept const>::count_the_input(std::__1::span<char const, 18446744073709551615ul>) const::{lambda(auto:1 const&, auto:2 const&)#1}::operator()<unsigned long, unsigned long>(unsigned long const&, unsigned long const&) constLine | Count | Source | 305 | 516 | auto neq = [](const auto& a, const auto& b) { return a != b; }; |
auto Conversion<(UtfEncodings)2, (UtfEncodings)0, unsigned long (simdutf::implementation::*)(char const*, unsigned long) noexcept const, simdutf::result (simdutf::implementation::*)(char const*, unsigned long, char16_t*) noexcept const>::count_the_input(std::__1::span<char const, 18446744073709551615ul>) const::{lambda(auto:1 const&, auto:2 const&)#1}::operator()<unsigned long, unsigned long>(unsigned long const&, unsigned long const&) constLine | Count | Source | 305 | 702 | auto neq = [](const auto& a, const auto& b) { return a != b; }; |
auto Conversion<(UtfEncodings)2, (UtfEncodings)1, unsigned long (simdutf::implementation::*)(char const*, unsigned long) noexcept const, simdutf::result (simdutf::implementation::*)(char const*, unsigned long, char16_t*) noexcept const>::count_the_input(std::__1::span<char const, 18446744073709551615ul>) const::{lambda(auto:1 const&, auto:2 const&)#1}::operator()<unsigned long, unsigned long>(unsigned long const&, unsigned long const&) constLine | Count | Source | 305 | 574 | auto neq = [](const auto& a, const auto& b) { return a != b; }; |
auto Conversion<(UtfEncodings)2, (UtfEncodings)3, unsigned long (simdutf::implementation::*)(char const*, unsigned long) noexcept const, simdutf::result (simdutf::implementation::*)(char const*, unsigned long, char32_t*) noexcept const>::count_the_input(std::__1::span<char const, 18446744073709551615ul>) const::{lambda(auto:1 const&, auto:2 const&)#1}::operator()<unsigned long, unsigned long>(unsigned long const&, unsigned long const&) constLine | Count | Source | 305 | 738 | auto neq = [](const auto& a, const auto& b) { return a != b; }; |
|
306 | 5.76k | if (std::ranges::adjacent_find(results, neq) != results.end()) { |
307 | 0 | std::cerr << "begin errormessage for count_the_input()\n"; |
308 | 0 | std::cerr << "in fuzz case for " |
309 | 0 | << ValidationFunctionTrait<From>::ValidationWithErrorsName |
310 | 0 | << " invoked with " << src.size() << " elements:\n"; |
311 | 0 | for (std::size_t i = 0; i < results.size(); ++i) { |
312 | 0 | std::cerr << "got return " << std::dec << results[i] |
313 | 0 | << " from implementation " << implementations[i]->name() |
314 | 0 | << '\n'; |
315 | 0 | } |
316 | 0 | std::cerr << "end errormessage\n"; |
317 | 0 | return false; |
318 | 0 | } |
319 | | |
320 | 5.76k | return true; |
321 | 5.76k | } Conversion<(UtfEncodings)0, (UtfEncodings)3, unsigned long (simdutf::implementation::*)(char16_t const*, unsigned long) noexcept const, unsigned long (simdutf::implementation::*)(char16_t const*, unsigned long, char32_t*) noexcept const>::count_the_input(std::__1::span<char16_t const, 18446744073709551615ul>) const Line | Count | Source | 289 | 201 | bool count_the_input(FromSpan src) const { | 290 | 201 | const auto implementations = get_supported_implementations(); | 291 | 201 | std::vector<std::size_t> results; | 292 | 201 | results.reserve(implementations.size()); | 293 | | | 294 | 603 | for (auto impl : implementations) { | 295 | 603 | std::size_t ret; | 296 | 603 | if constexpr (From == UtfEncodings::UTF16BE) { | 297 | 603 | ret = impl->count_utf16be(src.data(), src.size()); | 298 | | } else if constexpr (From == UtfEncodings::UTF16LE) { | 299 | | ret = impl->count_utf16le(src.data(), src.size()); | 300 | | } else if constexpr (From == UtfEncodings::UTF8) { | 301 | | ret = impl->count_utf8(src.data(), src.size()); | 302 | | } | 303 | 603 | results.push_back(ret); | 304 | 603 | } | 305 | 201 | auto neq = [](const auto& a, const auto& b) { return a != b; }; | 306 | 201 | if (std::ranges::adjacent_find(results, neq) != results.end()) { | 307 | 0 | std::cerr << "begin errormessage for count_the_input()\n"; | 308 | 0 | std::cerr << "in fuzz case for " | 309 | 0 | << ValidationFunctionTrait<From>::ValidationWithErrorsName | 310 | 0 | << " invoked with " << src.size() << " elements:\n"; | 311 | 0 | for (std::size_t i = 0; i < results.size(); ++i) { | 312 | 0 | std::cerr << "got return " << std::dec << results[i] | 313 | 0 | << " from implementation " << implementations[i]->name() | 314 | 0 | << '\n'; | 315 | 0 | } | 316 | 0 | std::cerr << "end errormessage\n"; | 317 | 0 | return false; | 318 | 0 | } | 319 | | | 320 | 201 | return true; | 321 | 201 | } |
Conversion<(UtfEncodings)0, (UtfEncodings)2, unsigned long (simdutf::implementation::*)(char16_t const*, unsigned long) noexcept const, unsigned long (simdutf::implementation::*)(char16_t const*, unsigned long, char*) noexcept const>::count_the_input(std::__1::span<char16_t const, 18446744073709551615ul>) const Line | Count | Source | 289 | 403 | bool count_the_input(FromSpan src) const { | 290 | 403 | const auto implementations = get_supported_implementations(); | 291 | 403 | std::vector<std::size_t> results; | 292 | 403 | results.reserve(implementations.size()); | 293 | | | 294 | 1.20k | for (auto impl : implementations) { | 295 | 1.20k | std::size_t ret; | 296 | 1.20k | if constexpr (From == UtfEncodings::UTF16BE) { | 297 | 1.20k | ret = impl->count_utf16be(src.data(), src.size()); | 298 | | } else if constexpr (From == UtfEncodings::UTF16LE) { | 299 | | ret = impl->count_utf16le(src.data(), src.size()); | 300 | | } else if constexpr (From == UtfEncodings::UTF8) { | 301 | | ret = impl->count_utf8(src.data(), src.size()); | 302 | | } | 303 | 1.20k | results.push_back(ret); | 304 | 1.20k | } | 305 | 403 | auto neq = [](const auto& a, const auto& b) { return a != b; }; | 306 | 403 | if (std::ranges::adjacent_find(results, neq) != results.end()) { | 307 | 0 | std::cerr << "begin errormessage for count_the_input()\n"; | 308 | 0 | std::cerr << "in fuzz case for " | 309 | 0 | << ValidationFunctionTrait<From>::ValidationWithErrorsName | 310 | 0 | << " invoked with " << src.size() << " elements:\n"; | 311 | 0 | for (std::size_t i = 0; i < results.size(); ++i) { | 312 | 0 | std::cerr << "got return " << std::dec << results[i] | 313 | 0 | << " from implementation " << implementations[i]->name() | 314 | 0 | << '\n'; | 315 | 0 | } | 316 | 0 | std::cerr << "end errormessage\n"; | 317 | 0 | return false; | 318 | 0 | } | 319 | | | 320 | 403 | return true; | 321 | 403 | } |
Conversion<(UtfEncodings)1, (UtfEncodings)3, unsigned long (simdutf::implementation::*)(char16_t const*, unsigned long) noexcept const, unsigned long (simdutf::implementation::*)(char16_t const*, unsigned long, char32_t*) noexcept const>::count_the_input(std::__1::span<char16_t const, 18446744073709551615ul>) const Line | Count | Source | 289 | 197 | bool count_the_input(FromSpan src) const { | 290 | 197 | const auto implementations = get_supported_implementations(); | 291 | 197 | std::vector<std::size_t> results; | 292 | 197 | results.reserve(implementations.size()); | 293 | | | 294 | 591 | for (auto impl : implementations) { | 295 | 591 | std::size_t ret; | 296 | | if constexpr (From == UtfEncodings::UTF16BE) { | 297 | | ret = impl->count_utf16be(src.data(), src.size()); | 298 | 591 | } else if constexpr (From == UtfEncodings::UTF16LE) { | 299 | 591 | ret = impl->count_utf16le(src.data(), src.size()); | 300 | | } else if constexpr (From == UtfEncodings::UTF8) { | 301 | | ret = impl->count_utf8(src.data(), src.size()); | 302 | | } | 303 | 591 | results.push_back(ret); | 304 | 591 | } | 305 | 197 | auto neq = [](const auto& a, const auto& b) { return a != b; }; | 306 | 197 | if (std::ranges::adjacent_find(results, neq) != results.end()) { | 307 | 0 | std::cerr << "begin errormessage for count_the_input()\n"; | 308 | 0 | std::cerr << "in fuzz case for " | 309 | 0 | << ValidationFunctionTrait<From>::ValidationWithErrorsName | 310 | 0 | << " invoked with " << src.size() << " elements:\n"; | 311 | 0 | for (std::size_t i = 0; i < results.size(); ++i) { | 312 | 0 | std::cerr << "got return " << std::dec << results[i] | 313 | 0 | << " from implementation " << implementations[i]->name() | 314 | 0 | << '\n'; | 315 | 0 | } | 316 | 0 | std::cerr << "end errormessage\n"; | 317 | 0 | return false; | 318 | 0 | } | 319 | | | 320 | 197 | return true; | 321 | 197 | } |
Conversion<(UtfEncodings)1, (UtfEncodings)2, unsigned long (simdutf::implementation::*)(char16_t const*, unsigned long) noexcept const, unsigned long (simdutf::implementation::*)(char16_t const*, unsigned long, char*) noexcept const>::count_the_input(std::__1::span<char16_t const, 18446744073709551615ul>) const Line | Count | Source | 289 | 412 | bool count_the_input(FromSpan src) const { | 290 | 412 | const auto implementations = get_supported_implementations(); | 291 | 412 | std::vector<std::size_t> results; | 292 | 412 | results.reserve(implementations.size()); | 293 | | | 294 | 1.23k | for (auto impl : implementations) { | 295 | 1.23k | std::size_t ret; | 296 | | if constexpr (From == UtfEncodings::UTF16BE) { | 297 | | ret = impl->count_utf16be(src.data(), src.size()); | 298 | 1.23k | } else if constexpr (From == UtfEncodings::UTF16LE) { | 299 | 1.23k | ret = impl->count_utf16le(src.data(), src.size()); | 300 | | } else if constexpr (From == UtfEncodings::UTF8) { | 301 | | ret = impl->count_utf8(src.data(), src.size()); | 302 | | } | 303 | 1.23k | results.push_back(ret); | 304 | 1.23k | } | 305 | 412 | auto neq = [](const auto& a, const auto& b) { return a != b; }; | 306 | 412 | if (std::ranges::adjacent_find(results, neq) != results.end()) { | 307 | 0 | std::cerr << "begin errormessage for count_the_input()\n"; | 308 | 0 | std::cerr << "in fuzz case for " | 309 | 0 | << ValidationFunctionTrait<From>::ValidationWithErrorsName | 310 | 0 | << " invoked with " << src.size() << " elements:\n"; | 311 | 0 | for (std::size_t i = 0; i < results.size(); ++i) { | 312 | 0 | std::cerr << "got return " << std::dec << results[i] | 313 | 0 | << " from implementation " << implementations[i]->name() | 314 | 0 | << '\n'; | 315 | 0 | } | 316 | 0 | std::cerr << "end errormessage\n"; | 317 | 0 | return false; | 318 | 0 | } | 319 | | | 320 | 412 | return true; | 321 | 412 | } |
Conversion<(UtfEncodings)2, (UtfEncodings)0, unsigned long (simdutf::implementation::*)(char const*, unsigned long) noexcept const, unsigned long (simdutf::implementation::*)(char const*, unsigned long, char16_t*) noexcept const>::count_the_input(std::__1::span<char const, 18446744073709551615ul>) const Line | Count | Source | 289 | 584 | bool count_the_input(FromSpan src) const { | 290 | 584 | const auto implementations = get_supported_implementations(); | 291 | 584 | std::vector<std::size_t> results; | 292 | 584 | results.reserve(implementations.size()); | 293 | | | 294 | 1.75k | for (auto impl : implementations) { | 295 | 1.75k | std::size_t ret; | 296 | | if constexpr (From == UtfEncodings::UTF16BE) { | 297 | | ret = impl->count_utf16be(src.data(), src.size()); | 298 | | } else if constexpr (From == UtfEncodings::UTF16LE) { | 299 | | ret = impl->count_utf16le(src.data(), src.size()); | 300 | 1.75k | } else if constexpr (From == UtfEncodings::UTF8) { | 301 | 1.75k | ret = impl->count_utf8(src.data(), src.size()); | 302 | 1.75k | } | 303 | 1.75k | results.push_back(ret); | 304 | 1.75k | } | 305 | 584 | auto neq = [](const auto& a, const auto& b) { return a != b; }; | 306 | 584 | if (std::ranges::adjacent_find(results, neq) != results.end()) { | 307 | 0 | std::cerr << "begin errormessage for count_the_input()\n"; | 308 | 0 | std::cerr << "in fuzz case for " | 309 | 0 | << ValidationFunctionTrait<From>::ValidationWithErrorsName | 310 | 0 | << " invoked with " << src.size() << " elements:\n"; | 311 | 0 | for (std::size_t i = 0; i < results.size(); ++i) { | 312 | 0 | std::cerr << "got return " << std::dec << results[i] | 313 | 0 | << " from implementation " << implementations[i]->name() | 314 | 0 | << '\n'; | 315 | 0 | } | 316 | 0 | std::cerr << "end errormessage\n"; | 317 | 0 | return false; | 318 | 0 | } | 319 | | | 320 | 584 | return true; | 321 | 584 | } |
Conversion<(UtfEncodings)2, (UtfEncodings)1, unsigned long (simdutf::implementation::*)(char const*, unsigned long) noexcept const, unsigned long (simdutf::implementation::*)(char const*, unsigned long, char16_t*) noexcept const>::count_the_input(std::__1::span<char const, 18446744073709551615ul>) const Line | Count | Source | 289 | 527 | bool count_the_input(FromSpan src) const { | 290 | 527 | const auto implementations = get_supported_implementations(); | 291 | 527 | std::vector<std::size_t> results; | 292 | 527 | results.reserve(implementations.size()); | 293 | | | 294 | 1.58k | for (auto impl : implementations) { | 295 | 1.58k | std::size_t ret; | 296 | | if constexpr (From == UtfEncodings::UTF16BE) { | 297 | | ret = impl->count_utf16be(src.data(), src.size()); | 298 | | } else if constexpr (From == UtfEncodings::UTF16LE) { | 299 | | ret = impl->count_utf16le(src.data(), src.size()); | 300 | 1.58k | } else if constexpr (From == UtfEncodings::UTF8) { | 301 | 1.58k | ret = impl->count_utf8(src.data(), src.size()); | 302 | 1.58k | } | 303 | 1.58k | results.push_back(ret); | 304 | 1.58k | } | 305 | 527 | auto neq = [](const auto& a, const auto& b) { return a != b; }; | 306 | 527 | if (std::ranges::adjacent_find(results, neq) != results.end()) { | 307 | 0 | std::cerr << "begin errormessage for count_the_input()\n"; | 308 | 0 | std::cerr << "in fuzz case for " | 309 | 0 | << ValidationFunctionTrait<From>::ValidationWithErrorsName | 310 | 0 | << " invoked with " << src.size() << " elements:\n"; | 311 | 0 | for (std::size_t i = 0; i < results.size(); ++i) { | 312 | 0 | std::cerr << "got return " << std::dec << results[i] | 313 | 0 | << " from implementation " << implementations[i]->name() | 314 | 0 | << '\n'; | 315 | 0 | } | 316 | 0 | std::cerr << "end errormessage\n"; | 317 | 0 | return false; | 318 | 0 | } | 319 | | | 320 | 527 | return true; | 321 | 527 | } |
Conversion<(UtfEncodings)2, (UtfEncodings)3, unsigned long (simdutf::implementation::*)(char const*, unsigned long) noexcept const, unsigned long (simdutf::implementation::*)(char const*, unsigned long, char32_t*) noexcept const>::count_the_input(std::__1::span<char const, 18446744073709551615ul>) const Line | Count | Source | 289 | 564 | bool count_the_input(FromSpan src) const { | 290 | 564 | const auto implementations = get_supported_implementations(); | 291 | 564 | std::vector<std::size_t> results; | 292 | 564 | results.reserve(implementations.size()); | 293 | | | 294 | 1.69k | for (auto impl : implementations) { | 295 | 1.69k | std::size_t ret; | 296 | | if constexpr (From == UtfEncodings::UTF16BE) { | 297 | | ret = impl->count_utf16be(src.data(), src.size()); | 298 | | } else if constexpr (From == UtfEncodings::UTF16LE) { | 299 | | ret = impl->count_utf16le(src.data(), src.size()); | 300 | 1.69k | } else if constexpr (From == UtfEncodings::UTF8) { | 301 | 1.69k | ret = impl->count_utf8(src.data(), src.size()); | 302 | 1.69k | } | 303 | 1.69k | results.push_back(ret); | 304 | 1.69k | } | 305 | 564 | auto neq = [](const auto& a, const auto& b) { return a != b; }; | 306 | 564 | if (std::ranges::adjacent_find(results, neq) != results.end()) { | 307 | 0 | std::cerr << "begin errormessage for count_the_input()\n"; | 308 | 0 | std::cerr << "in fuzz case for " | 309 | 0 | << ValidationFunctionTrait<From>::ValidationWithErrorsName | 310 | 0 | << " invoked with " << src.size() << " elements:\n"; | 311 | 0 | for (std::size_t i = 0; i < results.size(); ++i) { | 312 | 0 | std::cerr << "got return " << std::dec << results[i] | 313 | 0 | << " from implementation " << implementations[i]->name() | 314 | 0 | << '\n'; | 315 | 0 | } | 316 | 0 | std::cerr << "end errormessage\n"; | 317 | 0 | return false; | 318 | 0 | } | 319 | | | 320 | 564 | return true; | 321 | 564 | } |
Conversion<(UtfEncodings)0, (UtfEncodings)4, unsigned long (simdutf::implementation::*)(unsigned long) noexcept const, unsigned long (simdutf::implementation::*)(char16_t const*, unsigned long, char*) noexcept const>::count_the_input(std::__1::span<char16_t const, 18446744073709551615ul>) const Line | Count | Source | 289 | 63 | bool count_the_input(FromSpan src) const { | 290 | 63 | const auto implementations = get_supported_implementations(); | 291 | 63 | std::vector<std::size_t> results; | 292 | 63 | results.reserve(implementations.size()); | 293 | | | 294 | 189 | for (auto impl : implementations) { | 295 | 189 | std::size_t ret; | 296 | 189 | if constexpr (From == UtfEncodings::UTF16BE) { | 297 | 189 | ret = impl->count_utf16be(src.data(), src.size()); | 298 | | } else if constexpr (From == UtfEncodings::UTF16LE) { | 299 | | ret = impl->count_utf16le(src.data(), src.size()); | 300 | | } else if constexpr (From == UtfEncodings::UTF8) { | 301 | | ret = impl->count_utf8(src.data(), src.size()); | 302 | | } | 303 | 189 | results.push_back(ret); | 304 | 189 | } | 305 | 63 | auto neq = [](const auto& a, const auto& b) { return a != b; }; | 306 | 63 | if (std::ranges::adjacent_find(results, neq) != results.end()) { | 307 | 0 | std::cerr << "begin errormessage for count_the_input()\n"; | 308 | 0 | std::cerr << "in fuzz case for " | 309 | 0 | << ValidationFunctionTrait<From>::ValidationWithErrorsName | 310 | 0 | << " invoked with " << src.size() << " elements:\n"; | 311 | 0 | for (std::size_t i = 0; i < results.size(); ++i) { | 312 | 0 | std::cerr << "got return " << std::dec << results[i] | 313 | 0 | << " from implementation " << implementations[i]->name() | 314 | 0 | << '\n'; | 315 | 0 | } | 316 | 0 | std::cerr << "end errormessage\n"; | 317 | 0 | return false; | 318 | 0 | } | 319 | | | 320 | 63 | return true; | 321 | 63 | } |
Conversion<(UtfEncodings)1, (UtfEncodings)4, unsigned long (simdutf::implementation::*)(unsigned long) noexcept const, unsigned long (simdutf::implementation::*)(char16_t const*, unsigned long, char*) noexcept const>::count_the_input(std::__1::span<char16_t const, 18446744073709551615ul>) const Line | Count | Source | 289 | 62 | bool count_the_input(FromSpan src) const { | 290 | 62 | const auto implementations = get_supported_implementations(); | 291 | 62 | std::vector<std::size_t> results; | 292 | 62 | results.reserve(implementations.size()); | 293 | | | 294 | 186 | for (auto impl : implementations) { | 295 | 186 | std::size_t ret; | 296 | | if constexpr (From == UtfEncodings::UTF16BE) { | 297 | | ret = impl->count_utf16be(src.data(), src.size()); | 298 | 186 | } else if constexpr (From == UtfEncodings::UTF16LE) { | 299 | 186 | ret = impl->count_utf16le(src.data(), src.size()); | 300 | | } else if constexpr (From == UtfEncodings::UTF8) { | 301 | | ret = impl->count_utf8(src.data(), src.size()); | 302 | | } | 303 | 186 | results.push_back(ret); | 304 | 186 | } | 305 | 62 | auto neq = [](const auto& a, const auto& b) { return a != b; }; | 306 | 62 | if (std::ranges::adjacent_find(results, neq) != results.end()) { | 307 | 0 | std::cerr << "begin errormessage for count_the_input()\n"; | 308 | 0 | std::cerr << "in fuzz case for " | 309 | 0 | << ValidationFunctionTrait<From>::ValidationWithErrorsName | 310 | 0 | << " invoked with " << src.size() << " elements:\n"; | 311 | 0 | for (std::size_t i = 0; i < results.size(); ++i) { | 312 | 0 | std::cerr << "got return " << std::dec << results[i] | 313 | 0 | << " from implementation " << implementations[i]->name() | 314 | 0 | << '\n'; | 315 | 0 | } | 316 | 0 | std::cerr << "end errormessage\n"; | 317 | 0 | return false; | 318 | 0 | } | 319 | | | 320 | 62 | return true; | 321 | 62 | } |
Conversion<(UtfEncodings)2, (UtfEncodings)4, unsigned long (simdutf::implementation::*)(char const*, unsigned long) noexcept const, unsigned long (simdutf::implementation::*)(char const*, unsigned long, char*) noexcept const>::count_the_input(std::__1::span<char const, 18446744073709551615ul>) const Line | Count | Source | 289 | 281 | bool count_the_input(FromSpan src) const { | 290 | 281 | const auto implementations = get_supported_implementations(); | 291 | 281 | std::vector<std::size_t> results; | 292 | 281 | results.reserve(implementations.size()); | 293 | | | 294 | 843 | for (auto impl : implementations) { | 295 | 843 | std::size_t ret; | 296 | | if constexpr (From == UtfEncodings::UTF16BE) { | 297 | | ret = impl->count_utf16be(src.data(), src.size()); | 298 | | } else if constexpr (From == UtfEncodings::UTF16LE) { | 299 | | ret = impl->count_utf16le(src.data(), src.size()); | 300 | 843 | } else if constexpr (From == UtfEncodings::UTF8) { | 301 | 843 | ret = impl->count_utf8(src.data(), src.size()); | 302 | 843 | } | 303 | 843 | results.push_back(ret); | 304 | 843 | } | 305 | 281 | auto neq = [](const auto& a, const auto& b) { return a != b; }; | 306 | 281 | if (std::ranges::adjacent_find(results, neq) != results.end()) { | 307 | 0 | std::cerr << "begin errormessage for count_the_input()\n"; | 308 | 0 | std::cerr << "in fuzz case for " | 309 | 0 | << ValidationFunctionTrait<From>::ValidationWithErrorsName | 310 | 0 | << " invoked with " << src.size() << " elements:\n"; | 311 | 0 | for (std::size_t i = 0; i < results.size(); ++i) { | 312 | 0 | std::cerr << "got return " << std::dec << results[i] | 313 | 0 | << " from implementation " << implementations[i]->name() | 314 | 0 | << '\n'; | 315 | 0 | } | 316 | 0 | std::cerr << "end errormessage\n"; | 317 | 0 | return false; | 318 | 0 | } | 319 | | | 320 | 281 | return true; | 321 | 281 | } |
Conversion<(UtfEncodings)0, (UtfEncodings)4, unsigned long (simdutf::implementation::*)(unsigned long) noexcept const, simdutf::result (simdutf::implementation::*)(char16_t const*, unsigned long, char*) noexcept const>::count_the_input(std::__1::span<char16_t const, 18446744073709551615ul>) const Line | Count | Source | 289 | 126 | bool count_the_input(FromSpan src) const { | 290 | 126 | const auto implementations = get_supported_implementations(); | 291 | 126 | std::vector<std::size_t> results; | 292 | 126 | results.reserve(implementations.size()); | 293 | | | 294 | 378 | for (auto impl : implementations) { | 295 | 378 | std::size_t ret; | 296 | 378 | if constexpr (From == UtfEncodings::UTF16BE) { | 297 | 378 | ret = impl->count_utf16be(src.data(), src.size()); | 298 | | } else if constexpr (From == UtfEncodings::UTF16LE) { | 299 | | ret = impl->count_utf16le(src.data(), src.size()); | 300 | | } else if constexpr (From == UtfEncodings::UTF8) { | 301 | | ret = impl->count_utf8(src.data(), src.size()); | 302 | | } | 303 | 378 | results.push_back(ret); | 304 | 378 | } | 305 | 126 | auto neq = [](const auto& a, const auto& b) { return a != b; }; | 306 | 126 | if (std::ranges::adjacent_find(results, neq) != results.end()) { | 307 | 0 | std::cerr << "begin errormessage for count_the_input()\n"; | 308 | 0 | std::cerr << "in fuzz case for " | 309 | 0 | << ValidationFunctionTrait<From>::ValidationWithErrorsName | 310 | 0 | << " invoked with " << src.size() << " elements:\n"; | 311 | 0 | for (std::size_t i = 0; i < results.size(); ++i) { | 312 | 0 | std::cerr << "got return " << std::dec << results[i] | 313 | 0 | << " from implementation " << implementations[i]->name() | 314 | 0 | << '\n'; | 315 | 0 | } | 316 | 0 | std::cerr << "end errormessage\n"; | 317 | 0 | return false; | 318 | 0 | } | 319 | | | 320 | 126 | return true; | 321 | 126 | } |
Conversion<(UtfEncodings)0, (UtfEncodings)3, unsigned long (simdutf::implementation::*)(char16_t const*, unsigned long) noexcept const, simdutf::result (simdutf::implementation::*)(char16_t const*, unsigned long, char32_t*) noexcept const>::count_the_input(std::__1::span<char16_t const, 18446744073709551615ul>) const Line | Count | Source | 289 | 150 | bool count_the_input(FromSpan src) const { | 290 | 150 | const auto implementations = get_supported_implementations(); | 291 | 150 | std::vector<std::size_t> results; | 292 | 150 | results.reserve(implementations.size()); | 293 | | | 294 | 450 | for (auto impl : implementations) { | 295 | 450 | std::size_t ret; | 296 | 450 | if constexpr (From == UtfEncodings::UTF16BE) { | 297 | 450 | ret = impl->count_utf16be(src.data(), src.size()); | 298 | | } else if constexpr (From == UtfEncodings::UTF16LE) { | 299 | | ret = impl->count_utf16le(src.data(), src.size()); | 300 | | } else if constexpr (From == UtfEncodings::UTF8) { | 301 | | ret = impl->count_utf8(src.data(), src.size()); | 302 | | } | 303 | 450 | results.push_back(ret); | 304 | 450 | } | 305 | 150 | auto neq = [](const auto& a, const auto& b) { return a != b; }; | 306 | 150 | if (std::ranges::adjacent_find(results, neq) != results.end()) { | 307 | 0 | std::cerr << "begin errormessage for count_the_input()\n"; | 308 | 0 | std::cerr << "in fuzz case for " | 309 | 0 | << ValidationFunctionTrait<From>::ValidationWithErrorsName | 310 | 0 | << " invoked with " << src.size() << " elements:\n"; | 311 | 0 | for (std::size_t i = 0; i < results.size(); ++i) { | 312 | 0 | std::cerr << "got return " << std::dec << results[i] | 313 | 0 | << " from implementation " << implementations[i]->name() | 314 | 0 | << '\n'; | 315 | 0 | } | 316 | 0 | std::cerr << "end errormessage\n"; | 317 | 0 | return false; | 318 | 0 | } | 319 | | | 320 | 150 | return true; | 321 | 150 | } |
Conversion<(UtfEncodings)0, (UtfEncodings)2, unsigned long (simdutf::implementation::*)(char16_t const*, unsigned long) noexcept const, simdutf::result (simdutf::implementation::*)(char16_t const*, unsigned long, char*) noexcept const>::count_the_input(std::__1::span<char16_t const, 18446744073709551615ul>) const Line | Count | Source | 289 | 293 | bool count_the_input(FromSpan src) const { | 290 | 293 | const auto implementations = get_supported_implementations(); | 291 | 293 | std::vector<std::size_t> results; | 292 | 293 | results.reserve(implementations.size()); | 293 | | | 294 | 879 | for (auto impl : implementations) { | 295 | 879 | std::size_t ret; | 296 | 879 | if constexpr (From == UtfEncodings::UTF16BE) { | 297 | 879 | ret = impl->count_utf16be(src.data(), src.size()); | 298 | | } else if constexpr (From == UtfEncodings::UTF16LE) { | 299 | | ret = impl->count_utf16le(src.data(), src.size()); | 300 | | } else if constexpr (From == UtfEncodings::UTF8) { | 301 | | ret = impl->count_utf8(src.data(), src.size()); | 302 | | } | 303 | 879 | results.push_back(ret); | 304 | 879 | } | 305 | 293 | auto neq = [](const auto& a, const auto& b) { return a != b; }; | 306 | 293 | if (std::ranges::adjacent_find(results, neq) != results.end()) { | 307 | 0 | std::cerr << "begin errormessage for count_the_input()\n"; | 308 | 0 | std::cerr << "in fuzz case for " | 309 | 0 | << ValidationFunctionTrait<From>::ValidationWithErrorsName | 310 | 0 | << " invoked with " << src.size() << " elements:\n"; | 311 | 0 | for (std::size_t i = 0; i < results.size(); ++i) { | 312 | 0 | std::cerr << "got return " << std::dec << results[i] | 313 | 0 | << " from implementation " << implementations[i]->name() | 314 | 0 | << '\n'; | 315 | 0 | } | 316 | 0 | std::cerr << "end errormessage\n"; | 317 | 0 | return false; | 318 | 0 | } | 319 | | | 320 | 293 | return true; | 321 | 293 | } |
Conversion<(UtfEncodings)1, (UtfEncodings)4, unsigned long (simdutf::implementation::*)(unsigned long) noexcept const, simdutf::result (simdutf::implementation::*)(char16_t const*, unsigned long, char*) noexcept const>::count_the_input(std::__1::span<char16_t const, 18446744073709551615ul>) const Line | Count | Source | 289 | 115 | bool count_the_input(FromSpan src) const { | 290 | 115 | const auto implementations = get_supported_implementations(); | 291 | 115 | std::vector<std::size_t> results; | 292 | 115 | results.reserve(implementations.size()); | 293 | | | 294 | 345 | for (auto impl : implementations) { | 295 | 345 | std::size_t ret; | 296 | | if constexpr (From == UtfEncodings::UTF16BE) { | 297 | | ret = impl->count_utf16be(src.data(), src.size()); | 298 | 345 | } else if constexpr (From == UtfEncodings::UTF16LE) { | 299 | 345 | ret = impl->count_utf16le(src.data(), src.size()); | 300 | | } else if constexpr (From == UtfEncodings::UTF8) { | 301 | | ret = impl->count_utf8(src.data(), src.size()); | 302 | | } | 303 | 345 | results.push_back(ret); | 304 | 345 | } | 305 | 115 | auto neq = [](const auto& a, const auto& b) { return a != b; }; | 306 | 115 | if (std::ranges::adjacent_find(results, neq) != results.end()) { | 307 | 0 | std::cerr << "begin errormessage for count_the_input()\n"; | 308 | 0 | std::cerr << "in fuzz case for " | 309 | 0 | << ValidationFunctionTrait<From>::ValidationWithErrorsName | 310 | 0 | << " invoked with " << src.size() << " elements:\n"; | 311 | 0 | for (std::size_t i = 0; i < results.size(); ++i) { | 312 | 0 | std::cerr << "got return " << std::dec << results[i] | 313 | 0 | << " from implementation " << implementations[i]->name() | 314 | 0 | << '\n'; | 315 | 0 | } | 316 | 0 | std::cerr << "end errormessage\n"; | 317 | 0 | return false; | 318 | 0 | } | 319 | | | 320 | 115 | return true; | 321 | 115 | } |
Conversion<(UtfEncodings)1, (UtfEncodings)3, unsigned long (simdutf::implementation::*)(char16_t const*, unsigned long) noexcept const, simdutf::result (simdutf::implementation::*)(char16_t const*, unsigned long, char32_t*) noexcept const>::count_the_input(std::__1::span<char16_t const, 18446744073709551615ul>) const Line | Count | Source | 289 | 207 | bool count_the_input(FromSpan src) const { | 290 | 207 | const auto implementations = get_supported_implementations(); | 291 | 207 | std::vector<std::size_t> results; | 292 | 207 | results.reserve(implementations.size()); | 293 | | | 294 | 621 | for (auto impl : implementations) { | 295 | 621 | std::size_t ret; | 296 | | if constexpr (From == UtfEncodings::UTF16BE) { | 297 | | ret = impl->count_utf16be(src.data(), src.size()); | 298 | 621 | } else if constexpr (From == UtfEncodings::UTF16LE) { | 299 | 621 | ret = impl->count_utf16le(src.data(), src.size()); | 300 | | } else if constexpr (From == UtfEncodings::UTF8) { | 301 | | ret = impl->count_utf8(src.data(), src.size()); | 302 | | } | 303 | 621 | results.push_back(ret); | 304 | 621 | } | 305 | 207 | auto neq = [](const auto& a, const auto& b) { return a != b; }; | 306 | 207 | if (std::ranges::adjacent_find(results, neq) != results.end()) { | 307 | 0 | std::cerr << "begin errormessage for count_the_input()\n"; | 308 | 0 | std::cerr << "in fuzz case for " | 309 | 0 | << ValidationFunctionTrait<From>::ValidationWithErrorsName | 310 | 0 | << " invoked with " << src.size() << " elements:\n"; | 311 | 0 | for (std::size_t i = 0; i < results.size(); ++i) { | 312 | 0 | std::cerr << "got return " << std::dec << results[i] | 313 | 0 | << " from implementation " << implementations[i]->name() | 314 | 0 | << '\n'; | 315 | 0 | } | 316 | 0 | std::cerr << "end errormessage\n"; | 317 | 0 | return false; | 318 | 0 | } | 319 | | | 320 | 207 | return true; | 321 | 207 | } |
Conversion<(UtfEncodings)1, (UtfEncodings)2, unsigned long (simdutf::implementation::*)(char16_t const*, unsigned long) noexcept const, simdutf::result (simdutf::implementation::*)(char16_t const*, unsigned long, char*) noexcept const>::count_the_input(std::__1::span<char16_t const, 18446744073709551615ul>) const Line | Count | Source | 289 | 315 | bool count_the_input(FromSpan src) const { | 290 | 315 | const auto implementations = get_supported_implementations(); | 291 | 315 | std::vector<std::size_t> results; | 292 | 315 | results.reserve(implementations.size()); | 293 | | | 294 | 945 | for (auto impl : implementations) { | 295 | 945 | std::size_t ret; | 296 | | if constexpr (From == UtfEncodings::UTF16BE) { | 297 | | ret = impl->count_utf16be(src.data(), src.size()); | 298 | 945 | } else if constexpr (From == UtfEncodings::UTF16LE) { | 299 | 945 | ret = impl->count_utf16le(src.data(), src.size()); | 300 | | } else if constexpr (From == UtfEncodings::UTF8) { | 301 | | ret = impl->count_utf8(src.data(), src.size()); | 302 | | } | 303 | 945 | results.push_back(ret); | 304 | 945 | } | 305 | 315 | auto neq = [](const auto& a, const auto& b) { return a != b; }; | 306 | 315 | if (std::ranges::adjacent_find(results, neq) != results.end()) { | 307 | 0 | std::cerr << "begin errormessage for count_the_input()\n"; | 308 | 0 | std::cerr << "in fuzz case for " | 309 | 0 | << ValidationFunctionTrait<From>::ValidationWithErrorsName | 310 | 0 | << " invoked with " << src.size() << " elements:\n"; | 311 | 0 | for (std::size_t i = 0; i < results.size(); ++i) { | 312 | 0 | std::cerr << "got return " << std::dec << results[i] | 313 | 0 | << " from implementation " << implementations[i]->name() | 314 | 0 | << '\n'; | 315 | 0 | } | 316 | 0 | std::cerr << "end errormessage\n"; | 317 | 0 | return false; | 318 | 0 | } | 319 | | | 320 | 315 | return true; | 321 | 315 | } |
Conversion<(UtfEncodings)2, (UtfEncodings)4, unsigned long (simdutf::implementation::*)(char const*, unsigned long) noexcept const, simdutf::result (simdutf::implementation::*)(char const*, unsigned long, char*) noexcept const>::count_the_input(std::__1::span<char const, 18446744073709551615ul>) const Line | Count | Source | 289 | 258 | bool count_the_input(FromSpan src) const { | 290 | 258 | const auto implementations = get_supported_implementations(); | 291 | 258 | std::vector<std::size_t> results; | 292 | 258 | results.reserve(implementations.size()); | 293 | | | 294 | 774 | for (auto impl : implementations) { | 295 | 774 | std::size_t ret; | 296 | | if constexpr (From == UtfEncodings::UTF16BE) { | 297 | | ret = impl->count_utf16be(src.data(), src.size()); | 298 | | } else if constexpr (From == UtfEncodings::UTF16LE) { | 299 | | ret = impl->count_utf16le(src.data(), src.size()); | 300 | 774 | } else if constexpr (From == UtfEncodings::UTF8) { | 301 | 774 | ret = impl->count_utf8(src.data(), src.size()); | 302 | 774 | } | 303 | 774 | results.push_back(ret); | 304 | 774 | } | 305 | 258 | auto neq = [](const auto& a, const auto& b) { return a != b; }; | 306 | 258 | if (std::ranges::adjacent_find(results, neq) != results.end()) { | 307 | 0 | std::cerr << "begin errormessage for count_the_input()\n"; | 308 | 0 | std::cerr << "in fuzz case for " | 309 | 0 | << ValidationFunctionTrait<From>::ValidationWithErrorsName | 310 | 0 | << " invoked with " << src.size() << " elements:\n"; | 311 | 0 | for (std::size_t i = 0; i < results.size(); ++i) { | 312 | 0 | std::cerr << "got return " << std::dec << results[i] | 313 | 0 | << " from implementation " << implementations[i]->name() | 314 | 0 | << '\n'; | 315 | 0 | } | 316 | 0 | std::cerr << "end errormessage\n"; | 317 | 0 | return false; | 318 | 0 | } | 319 | | | 320 | 258 | return true; | 321 | 258 | } |
Conversion<(UtfEncodings)2, (UtfEncodings)0, unsigned long (simdutf::implementation::*)(char const*, unsigned long) noexcept const, simdutf::result (simdutf::implementation::*)(char const*, unsigned long, char16_t*) noexcept const>::count_the_input(std::__1::span<char const, 18446744073709551615ul>) const Line | Count | Source | 289 | 351 | bool count_the_input(FromSpan src) const { | 290 | 351 | const auto implementations = get_supported_implementations(); | 291 | 351 | std::vector<std::size_t> results; | 292 | 351 | results.reserve(implementations.size()); | 293 | | | 294 | 1.05k | for (auto impl : implementations) { | 295 | 1.05k | std::size_t ret; | 296 | | if constexpr (From == UtfEncodings::UTF16BE) { | 297 | | ret = impl->count_utf16be(src.data(), src.size()); | 298 | | } else if constexpr (From == UtfEncodings::UTF16LE) { | 299 | | ret = impl->count_utf16le(src.data(), src.size()); | 300 | 1.05k | } else if constexpr (From == UtfEncodings::UTF8) { | 301 | 1.05k | ret = impl->count_utf8(src.data(), src.size()); | 302 | 1.05k | } | 303 | 1.05k | results.push_back(ret); | 304 | 1.05k | } | 305 | 351 | auto neq = [](const auto& a, const auto& b) { return a != b; }; | 306 | 351 | if (std::ranges::adjacent_find(results, neq) != results.end()) { | 307 | 0 | std::cerr << "begin errormessage for count_the_input()\n"; | 308 | 0 | std::cerr << "in fuzz case for " | 309 | 0 | << ValidationFunctionTrait<From>::ValidationWithErrorsName | 310 | 0 | << " invoked with " << src.size() << " elements:\n"; | 311 | 0 | for (std::size_t i = 0; i < results.size(); ++i) { | 312 | 0 | std::cerr << "got return " << std::dec << results[i] | 313 | 0 | << " from implementation " << implementations[i]->name() | 314 | 0 | << '\n'; | 315 | 0 | } | 316 | 0 | std::cerr << "end errormessage\n"; | 317 | 0 | return false; | 318 | 0 | } | 319 | | | 320 | 351 | return true; | 321 | 351 | } |
Conversion<(UtfEncodings)2, (UtfEncodings)1, unsigned long (simdutf::implementation::*)(char const*, unsigned long) noexcept const, simdutf::result (simdutf::implementation::*)(char const*, unsigned long, char16_t*) noexcept const>::count_the_input(std::__1::span<char const, 18446744073709551615ul>) const Line | Count | Source | 289 | 287 | bool count_the_input(FromSpan src) const { | 290 | 287 | const auto implementations = get_supported_implementations(); | 291 | 287 | std::vector<std::size_t> results; | 292 | 287 | results.reserve(implementations.size()); | 293 | | | 294 | 861 | for (auto impl : implementations) { | 295 | 861 | std::size_t ret; | 296 | | if constexpr (From == UtfEncodings::UTF16BE) { | 297 | | ret = impl->count_utf16be(src.data(), src.size()); | 298 | | } else if constexpr (From == UtfEncodings::UTF16LE) { | 299 | | ret = impl->count_utf16le(src.data(), src.size()); | 300 | 861 | } else if constexpr (From == UtfEncodings::UTF8) { | 301 | 861 | ret = impl->count_utf8(src.data(), src.size()); | 302 | 861 | } | 303 | 861 | results.push_back(ret); | 304 | 861 | } | 305 | 287 | auto neq = [](const auto& a, const auto& b) { return a != b; }; | 306 | 287 | if (std::ranges::adjacent_find(results, neq) != results.end()) { | 307 | 0 | std::cerr << "begin errormessage for count_the_input()\n"; | 308 | 0 | std::cerr << "in fuzz case for " | 309 | 0 | << ValidationFunctionTrait<From>::ValidationWithErrorsName | 310 | 0 | << " invoked with " << src.size() << " elements:\n"; | 311 | 0 | for (std::size_t i = 0; i < results.size(); ++i) { | 312 | 0 | std::cerr << "got return " << std::dec << results[i] | 313 | 0 | << " from implementation " << implementations[i]->name() | 314 | 0 | << '\n'; | 315 | 0 | } | 316 | 0 | std::cerr << "end errormessage\n"; | 317 | 0 | return false; | 318 | 0 | } | 319 | | | 320 | 287 | return true; | 321 | 287 | } |
Conversion<(UtfEncodings)2, (UtfEncodings)3, unsigned long (simdutf::implementation::*)(char const*, unsigned long) noexcept const, simdutf::result (simdutf::implementation::*)(char const*, unsigned long, char32_t*) noexcept const>::count_the_input(std::__1::span<char const, 18446744073709551615ul>) const Line | Count | Source | 289 | 369 | bool count_the_input(FromSpan src) const { | 290 | 369 | const auto implementations = get_supported_implementations(); | 291 | 369 | std::vector<std::size_t> results; | 292 | 369 | results.reserve(implementations.size()); | 293 | | | 294 | 1.10k | for (auto impl : implementations) { | 295 | 1.10k | std::size_t ret; | 296 | | if constexpr (From == UtfEncodings::UTF16BE) { | 297 | | ret = impl->count_utf16be(src.data(), src.size()); | 298 | | } else if constexpr (From == UtfEncodings::UTF16LE) { | 299 | | ret = impl->count_utf16le(src.data(), src.size()); | 300 | 1.10k | } else if constexpr (From == UtfEncodings::UTF8) { | 301 | 1.10k | ret = impl->count_utf8(src.data(), src.size()); | 302 | 1.10k | } | 303 | 1.10k | results.push_back(ret); | 304 | 1.10k | } | 305 | 369 | auto neq = [](const auto& a, const auto& b) { return a != b; }; | 306 | 369 | if (std::ranges::adjacent_find(results, neq) != results.end()) { | 307 | 0 | std::cerr << "begin errormessage for count_the_input()\n"; | 308 | 0 | std::cerr << "in fuzz case for " | 309 | 0 | << ValidationFunctionTrait<From>::ValidationWithErrorsName | 310 | 0 | << " invoked with " << src.size() << " elements:\n"; | 311 | 0 | for (std::size_t i = 0; i < results.size(); ++i) { | 312 | 0 | std::cerr << "got return " << std::dec << results[i] | 313 | 0 | << " from implementation " << implementations[i]->name() | 314 | 0 | << '\n'; | 315 | 0 | } | 316 | 0 | std::cerr << "end errormessage\n"; | 317 | 0 | return false; | 318 | 0 | } | 319 | | | 320 | 369 | return true; | 321 | 369 | } |
|
322 | | |
323 | | // this quirk is needed because length calculations do not have consistent |
324 | | // signatures since some of them do not look at the input data, just the |
325 | | // length of it. |
326 | | template <typename Dummy = void> |
327 | | requires std::is_invocable_v<LengthFunction, const simdutf::implementation*, |
328 | | const FromType*, std::size_t> |
329 | | std::size_t invoke_lengthcalc(const simdutf::implementation* impl, |
330 | 23.3k | FromSpan src) const { |
331 | 23.3k | return std::invoke(lengthcalc, impl, src.data(), src.size()); |
332 | 23.3k | } _ZNK10ConversionIL12UtfEncodings0ELS0_3EMN7simdutf14implementationEKDoFmPKDsmEMS2_KDoFmS4_mPDiEE17invoke_lengthcalcIvQsr3stdE14is_invocable_vIT1_PKS2_PKN23ValidationFunctionTraitIXT_EE7RawTypeEmEEEmSE_NSt3__14spanIS3_Lm18446744073709551615EEE Line | Count | Source | 330 | 603 | FromSpan src) const { | 331 | 603 | return std::invoke(lengthcalc, impl, src.data(), src.size()); | 332 | 603 | } |
_ZNK10ConversionIL12UtfEncodings0ELS0_2EMN7simdutf14implementationEKDoFmPKDsmEMS2_KDoFmS4_mPcEE17invoke_lengthcalcIvQsr3stdE14is_invocable_vIT1_PKS2_PKN23ValidationFunctionTraitIXT_EE7RawTypeEmEEEmSE_NSt3__14spanIS3_Lm18446744073709551615EEE Line | Count | Source | 330 | 1.20k | FromSpan src) const { | 331 | 1.20k | return std::invoke(lengthcalc, impl, src.data(), src.size()); | 332 | 1.20k | } |
_ZNK10ConversionIL12UtfEncodings1ELS0_3EMN7simdutf14implementationEKDoFmPKDsmEMS2_KDoFmS4_mPDiEE17invoke_lengthcalcIvQsr3stdE14is_invocable_vIT1_PKS2_PKN23ValidationFunctionTraitIXT_EE7RawTypeEmEEEmSE_NSt3__14spanIS3_Lm18446744073709551615EEE Line | Count | Source | 330 | 591 | FromSpan src) const { | 331 | 591 | return std::invoke(lengthcalc, impl, src.data(), src.size()); | 332 | 591 | } |
_ZNK10ConversionIL12UtfEncodings1ELS0_2EMN7simdutf14implementationEKDoFmPKDsmEMS2_KDoFmS4_mPcEE17invoke_lengthcalcIvQsr3stdE14is_invocable_vIT1_PKS2_PKN23ValidationFunctionTraitIXT_EE7RawTypeEmEEEmSE_NSt3__14spanIS3_Lm18446744073709551615EEE Line | Count | Source | 330 | 1.23k | FromSpan src) const { | 331 | 1.23k | return std::invoke(lengthcalc, impl, src.data(), src.size()); | 332 | 1.23k | } |
_ZNK10ConversionIL12UtfEncodings3ELS0_0EMN7simdutf14implementationEKDoFmPKDimEMS2_KDoFmS4_mPDsEE17invoke_lengthcalcIvQsr3stdE14is_invocable_vIT1_PKS2_PKN23ValidationFunctionTraitIXT_EE7RawTypeEmEEEmSE_NSt3__14spanIS3_Lm18446744073709551615EEE Line | Count | Source | 330 | 804 | FromSpan src) const { | 331 | 804 | return std::invoke(lengthcalc, impl, src.data(), src.size()); | 332 | 804 | } |
_ZNK10ConversionIL12UtfEncodings3ELS0_1EMN7simdutf14implementationEKDoFmPKDimEMS2_KDoFmS4_mPDsEE17invoke_lengthcalcIvQsr3stdE14is_invocable_vIT1_PKS2_PKN23ValidationFunctionTraitIXT_EE7RawTypeEmEEEmSE_NSt3__14spanIS3_Lm18446744073709551615EEE Line | Count | Source | 330 | 1.09k | FromSpan src) const { | 331 | 1.09k | return std::invoke(lengthcalc, impl, src.data(), src.size()); | 332 | 1.09k | } |
_ZNK10ConversionIL12UtfEncodings3ELS0_2EMN7simdutf14implementationEKDoFmPKDimEMS2_KDoFmS4_mPcEE17invoke_lengthcalcIvQsr3stdE14is_invocable_vIT1_PKS2_PKN23ValidationFunctionTraitIXT_EE7RawTypeEmEEEmSE_NSt3__14spanIS3_Lm18446744073709551615EEE Line | Count | Source | 330 | 1.21k | FromSpan src) const { | 331 | 1.21k | return std::invoke(lengthcalc, impl, src.data(), src.size()); | 332 | 1.21k | } |
_ZNK10ConversionIL12UtfEncodings2ELS0_0EMN7simdutf14implementationEKDoFmPKcmEMS2_KDoFmS4_mPDsEE17invoke_lengthcalcIvQsr3stdE14is_invocable_vIT1_PKS2_PKN23ValidationFunctionTraitIXT_EE7RawTypeEmEEEmSE_NSt3__14spanIS3_Lm18446744073709551615EEE Line | Count | Source | 330 | 1.75k | FromSpan src) const { | 331 | 1.75k | return std::invoke(lengthcalc, impl, src.data(), src.size()); | 332 | 1.75k | } |
_ZNK10ConversionIL12UtfEncodings2ELS0_1EMN7simdutf14implementationEKDoFmPKcmEMS2_KDoFmS4_mPDsEE17invoke_lengthcalcIvQsr3stdE14is_invocable_vIT1_PKS2_PKN23ValidationFunctionTraitIXT_EE7RawTypeEmEEEmSE_NSt3__14spanIS3_Lm18446744073709551615EEE Line | Count | Source | 330 | 1.58k | FromSpan src) const { | 331 | 1.58k | return std::invoke(lengthcalc, impl, src.data(), src.size()); | 332 | 1.58k | } |
_ZNK10ConversionIL12UtfEncodings2ELS0_3EMN7simdutf14implementationEKDoFmPKcmEMS2_KDoFmS4_mPDiEE17invoke_lengthcalcIvQsr3stdE14is_invocable_vIT1_PKS2_PKN23ValidationFunctionTraitIXT_EE7RawTypeEmEEEmSE_NSt3__14spanIS3_Lm18446744073709551615EEE Line | Count | Source | 330 | 1.69k | FromSpan src) const { | 331 | 1.69k | return std::invoke(lengthcalc, impl, src.data(), src.size()); | 332 | 1.69k | } |
_ZNK10ConversionIL12UtfEncodings2ELS0_4EMN7simdutf14implementationEKDoFmPKcmEMS2_KDoFmS4_mPcEE17invoke_lengthcalcIvQsr3stdE14is_invocable_vIT1_PKS2_PKN23ValidationFunctionTraitIXT_EE7RawTypeEmEEEmSE_NSt3__14spanIS3_Lm18446744073709551615EEE Line | Count | Source | 330 | 843 | FromSpan src) const { | 331 | 843 | return std::invoke(lengthcalc, impl, src.data(), src.size()); | 332 | 843 | } |
_ZNK10ConversionIL12UtfEncodings0ELS0_3EMN7simdutf14implementationEKDoFmPKDsmEMS2_KDoFNS1_6resultES4_mPDiEE17invoke_lengthcalcIvQsr3stdE14is_invocable_vIT1_PKS2_PKN23ValidationFunctionTraitIXT_EE7RawTypeEmEEEmSF_NSt3__14spanIS3_Lm18446744073709551615EEE Line | Count | Source | 330 | 450 | FromSpan src) const { | 331 | 450 | return std::invoke(lengthcalc, impl, src.data(), src.size()); | 332 | 450 | } |
_ZNK10ConversionIL12UtfEncodings0ELS0_2EMN7simdutf14implementationEKDoFmPKDsmEMS2_KDoFNS1_6resultES4_mPcEE17invoke_lengthcalcIvQsr3stdE14is_invocable_vIT1_PKS2_PKN23ValidationFunctionTraitIXT_EE7RawTypeEmEEEmSF_NSt3__14spanIS3_Lm18446744073709551615EEE Line | Count | Source | 330 | 879 | FromSpan src) const { | 331 | 879 | return std::invoke(lengthcalc, impl, src.data(), src.size()); | 332 | 879 | } |
_ZNK10ConversionIL12UtfEncodings1ELS0_3EMN7simdutf14implementationEKDoFmPKDsmEMS2_KDoFNS1_6resultES4_mPDiEE17invoke_lengthcalcIvQsr3stdE14is_invocable_vIT1_PKS2_PKN23ValidationFunctionTraitIXT_EE7RawTypeEmEEEmSF_NSt3__14spanIS3_Lm18446744073709551615EEE Line | Count | Source | 330 | 621 | FromSpan src) const { | 331 | 621 | return std::invoke(lengthcalc, impl, src.data(), src.size()); | 332 | 621 | } |
_ZNK10ConversionIL12UtfEncodings1ELS0_2EMN7simdutf14implementationEKDoFmPKDsmEMS2_KDoFNS1_6resultES4_mPcEE17invoke_lengthcalcIvQsr3stdE14is_invocable_vIT1_PKS2_PKN23ValidationFunctionTraitIXT_EE7RawTypeEmEEEmSF_NSt3__14spanIS3_Lm18446744073709551615EEE Line | Count | Source | 330 | 945 | FromSpan src) const { | 331 | 945 | return std::invoke(lengthcalc, impl, src.data(), src.size()); | 332 | 945 | } |
_ZNK10ConversionIL12UtfEncodings3ELS0_0EMN7simdutf14implementationEKDoFmPKDimEMS2_KDoFNS1_6resultES4_mPDsEE17invoke_lengthcalcIvQsr3stdE14is_invocable_vIT1_PKS2_PKN23ValidationFunctionTraitIXT_EE7RawTypeEmEEEmSF_NSt3__14spanIS3_Lm18446744073709551615EEE Line | Count | Source | 330 | 909 | FromSpan src) const { | 331 | 909 | return std::invoke(lengthcalc, impl, src.data(), src.size()); | 332 | 909 | } |
_ZNK10ConversionIL12UtfEncodings3ELS0_1EMN7simdutf14implementationEKDoFmPKDimEMS2_KDoFNS1_6resultES4_mPDsEE17invoke_lengthcalcIvQsr3stdE14is_invocable_vIT1_PKS2_PKN23ValidationFunctionTraitIXT_EE7RawTypeEmEEEmSF_NSt3__14spanIS3_Lm18446744073709551615EEE Line | Count | Source | 330 | 1.07k | FromSpan src) const { | 331 | 1.07k | return std::invoke(lengthcalc, impl, src.data(), src.size()); | 332 | 1.07k | } |
_ZNK10ConversionIL12UtfEncodings3ELS0_2EMN7simdutf14implementationEKDoFmPKDimEMS2_KDoFNS1_6resultES4_mPcEE17invoke_lengthcalcIvQsr3stdE14is_invocable_vIT1_PKS2_PKN23ValidationFunctionTraitIXT_EE7RawTypeEmEEEmSF_NSt3__14spanIS3_Lm18446744073709551615EEE Line | Count | Source | 330 | 1.24k | FromSpan src) const { | 331 | 1.24k | return std::invoke(lengthcalc, impl, src.data(), src.size()); | 332 | 1.24k | } |
_ZNK10ConversionIL12UtfEncodings2ELS0_4EMN7simdutf14implementationEKDoFmPKcmEMS2_KDoFNS1_6resultES4_mPcEE17invoke_lengthcalcIvQsr3stdE14is_invocable_vIT1_PKS2_PKN23ValidationFunctionTraitIXT_EE7RawTypeEmEEEmSF_NSt3__14spanIS3_Lm18446744073709551615EEE Line | Count | Source | 330 | 774 | FromSpan src) const { | 331 | 774 | return std::invoke(lengthcalc, impl, src.data(), src.size()); | 332 | 774 | } |
_ZNK10ConversionIL12UtfEncodings2ELS0_0EMN7simdutf14implementationEKDoFmPKcmEMS2_KDoFNS1_6resultES4_mPDsEE17invoke_lengthcalcIvQsr3stdE14is_invocable_vIT1_PKS2_PKN23ValidationFunctionTraitIXT_EE7RawTypeEmEEEmSF_NSt3__14spanIS3_Lm18446744073709551615EEE Line | Count | Source | 330 | 1.05k | FromSpan src) const { | 331 | 1.05k | return std::invoke(lengthcalc, impl, src.data(), src.size()); | 332 | 1.05k | } |
_ZNK10ConversionIL12UtfEncodings2ELS0_1EMN7simdutf14implementationEKDoFmPKcmEMS2_KDoFNS1_6resultES4_mPDsEE17invoke_lengthcalcIvQsr3stdE14is_invocable_vIT1_PKS2_PKN23ValidationFunctionTraitIXT_EE7RawTypeEmEEEmSF_NSt3__14spanIS3_Lm18446744073709551615EEE Line | Count | Source | 330 | 861 | FromSpan src) const { | 331 | 861 | return std::invoke(lengthcalc, impl, src.data(), src.size()); | 332 | 861 | } |
_ZNK10ConversionIL12UtfEncodings2ELS0_3EMN7simdutf14implementationEKDoFmPKcmEMS2_KDoFNS1_6resultES4_mPDiEE17invoke_lengthcalcIvQsr3stdE14is_invocable_vIT1_PKS2_PKN23ValidationFunctionTraitIXT_EE7RawTypeEmEEEmSF_NSt3__14spanIS3_Lm18446744073709551615EEE Line | Count | Source | 330 | 1.10k | FromSpan src) const { | 331 | 1.10k | return std::invoke(lengthcalc, impl, src.data(), src.size()); | 332 | 1.10k | } |
_ZNK10ConversionIL12UtfEncodings4ELS0_2EMN7simdutf14implementationEKDoFmPKcmEMS2_KDoFmS4_mPcEE17invoke_lengthcalcIvQsr3stdE14is_invocable_vIT1_PKS2_PKN23ValidationFunctionTraitIXT_EE7RawTypeEmEEEmSE_NSt3__14spanIS3_Lm18446744073709551615EEE Line | Count | Source | 330 | 807 | FromSpan src) const { | 331 | 807 | return std::invoke(lengthcalc, impl, src.data(), src.size()); | 332 | 807 | } |
|
333 | | template <typename Dummy = void> |
334 | | requires std::is_invocable_v<LengthFunction, const simdutf::implementation*, |
335 | | // const FromType *, |
336 | | std::size_t> |
337 | | std::size_t invoke_lengthcalc(const simdutf::implementation* impl, |
338 | 2.38k | FromSpan src) const { |
339 | 2.38k | return std::invoke(lengthcalc, impl, /*src.data(),*/ src.size()); |
340 | 2.38k | } _ZNK10ConversionIL12UtfEncodings0ELS0_4EMN7simdutf14implementationEKDoFmmEMS2_KDoFmPKDsmPcEE17invoke_lengthcalcIvQsr3stdE14is_invocable_vIT1_PKS2_mEEEmSE_NSt3__14spanIS5_Lm18446744073709551615EEE Line | Count | Source | 338 | 189 | FromSpan src) const { | 339 | 189 | return std::invoke(lengthcalc, impl, /*src.data(),*/ src.size()); | 340 | 189 | } |
_ZNK10ConversionIL12UtfEncodings1ELS0_4EMN7simdutf14implementationEKDoFmmEMS2_KDoFmPKDsmPcEE17invoke_lengthcalcIvQsr3stdE14is_invocable_vIT1_PKS2_mEEEmSE_NSt3__14spanIS5_Lm18446744073709551615EEE Line | Count | Source | 338 | 186 | FromSpan src) const { | 339 | 186 | return std::invoke(lengthcalc, impl, /*src.data(),*/ src.size()); | 340 | 186 | } |
_ZNK10ConversionIL12UtfEncodings3ELS0_4EMN7simdutf14implementationEKDoFmmEMS2_KDoFmPKDimPcEE17invoke_lengthcalcIvQsr3stdE14is_invocable_vIT1_PKS2_mEEEmSE_NSt3__14spanIS5_Lm18446744073709551615EEE Line | Count | Source | 338 | 282 | FromSpan src) const { | 339 | 282 | return std::invoke(lengthcalc, impl, /*src.data(),*/ src.size()); | 340 | 282 | } |
_ZNK10ConversionIL12UtfEncodings0ELS0_4EMN7simdutf14implementationEKDoFmmEMS2_KDoFNS1_6resultEPKDsmPcEE17invoke_lengthcalcIvQsr3stdE14is_invocable_vIT1_PKS2_mEEEmSF_NSt3__14spanIS6_Lm18446744073709551615EEE Line | Count | Source | 338 | 378 | FromSpan src) const { | 339 | 378 | return std::invoke(lengthcalc, impl, /*src.data(),*/ src.size()); | 340 | 378 | } |
_ZNK10ConversionIL12UtfEncodings1ELS0_4EMN7simdutf14implementationEKDoFmmEMS2_KDoFNS1_6resultEPKDsmPcEE17invoke_lengthcalcIvQsr3stdE14is_invocable_vIT1_PKS2_mEEEmSF_NSt3__14spanIS6_Lm18446744073709551615EEE Line | Count | Source | 338 | 345 | FromSpan src) const { | 339 | 345 | return std::invoke(lengthcalc, impl, /*src.data(),*/ src.size()); | 340 | 345 | } |
_ZNK10ConversionIL12UtfEncodings3ELS0_4EMN7simdutf14implementationEKDoFmmEMS2_KDoFNS1_6resultEPKDimPcEE17invoke_lengthcalcIvQsr3stdE14is_invocable_vIT1_PKS2_mEEEmSF_NSt3__14spanIS6_Lm18446744073709551615EEE Line | Count | Source | 338 | 630 | FromSpan src) const { | 339 | 630 | return std::invoke(lengthcalc, impl, /*src.data(),*/ src.size()); | 340 | 630 | } |
_ZNK10ConversionIL12UtfEncodings4ELS0_3EMN7simdutf14implementationEKDoFmmEMS2_KDoFmPKcmPDiEE17invoke_lengthcalcIvQsr3stdE14is_invocable_vIT1_PKS2_mEEEmSE_NSt3__14spanIS5_Lm18446744073709551615EEE Line | Count | Source | 338 | 135 | FromSpan src) const { | 339 | 135 | return std::invoke(lengthcalc, impl, /*src.data(),*/ src.size()); | 340 | 135 | } |
_ZNK10ConversionIL12UtfEncodings4ELS0_0EMN7simdutf14implementationEKDoFmmEMS2_KDoFmPKcmPDsEE17invoke_lengthcalcIvQsr3stdE14is_invocable_vIT1_PKS2_mEEEmSE_NSt3__14spanIS5_Lm18446744073709551615EEE Line | Count | Source | 338 | 120 | FromSpan src) const { | 339 | 120 | return std::invoke(lengthcalc, impl, /*src.data(),*/ src.size()); | 340 | 120 | } |
_ZNK10ConversionIL12UtfEncodings4ELS0_1EMN7simdutf14implementationEKDoFmmEMS2_KDoFmPKcmPDsEE17invoke_lengthcalcIvQsr3stdE14is_invocable_vIT1_PKS2_mEEEmSE_NSt3__14spanIS5_Lm18446744073709551615EEE Line | Count | Source | 338 | 120 | FromSpan src) const { | 339 | 120 | return std::invoke(lengthcalc, impl, /*src.data(),*/ src.size()); | 340 | 120 | } |
|
341 | | |
342 | 8.57k | length_result calculate_length(FromSpan src, const bool inputisvalid) const { |
343 | 8.57k | length_result ret{}; |
344 | | |
345 | 8.57k | const auto implementations = get_supported_implementations(); |
346 | 8.57k | std::vector<std::size_t> results; |
347 | 8.57k | results.reserve(implementations.size()); |
348 | | |
349 | 25.7k | for (auto impl : implementations) { |
350 | 25.7k | const auto len = invoke_lengthcalc(impl, src); |
351 | 25.7k | results.push_back(len); |
352 | 25.7k | ret.length.push_back(len); |
353 | 25.7k | } |
354 | | |
355 | 17.1k | auto neq = [](const auto& a, const auto& b) { return a != b; };auto Conversion<(UtfEncodings)0, (UtfEncodings)3, unsigned long (simdutf::implementation::*)(char16_t const*, unsigned long) noexcept const, unsigned long (simdutf::implementation::*)(char16_t const*, unsigned long, char32_t*) noexcept const>::calculate_length(std::__1::span<char16_t const, 18446744073709551615ul>, bool) const::{lambda(auto:1 const&, auto:2 const&)#1}::operator()<unsigned long, unsigned long>(unsigned long const&, unsigned long const&) constLine | Count | Source | 355 | 402 | auto neq = [](const auto& a, const auto& b) { return a != b; }; |
auto Conversion<(UtfEncodings)0, (UtfEncodings)2, unsigned long (simdutf::implementation::*)(char16_t const*, unsigned long) noexcept const, unsigned long (simdutf::implementation::*)(char16_t const*, unsigned long, char*) noexcept const>::calculate_length(std::__1::span<char16_t const, 18446744073709551615ul>, bool) const::{lambda(auto:1 const&, auto:2 const&)#1}::operator()<unsigned long, unsigned long>(unsigned long const&, unsigned long const&) constLine | Count | Source | 355 | 806 | auto neq = [](const auto& a, const auto& b) { return a != b; }; |
auto Conversion<(UtfEncodings)1, (UtfEncodings)3, unsigned long (simdutf::implementation::*)(char16_t const*, unsigned long) noexcept const, unsigned long (simdutf::implementation::*)(char16_t const*, unsigned long, char32_t*) noexcept const>::calculate_length(std::__1::span<char16_t const, 18446744073709551615ul>, bool) const::{lambda(auto:1 const&, auto:2 const&)#1}::operator()<unsigned long, unsigned long>(unsigned long const&, unsigned long const&) constLine | Count | Source | 355 | 394 | auto neq = [](const auto& a, const auto& b) { return a != b; }; |
auto Conversion<(UtfEncodings)1, (UtfEncodings)2, unsigned long (simdutf::implementation::*)(char16_t const*, unsigned long) noexcept const, unsigned long (simdutf::implementation::*)(char16_t const*, unsigned long, char*) noexcept const>::calculate_length(std::__1::span<char16_t const, 18446744073709551615ul>, bool) const::{lambda(auto:1 const&, auto:2 const&)#1}::operator()<unsigned long, unsigned long>(unsigned long const&, unsigned long const&) constLine | Count | Source | 355 | 824 | auto neq = [](const auto& a, const auto& b) { return a != b; }; |
auto Conversion<(UtfEncodings)3, (UtfEncodings)0, unsigned long (simdutf::implementation::*)(char32_t const*, unsigned long) noexcept const, unsigned long (simdutf::implementation::*)(char32_t const*, unsigned long, char16_t*) noexcept const>::calculate_length(std::__1::span<char32_t const, 18446744073709551615ul>, bool) const::{lambda(auto:1 const&, auto:2 const&)#1}::operator()<unsigned long, unsigned long>(unsigned long const&, unsigned long const&) constLine | Count | Source | 355 | 536 | auto neq = [](const auto& a, const auto& b) { return a != b; }; |
auto Conversion<(UtfEncodings)3, (UtfEncodings)1, unsigned long (simdutf::implementation::*)(char32_t const*, unsigned long) noexcept const, unsigned long (simdutf::implementation::*)(char32_t const*, unsigned long, char16_t*) noexcept const>::calculate_length(std::__1::span<char32_t const, 18446744073709551615ul>, bool) const::{lambda(auto:1 const&, auto:2 const&)#1}::operator()<unsigned long, unsigned long>(unsigned long const&, unsigned long const&) constLine | Count | Source | 355 | 732 | auto neq = [](const auto& a, const auto& b) { return a != b; }; |
auto Conversion<(UtfEncodings)3, (UtfEncodings)2, unsigned long (simdutf::implementation::*)(char32_t const*, unsigned long) noexcept const, unsigned long (simdutf::implementation::*)(char32_t const*, unsigned long, char*) noexcept const>::calculate_length(std::__1::span<char32_t const, 18446744073709551615ul>, bool) const::{lambda(auto:1 const&, auto:2 const&)#1}::operator()<unsigned long, unsigned long>(unsigned long const&, unsigned long const&) constLine | Count | Source | 355 | 808 | auto neq = [](const auto& a, const auto& b) { return a != b; }; |
auto Conversion<(UtfEncodings)2, (UtfEncodings)0, unsigned long (simdutf::implementation::*)(char const*, unsigned long) noexcept const, unsigned long (simdutf::implementation::*)(char const*, unsigned long, char16_t*) noexcept const>::calculate_length(std::__1::span<char const, 18446744073709551615ul>, bool) const::{lambda(auto:1 const&, auto:2 const&)#1}::operator()<unsigned long, unsigned long>(unsigned long const&, unsigned long const&) constLine | Count | Source | 355 | 1.16k | auto neq = [](const auto& a, const auto& b) { return a != b; }; |
auto Conversion<(UtfEncodings)2, (UtfEncodings)1, unsigned long (simdutf::implementation::*)(char const*, unsigned long) noexcept const, unsigned long (simdutf::implementation::*)(char const*, unsigned long, char16_t*) noexcept const>::calculate_length(std::__1::span<char const, 18446744073709551615ul>, bool) const::{lambda(auto:1 const&, auto:2 const&)#1}::operator()<unsigned long, unsigned long>(unsigned long const&, unsigned long const&) constLine | Count | Source | 355 | 1.05k | auto neq = [](const auto& a, const auto& b) { return a != b; }; |
auto Conversion<(UtfEncodings)2, (UtfEncodings)3, unsigned long (simdutf::implementation::*)(char const*, unsigned long) noexcept const, unsigned long (simdutf::implementation::*)(char const*, unsigned long, char32_t*) noexcept const>::calculate_length(std::__1::span<char const, 18446744073709551615ul>, bool) const::{lambda(auto:1 const&, auto:2 const&)#1}::operator()<unsigned long, unsigned long>(unsigned long const&, unsigned long const&) constLine | Count | Source | 355 | 1.12k | auto neq = [](const auto& a, const auto& b) { return a != b; }; |
auto Conversion<(UtfEncodings)0, (UtfEncodings)4, unsigned long (simdutf::implementation::*)(unsigned long) noexcept const, unsigned long (simdutf::implementation::*)(char16_t const*, unsigned long, char*) noexcept const>::calculate_length(std::__1::span<char16_t const, 18446744073709551615ul>, bool) const::{lambda(auto:1 const&, auto:2 const&)#1}::operator()<unsigned long, unsigned long>(unsigned long const&, unsigned long const&) constLine | Count | Source | 355 | 126 | auto neq = [](const auto& a, const auto& b) { return a != b; }; |
auto Conversion<(UtfEncodings)1, (UtfEncodings)4, unsigned long (simdutf::implementation::*)(unsigned long) noexcept const, unsigned long (simdutf::implementation::*)(char16_t const*, unsigned long, char*) noexcept const>::calculate_length(std::__1::span<char16_t const, 18446744073709551615ul>, bool) const::{lambda(auto:1 const&, auto:2 const&)#1}::operator()<unsigned long, unsigned long>(unsigned long const&, unsigned long const&) constLine | Count | Source | 355 | 124 | auto neq = [](const auto& a, const auto& b) { return a != b; }; |
auto Conversion<(UtfEncodings)3, (UtfEncodings)4, unsigned long (simdutf::implementation::*)(unsigned long) noexcept const, unsigned long (simdutf::implementation::*)(char32_t const*, unsigned long, char*) noexcept const>::calculate_length(std::__1::span<char32_t const, 18446744073709551615ul>, bool) const::{lambda(auto:1 const&, auto:2 const&)#1}::operator()<unsigned long, unsigned long>(unsigned long const&, unsigned long const&) constLine | Count | Source | 355 | 188 | auto neq = [](const auto& a, const auto& b) { return a != b; }; |
auto Conversion<(UtfEncodings)2, (UtfEncodings)4, unsigned long (simdutf::implementation::*)(char const*, unsigned long) noexcept const, unsigned long (simdutf::implementation::*)(char const*, unsigned long, char*) noexcept const>::calculate_length(std::__1::span<char const, 18446744073709551615ul>, bool) const::{lambda(auto:1 const&, auto:2 const&)#1}::operator()<unsigned long, unsigned long>(unsigned long const&, unsigned long const&) constLine | Count | Source | 355 | 562 | auto neq = [](const auto& a, const auto& b) { return a != b; }; |
auto Conversion<(UtfEncodings)0, (UtfEncodings)4, unsigned long (simdutf::implementation::*)(unsigned long) noexcept const, simdutf::result (simdutf::implementation::*)(char16_t const*, unsigned long, char*) noexcept const>::calculate_length(std::__1::span<char16_t const, 18446744073709551615ul>, bool) const::{lambda(auto:1 const&, auto:2 const&)#1}::operator()<unsigned long, unsigned long>(unsigned long const&, unsigned long const&) constLine | Count | Source | 355 | 252 | auto neq = [](const auto& a, const auto& b) { return a != b; }; |
auto Conversion<(UtfEncodings)0, (UtfEncodings)3, unsigned long (simdutf::implementation::*)(char16_t const*, unsigned long) noexcept const, simdutf::result (simdutf::implementation::*)(char16_t const*, unsigned long, char32_t*) noexcept const>::calculate_length(std::__1::span<char16_t const, 18446744073709551615ul>, bool) const::{lambda(auto:1 const&, auto:2 const&)#1}::operator()<unsigned long, unsigned long>(unsigned long const&, unsigned long const&) constLine | Count | Source | 355 | 300 | auto neq = [](const auto& a, const auto& b) { return a != b; }; |
auto Conversion<(UtfEncodings)0, (UtfEncodings)2, unsigned long (simdutf::implementation::*)(char16_t const*, unsigned long) noexcept const, simdutf::result (simdutf::implementation::*)(char16_t const*, unsigned long, char*) noexcept const>::calculate_length(std::__1::span<char16_t const, 18446744073709551615ul>, bool) const::{lambda(auto:1 const&, auto:2 const&)#1}::operator()<unsigned long, unsigned long>(unsigned long const&, unsigned long const&) constLine | Count | Source | 355 | 586 | auto neq = [](const auto& a, const auto& b) { return a != b; }; |
auto Conversion<(UtfEncodings)1, (UtfEncodings)4, unsigned long (simdutf::implementation::*)(unsigned long) noexcept const, simdutf::result (simdutf::implementation::*)(char16_t const*, unsigned long, char*) noexcept const>::calculate_length(std::__1::span<char16_t const, 18446744073709551615ul>, bool) const::{lambda(auto:1 const&, auto:2 const&)#1}::operator()<unsigned long, unsigned long>(unsigned long const&, unsigned long const&) constLine | Count | Source | 355 | 230 | auto neq = [](const auto& a, const auto& b) { return a != b; }; |
auto Conversion<(UtfEncodings)1, (UtfEncodings)3, unsigned long (simdutf::implementation::*)(char16_t const*, unsigned long) noexcept const, simdutf::result (simdutf::implementation::*)(char16_t const*, unsigned long, char32_t*) noexcept const>::calculate_length(std::__1::span<char16_t const, 18446744073709551615ul>, bool) const::{lambda(auto:1 const&, auto:2 const&)#1}::operator()<unsigned long, unsigned long>(unsigned long const&, unsigned long const&) constLine | Count | Source | 355 | 414 | auto neq = [](const auto& a, const auto& b) { return a != b; }; |
auto Conversion<(UtfEncodings)1, (UtfEncodings)2, unsigned long (simdutf::implementation::*)(char16_t const*, unsigned long) noexcept const, simdutf::result (simdutf::implementation::*)(char16_t const*, unsigned long, char*) noexcept const>::calculate_length(std::__1::span<char16_t const, 18446744073709551615ul>, bool) const::{lambda(auto:1 const&, auto:2 const&)#1}::operator()<unsigned long, unsigned long>(unsigned long const&, unsigned long const&) constLine | Count | Source | 355 | 630 | auto neq = [](const auto& a, const auto& b) { return a != b; }; |
auto Conversion<(UtfEncodings)3, (UtfEncodings)4, unsigned long (simdutf::implementation::*)(unsigned long) noexcept const, simdutf::result (simdutf::implementation::*)(char32_t const*, unsigned long, char*) noexcept const>::calculate_length(std::__1::span<char32_t const, 18446744073709551615ul>, bool) const::{lambda(auto:1 const&, auto:2 const&)#1}::operator()<unsigned long, unsigned long>(unsigned long const&, unsigned long const&) constLine | Count | Source | 355 | 420 | auto neq = [](const auto& a, const auto& b) { return a != b; }; |
auto Conversion<(UtfEncodings)3, (UtfEncodings)0, unsigned long (simdutf::implementation::*)(char32_t const*, unsigned long) noexcept const, simdutf::result (simdutf::implementation::*)(char32_t const*, unsigned long, char16_t*) noexcept const>::calculate_length(std::__1::span<char32_t const, 18446744073709551615ul>, bool) const::{lambda(auto:1 const&, auto:2 const&)#1}::operator()<unsigned long, unsigned long>(unsigned long const&, unsigned long const&) constLine | Count | Source | 355 | 606 | auto neq = [](const auto& a, const auto& b) { return a != b; }; |
auto Conversion<(UtfEncodings)3, (UtfEncodings)1, unsigned long (simdutf::implementation::*)(char32_t const*, unsigned long) noexcept const, simdutf::result (simdutf::implementation::*)(char32_t const*, unsigned long, char16_t*) noexcept const>::calculate_length(std::__1::span<char32_t const, 18446744073709551615ul>, bool) const::{lambda(auto:1 const&, auto:2 const&)#1}::operator()<unsigned long, unsigned long>(unsigned long const&, unsigned long const&) constLine | Count | Source | 355 | 716 | auto neq = [](const auto& a, const auto& b) { return a != b; }; |
auto Conversion<(UtfEncodings)3, (UtfEncodings)2, unsigned long (simdutf::implementation::*)(char32_t const*, unsigned long) noexcept const, simdutf::result (simdutf::implementation::*)(char32_t const*, unsigned long, char*) noexcept const>::calculate_length(std::__1::span<char32_t const, 18446744073709551615ul>, bool) const::{lambda(auto:1 const&, auto:2 const&)#1}::operator()<unsigned long, unsigned long>(unsigned long const&, unsigned long const&) constLine | Count | Source | 355 | 830 | auto neq = [](const auto& a, const auto& b) { return a != b; }; |
auto Conversion<(UtfEncodings)2, (UtfEncodings)4, unsigned long (simdutf::implementation::*)(char const*, unsigned long) noexcept const, simdutf::result (simdutf::implementation::*)(char const*, unsigned long, char*) noexcept const>::calculate_length(std::__1::span<char const, 18446744073709551615ul>, bool) const::{lambda(auto:1 const&, auto:2 const&)#1}::operator()<unsigned long, unsigned long>(unsigned long const&, unsigned long const&) constLine | Count | Source | 355 | 516 | auto neq = [](const auto& a, const auto& b) { return a != b; }; |
auto Conversion<(UtfEncodings)2, (UtfEncodings)0, unsigned long (simdutf::implementation::*)(char const*, unsigned long) noexcept const, simdutf::result (simdutf::implementation::*)(char const*, unsigned long, char16_t*) noexcept const>::calculate_length(std::__1::span<char const, 18446744073709551615ul>, bool) const::{lambda(auto:1 const&, auto:2 const&)#1}::operator()<unsigned long, unsigned long>(unsigned long const&, unsigned long const&) constLine | Count | Source | 355 | 702 | auto neq = [](const auto& a, const auto& b) { return a != b; }; |
auto Conversion<(UtfEncodings)2, (UtfEncodings)1, unsigned long (simdutf::implementation::*)(char const*, unsigned long) noexcept const, simdutf::result (simdutf::implementation::*)(char const*, unsigned long, char16_t*) noexcept const>::calculate_length(std::__1::span<char const, 18446744073709551615ul>, bool) const::{lambda(auto:1 const&, auto:2 const&)#1}::operator()<unsigned long, unsigned long>(unsigned long const&, unsigned long const&) constLine | Count | Source | 355 | 574 | auto neq = [](const auto& a, const auto& b) { return a != b; }; |
auto Conversion<(UtfEncodings)2, (UtfEncodings)3, unsigned long (simdutf::implementation::*)(char const*, unsigned long) noexcept const, simdutf::result (simdutf::implementation::*)(char const*, unsigned long, char32_t*) noexcept const>::calculate_length(std::__1::span<char const, 18446744073709551615ul>, bool) const::{lambda(auto:1 const&, auto:2 const&)#1}::operator()<unsigned long, unsigned long>(unsigned long const&, unsigned long const&) constLine | Count | Source | 355 | 738 | auto neq = [](const auto& a, const auto& b) { return a != b; }; |
auto Conversion<(UtfEncodings)4, (UtfEncodings)3, unsigned long (simdutf::implementation::*)(unsigned long) noexcept const, unsigned long (simdutf::implementation::*)(char const*, unsigned long, char32_t*) noexcept const>::calculate_length(std::__1::span<char const, 18446744073709551615ul>, bool) const::{lambda(auto:1 const&, auto:2 const&)#1}::operator()<unsigned long, unsigned long>(unsigned long const&, unsigned long const&) constLine | Count | Source | 355 | 90 | auto neq = [](const auto& a, const auto& b) { return a != b; }; |
auto Conversion<(UtfEncodings)4, (UtfEncodings)0, unsigned long (simdutf::implementation::*)(unsigned long) noexcept const, unsigned long (simdutf::implementation::*)(char const*, unsigned long, char16_t*) noexcept const>::calculate_length(std::__1::span<char const, 18446744073709551615ul>, bool) const::{lambda(auto:1 const&, auto:2 const&)#1}::operator()<unsigned long, unsigned long>(unsigned long const&, unsigned long const&) constLine | Count | Source | 355 | 80 | auto neq = [](const auto& a, const auto& b) { return a != b; }; |
auto Conversion<(UtfEncodings)4, (UtfEncodings)1, unsigned long (simdutf::implementation::*)(unsigned long) noexcept const, unsigned long (simdutf::implementation::*)(char const*, unsigned long, char16_t*) noexcept const>::calculate_length(std::__1::span<char const, 18446744073709551615ul>, bool) const::{lambda(auto:1 const&, auto:2 const&)#1}::operator()<unsigned long, unsigned long>(unsigned long const&, unsigned long const&) constLine | Count | Source | 355 | 80 | auto neq = [](const auto& a, const auto& b) { return a != b; }; |
auto Conversion<(UtfEncodings)4, (UtfEncodings)2, unsigned long (simdutf::implementation::*)(char const*, unsigned long) noexcept const, unsigned long (simdutf::implementation::*)(char const*, unsigned long, char*) noexcept const>::calculate_length(std::__1::span<char const, 18446744073709551615ul>, bool) const::{lambda(auto:1 const&, auto:2 const&)#1}::operator()<unsigned long, unsigned long>(unsigned long const&, unsigned long const&) constLine | Count | Source | 355 | 538 | auto neq = [](const auto& a, const auto& b) { return a != b; }; |
|
356 | 8.57k | if (std::ranges::adjacent_find(results, neq) != results.end()) { |
357 | 0 | std::cerr << "begin errormessage for calculate_length\n"; |
358 | 0 | std::cerr << "in fuzz case invoking " << lengthcalcname << " with " |
359 | 0 | << src.size() << " elements with valid input=" << inputisvalid |
360 | 0 | << ":\n"; |
361 | 0 | for (std::size_t i = 0; i < results.size(); ++i) { |
362 | 0 | std::cerr << "got return " << std::dec << results[i] |
363 | 0 | << " from implementation " << implementations[i]->name() |
364 | 0 | << '\n'; |
365 | 0 | } |
366 | 0 | std::cerr << "end errormessage\n"; |
367 | 0 | if (inputisvalid) { |
368 | 0 | ret.implementations_agree = false; |
369 | 0 | } else { |
370 | 0 | std::cerr |
371 | 0 | << "implementations are allowed to disagree on invalid input\n"; |
372 | 0 | ret.implementations_agree = true; |
373 | 0 | } |
374 | 8.57k | } else { |
375 | 8.57k | ret.implementations_agree = true; |
376 | 8.57k | } |
377 | 8.57k | return ret; |
378 | 8.57k | } Conversion<(UtfEncodings)0, (UtfEncodings)3, unsigned long (simdutf::implementation::*)(char16_t const*, unsigned long) noexcept const, unsigned long (simdutf::implementation::*)(char16_t const*, unsigned long, char32_t*) noexcept const>::calculate_length(std::__1::span<char16_t const, 18446744073709551615ul>, bool) const Line | Count | Source | 342 | 201 | length_result calculate_length(FromSpan src, const bool inputisvalid) const { | 343 | 201 | length_result ret{}; | 344 | | | 345 | 201 | const auto implementations = get_supported_implementations(); | 346 | 201 | std::vector<std::size_t> results; | 347 | 201 | results.reserve(implementations.size()); | 348 | | | 349 | 603 | for (auto impl : implementations) { | 350 | 603 | const auto len = invoke_lengthcalc(impl, src); | 351 | 603 | results.push_back(len); | 352 | 603 | ret.length.push_back(len); | 353 | 603 | } | 354 | | | 355 | 201 | auto neq = [](const auto& a, const auto& b) { return a != b; }; | 356 | 201 | if (std::ranges::adjacent_find(results, neq) != results.end()) { | 357 | 0 | std::cerr << "begin errormessage for calculate_length\n"; | 358 | 0 | std::cerr << "in fuzz case invoking " << lengthcalcname << " with " | 359 | 0 | << src.size() << " elements with valid input=" << inputisvalid | 360 | 0 | << ":\n"; | 361 | 0 | for (std::size_t i = 0; i < results.size(); ++i) { | 362 | 0 | std::cerr << "got return " << std::dec << results[i] | 363 | 0 | << " from implementation " << implementations[i]->name() | 364 | 0 | << '\n'; | 365 | 0 | } | 366 | 0 | std::cerr << "end errormessage\n"; | 367 | 0 | if (inputisvalid) { | 368 | 0 | ret.implementations_agree = false; | 369 | 0 | } else { | 370 | 0 | std::cerr | 371 | 0 | << "implementations are allowed to disagree on invalid input\n"; | 372 | 0 | ret.implementations_agree = true; | 373 | 0 | } | 374 | 201 | } else { | 375 | 201 | ret.implementations_agree = true; | 376 | 201 | } | 377 | 201 | return ret; | 378 | 201 | } |
Conversion<(UtfEncodings)0, (UtfEncodings)2, unsigned long (simdutf::implementation::*)(char16_t const*, unsigned long) noexcept const, unsigned long (simdutf::implementation::*)(char16_t const*, unsigned long, char*) noexcept const>::calculate_length(std::__1::span<char16_t const, 18446744073709551615ul>, bool) const Line | Count | Source | 342 | 403 | length_result calculate_length(FromSpan src, const bool inputisvalid) const { | 343 | 403 | length_result ret{}; | 344 | | | 345 | 403 | const auto implementations = get_supported_implementations(); | 346 | 403 | std::vector<std::size_t> results; | 347 | 403 | results.reserve(implementations.size()); | 348 | | | 349 | 1.20k | for (auto impl : implementations) { | 350 | 1.20k | const auto len = invoke_lengthcalc(impl, src); | 351 | 1.20k | results.push_back(len); | 352 | 1.20k | ret.length.push_back(len); | 353 | 1.20k | } | 354 | | | 355 | 403 | auto neq = [](const auto& a, const auto& b) { return a != b; }; | 356 | 403 | if (std::ranges::adjacent_find(results, neq) != results.end()) { | 357 | 0 | std::cerr << "begin errormessage for calculate_length\n"; | 358 | 0 | std::cerr << "in fuzz case invoking " << lengthcalcname << " with " | 359 | 0 | << src.size() << " elements with valid input=" << inputisvalid | 360 | 0 | << ":\n"; | 361 | 0 | for (std::size_t i = 0; i < results.size(); ++i) { | 362 | 0 | std::cerr << "got return " << std::dec << results[i] | 363 | 0 | << " from implementation " << implementations[i]->name() | 364 | 0 | << '\n'; | 365 | 0 | } | 366 | 0 | std::cerr << "end errormessage\n"; | 367 | 0 | if (inputisvalid) { | 368 | 0 | ret.implementations_agree = false; | 369 | 0 | } else { | 370 | 0 | std::cerr | 371 | 0 | << "implementations are allowed to disagree on invalid input\n"; | 372 | 0 | ret.implementations_agree = true; | 373 | 0 | } | 374 | 403 | } else { | 375 | 403 | ret.implementations_agree = true; | 376 | 403 | } | 377 | 403 | return ret; | 378 | 403 | } |
Conversion<(UtfEncodings)1, (UtfEncodings)3, unsigned long (simdutf::implementation::*)(char16_t const*, unsigned long) noexcept const, unsigned long (simdutf::implementation::*)(char16_t const*, unsigned long, char32_t*) noexcept const>::calculate_length(std::__1::span<char16_t const, 18446744073709551615ul>, bool) const Line | Count | Source | 342 | 197 | length_result calculate_length(FromSpan src, const bool inputisvalid) const { | 343 | 197 | length_result ret{}; | 344 | | | 345 | 197 | const auto implementations = get_supported_implementations(); | 346 | 197 | std::vector<std::size_t> results; | 347 | 197 | results.reserve(implementations.size()); | 348 | | | 349 | 591 | for (auto impl : implementations) { | 350 | 591 | const auto len = invoke_lengthcalc(impl, src); | 351 | 591 | results.push_back(len); | 352 | 591 | ret.length.push_back(len); | 353 | 591 | } | 354 | | | 355 | 197 | auto neq = [](const auto& a, const auto& b) { return a != b; }; | 356 | 197 | if (std::ranges::adjacent_find(results, neq) != results.end()) { | 357 | 0 | std::cerr << "begin errormessage for calculate_length\n"; | 358 | 0 | std::cerr << "in fuzz case invoking " << lengthcalcname << " with " | 359 | 0 | << src.size() << " elements with valid input=" << inputisvalid | 360 | 0 | << ":\n"; | 361 | 0 | for (std::size_t i = 0; i < results.size(); ++i) { | 362 | 0 | std::cerr << "got return " << std::dec << results[i] | 363 | 0 | << " from implementation " << implementations[i]->name() | 364 | 0 | << '\n'; | 365 | 0 | } | 366 | 0 | std::cerr << "end errormessage\n"; | 367 | 0 | if (inputisvalid) { | 368 | 0 | ret.implementations_agree = false; | 369 | 0 | } else { | 370 | 0 | std::cerr | 371 | 0 | << "implementations are allowed to disagree on invalid input\n"; | 372 | 0 | ret.implementations_agree = true; | 373 | 0 | } | 374 | 197 | } else { | 375 | 197 | ret.implementations_agree = true; | 376 | 197 | } | 377 | 197 | return ret; | 378 | 197 | } |
Conversion<(UtfEncodings)1, (UtfEncodings)2, unsigned long (simdutf::implementation::*)(char16_t const*, unsigned long) noexcept const, unsigned long (simdutf::implementation::*)(char16_t const*, unsigned long, char*) noexcept const>::calculate_length(std::__1::span<char16_t const, 18446744073709551615ul>, bool) const Line | Count | Source | 342 | 412 | length_result calculate_length(FromSpan src, const bool inputisvalid) const { | 343 | 412 | length_result ret{}; | 344 | | | 345 | 412 | const auto implementations = get_supported_implementations(); | 346 | 412 | std::vector<std::size_t> results; | 347 | 412 | results.reserve(implementations.size()); | 348 | | | 349 | 1.23k | for (auto impl : implementations) { | 350 | 1.23k | const auto len = invoke_lengthcalc(impl, src); | 351 | 1.23k | results.push_back(len); | 352 | 1.23k | ret.length.push_back(len); | 353 | 1.23k | } | 354 | | | 355 | 412 | auto neq = [](const auto& a, const auto& b) { return a != b; }; | 356 | 412 | if (std::ranges::adjacent_find(results, neq) != results.end()) { | 357 | 0 | std::cerr << "begin errormessage for calculate_length\n"; | 358 | 0 | std::cerr << "in fuzz case invoking " << lengthcalcname << " with " | 359 | 0 | << src.size() << " elements with valid input=" << inputisvalid | 360 | 0 | << ":\n"; | 361 | 0 | for (std::size_t i = 0; i < results.size(); ++i) { | 362 | 0 | std::cerr << "got return " << std::dec << results[i] | 363 | 0 | << " from implementation " << implementations[i]->name() | 364 | 0 | << '\n'; | 365 | 0 | } | 366 | 0 | std::cerr << "end errormessage\n"; | 367 | 0 | if (inputisvalid) { | 368 | 0 | ret.implementations_agree = false; | 369 | 0 | } else { | 370 | 0 | std::cerr | 371 | 0 | << "implementations are allowed to disagree on invalid input\n"; | 372 | 0 | ret.implementations_agree = true; | 373 | 0 | } | 374 | 412 | } else { | 375 | 412 | ret.implementations_agree = true; | 376 | 412 | } | 377 | 412 | return ret; | 378 | 412 | } |
Conversion<(UtfEncodings)3, (UtfEncodings)0, unsigned long (simdutf::implementation::*)(char32_t const*, unsigned long) noexcept const, unsigned long (simdutf::implementation::*)(char32_t const*, unsigned long, char16_t*) noexcept const>::calculate_length(std::__1::span<char32_t const, 18446744073709551615ul>, bool) const Line | Count | Source | 342 | 268 | length_result calculate_length(FromSpan src, const bool inputisvalid) const { | 343 | 268 | length_result ret{}; | 344 | | | 345 | 268 | const auto implementations = get_supported_implementations(); | 346 | 268 | std::vector<std::size_t> results; | 347 | 268 | results.reserve(implementations.size()); | 348 | | | 349 | 804 | for (auto impl : implementations) { | 350 | 804 | const auto len = invoke_lengthcalc(impl, src); | 351 | 804 | results.push_back(len); | 352 | 804 | ret.length.push_back(len); | 353 | 804 | } | 354 | | | 355 | 268 | auto neq = [](const auto& a, const auto& b) { return a != b; }; | 356 | 268 | if (std::ranges::adjacent_find(results, neq) != results.end()) { | 357 | 0 | std::cerr << "begin errormessage for calculate_length\n"; | 358 | 0 | std::cerr << "in fuzz case invoking " << lengthcalcname << " with " | 359 | 0 | << src.size() << " elements with valid input=" << inputisvalid | 360 | 0 | << ":\n"; | 361 | 0 | for (std::size_t i = 0; i < results.size(); ++i) { | 362 | 0 | std::cerr << "got return " << std::dec << results[i] | 363 | 0 | << " from implementation " << implementations[i]->name() | 364 | 0 | << '\n'; | 365 | 0 | } | 366 | 0 | std::cerr << "end errormessage\n"; | 367 | 0 | if (inputisvalid) { | 368 | 0 | ret.implementations_agree = false; | 369 | 0 | } else { | 370 | 0 | std::cerr | 371 | 0 | << "implementations are allowed to disagree on invalid input\n"; | 372 | 0 | ret.implementations_agree = true; | 373 | 0 | } | 374 | 268 | } else { | 375 | 268 | ret.implementations_agree = true; | 376 | 268 | } | 377 | 268 | return ret; | 378 | 268 | } |
Conversion<(UtfEncodings)3, (UtfEncodings)1, unsigned long (simdutf::implementation::*)(char32_t const*, unsigned long) noexcept const, unsigned long (simdutf::implementation::*)(char32_t const*, unsigned long, char16_t*) noexcept const>::calculate_length(std::__1::span<char32_t const, 18446744073709551615ul>, bool) const Line | Count | Source | 342 | 366 | length_result calculate_length(FromSpan src, const bool inputisvalid) const { | 343 | 366 | length_result ret{}; | 344 | | | 345 | 366 | const auto implementations = get_supported_implementations(); | 346 | 366 | std::vector<std::size_t> results; | 347 | 366 | results.reserve(implementations.size()); | 348 | | | 349 | 1.09k | for (auto impl : implementations) { | 350 | 1.09k | const auto len = invoke_lengthcalc(impl, src); | 351 | 1.09k | results.push_back(len); | 352 | 1.09k | ret.length.push_back(len); | 353 | 1.09k | } | 354 | | | 355 | 366 | auto neq = [](const auto& a, const auto& b) { return a != b; }; | 356 | 366 | if (std::ranges::adjacent_find(results, neq) != results.end()) { | 357 | 0 | std::cerr << "begin errormessage for calculate_length\n"; | 358 | 0 | std::cerr << "in fuzz case invoking " << lengthcalcname << " with " | 359 | 0 | << src.size() << " elements with valid input=" << inputisvalid | 360 | 0 | << ":\n"; | 361 | 0 | for (std::size_t i = 0; i < results.size(); ++i) { | 362 | 0 | std::cerr << "got return " << std::dec << results[i] | 363 | 0 | << " from implementation " << implementations[i]->name() | 364 | 0 | << '\n'; | 365 | 0 | } | 366 | 0 | std::cerr << "end errormessage\n"; | 367 | 0 | if (inputisvalid) { | 368 | 0 | ret.implementations_agree = false; | 369 | 0 | } else { | 370 | 0 | std::cerr | 371 | 0 | << "implementations are allowed to disagree on invalid input\n"; | 372 | 0 | ret.implementations_agree = true; | 373 | 0 | } | 374 | 366 | } else { | 375 | 366 | ret.implementations_agree = true; | 376 | 366 | } | 377 | 366 | return ret; | 378 | 366 | } |
Conversion<(UtfEncodings)3, (UtfEncodings)2, unsigned long (simdutf::implementation::*)(char32_t const*, unsigned long) noexcept const, unsigned long (simdutf::implementation::*)(char32_t const*, unsigned long, char*) noexcept const>::calculate_length(std::__1::span<char32_t const, 18446744073709551615ul>, bool) const Line | Count | Source | 342 | 404 | length_result calculate_length(FromSpan src, const bool inputisvalid) const { | 343 | 404 | length_result ret{}; | 344 | | | 345 | 404 | const auto implementations = get_supported_implementations(); | 346 | 404 | std::vector<std::size_t> results; | 347 | 404 | results.reserve(implementations.size()); | 348 | | | 349 | 1.21k | for (auto impl : implementations) { | 350 | 1.21k | const auto len = invoke_lengthcalc(impl, src); | 351 | 1.21k | results.push_back(len); | 352 | 1.21k | ret.length.push_back(len); | 353 | 1.21k | } | 354 | | | 355 | 404 | auto neq = [](const auto& a, const auto& b) { return a != b; }; | 356 | 404 | if (std::ranges::adjacent_find(results, neq) != results.end()) { | 357 | 0 | std::cerr << "begin errormessage for calculate_length\n"; | 358 | 0 | std::cerr << "in fuzz case invoking " << lengthcalcname << " with " | 359 | 0 | << src.size() << " elements with valid input=" << inputisvalid | 360 | 0 | << ":\n"; | 361 | 0 | for (std::size_t i = 0; i < results.size(); ++i) { | 362 | 0 | std::cerr << "got return " << std::dec << results[i] | 363 | 0 | << " from implementation " << implementations[i]->name() | 364 | 0 | << '\n'; | 365 | 0 | } | 366 | 0 | std::cerr << "end errormessage\n"; | 367 | 0 | if (inputisvalid) { | 368 | 0 | ret.implementations_agree = false; | 369 | 0 | } else { | 370 | 0 | std::cerr | 371 | 0 | << "implementations are allowed to disagree on invalid input\n"; | 372 | 0 | ret.implementations_agree = true; | 373 | 0 | } | 374 | 404 | } else { | 375 | 404 | ret.implementations_agree = true; | 376 | 404 | } | 377 | 404 | return ret; | 378 | 404 | } |
Conversion<(UtfEncodings)2, (UtfEncodings)0, unsigned long (simdutf::implementation::*)(char const*, unsigned long) noexcept const, unsigned long (simdutf::implementation::*)(char const*, unsigned long, char16_t*) noexcept const>::calculate_length(std::__1::span<char const, 18446744073709551615ul>, bool) const Line | Count | Source | 342 | 584 | length_result calculate_length(FromSpan src, const bool inputisvalid) const { | 343 | 584 | length_result ret{}; | 344 | | | 345 | 584 | const auto implementations = get_supported_implementations(); | 346 | 584 | std::vector<std::size_t> results; | 347 | 584 | results.reserve(implementations.size()); | 348 | | | 349 | 1.75k | for (auto impl : implementations) { | 350 | 1.75k | const auto len = invoke_lengthcalc(impl, src); | 351 | 1.75k | results.push_back(len); | 352 | 1.75k | ret.length.push_back(len); | 353 | 1.75k | } | 354 | | | 355 | 584 | auto neq = [](const auto& a, const auto& b) { return a != b; }; | 356 | 584 | if (std::ranges::adjacent_find(results, neq) != results.end()) { | 357 | 0 | std::cerr << "begin errormessage for calculate_length\n"; | 358 | 0 | std::cerr << "in fuzz case invoking " << lengthcalcname << " with " | 359 | 0 | << src.size() << " elements with valid input=" << inputisvalid | 360 | 0 | << ":\n"; | 361 | 0 | for (std::size_t i = 0; i < results.size(); ++i) { | 362 | 0 | std::cerr << "got return " << std::dec << results[i] | 363 | 0 | << " from implementation " << implementations[i]->name() | 364 | 0 | << '\n'; | 365 | 0 | } | 366 | 0 | std::cerr << "end errormessage\n"; | 367 | 0 | if (inputisvalid) { | 368 | 0 | ret.implementations_agree = false; | 369 | 0 | } else { | 370 | 0 | std::cerr | 371 | 0 | << "implementations are allowed to disagree on invalid input\n"; | 372 | 0 | ret.implementations_agree = true; | 373 | 0 | } | 374 | 584 | } else { | 375 | 584 | ret.implementations_agree = true; | 376 | 584 | } | 377 | 584 | return ret; | 378 | 584 | } |
Conversion<(UtfEncodings)2, (UtfEncodings)1, unsigned long (simdutf::implementation::*)(char const*, unsigned long) noexcept const, unsigned long (simdutf::implementation::*)(char const*, unsigned long, char16_t*) noexcept const>::calculate_length(std::__1::span<char const, 18446744073709551615ul>, bool) const Line | Count | Source | 342 | 527 | length_result calculate_length(FromSpan src, const bool inputisvalid) const { | 343 | 527 | length_result ret{}; | 344 | | | 345 | 527 | const auto implementations = get_supported_implementations(); | 346 | 527 | std::vector<std::size_t> results; | 347 | 527 | results.reserve(implementations.size()); | 348 | | | 349 | 1.58k | for (auto impl : implementations) { | 350 | 1.58k | const auto len = invoke_lengthcalc(impl, src); | 351 | 1.58k | results.push_back(len); | 352 | 1.58k | ret.length.push_back(len); | 353 | 1.58k | } | 354 | | | 355 | 527 | auto neq = [](const auto& a, const auto& b) { return a != b; }; | 356 | 527 | if (std::ranges::adjacent_find(results, neq) != results.end()) { | 357 | 0 | std::cerr << "begin errormessage for calculate_length\n"; | 358 | 0 | std::cerr << "in fuzz case invoking " << lengthcalcname << " with " | 359 | 0 | << src.size() << " elements with valid input=" << inputisvalid | 360 | 0 | << ":\n"; | 361 | 0 | for (std::size_t i = 0; i < results.size(); ++i) { | 362 | 0 | std::cerr << "got return " << std::dec << results[i] | 363 | 0 | << " from implementation " << implementations[i]->name() | 364 | 0 | << '\n'; | 365 | 0 | } | 366 | 0 | std::cerr << "end errormessage\n"; | 367 | 0 | if (inputisvalid) { | 368 | 0 | ret.implementations_agree = false; | 369 | 0 | } else { | 370 | 0 | std::cerr | 371 | 0 | << "implementations are allowed to disagree on invalid input\n"; | 372 | 0 | ret.implementations_agree = true; | 373 | 0 | } | 374 | 527 | } else { | 375 | 527 | ret.implementations_agree = true; | 376 | 527 | } | 377 | 527 | return ret; | 378 | 527 | } |
Conversion<(UtfEncodings)2, (UtfEncodings)3, unsigned long (simdutf::implementation::*)(char const*, unsigned long) noexcept const, unsigned long (simdutf::implementation::*)(char const*, unsigned long, char32_t*) noexcept const>::calculate_length(std::__1::span<char const, 18446744073709551615ul>, bool) const Line | Count | Source | 342 | 564 | length_result calculate_length(FromSpan src, const bool inputisvalid) const { | 343 | 564 | length_result ret{}; | 344 | | | 345 | 564 | const auto implementations = get_supported_implementations(); | 346 | 564 | std::vector<std::size_t> results; | 347 | 564 | results.reserve(implementations.size()); | 348 | | | 349 | 1.69k | for (auto impl : implementations) { | 350 | 1.69k | const auto len = invoke_lengthcalc(impl, src); | 351 | 1.69k | results.push_back(len); | 352 | 1.69k | ret.length.push_back(len); | 353 | 1.69k | } | 354 | | | 355 | 564 | auto neq = [](const auto& a, const auto& b) { return a != b; }; | 356 | 564 | if (std::ranges::adjacent_find(results, neq) != results.end()) { | 357 | 0 | std::cerr << "begin errormessage for calculate_length\n"; | 358 | 0 | std::cerr << "in fuzz case invoking " << lengthcalcname << " with " | 359 | 0 | << src.size() << " elements with valid input=" << inputisvalid | 360 | 0 | << ":\n"; | 361 | 0 | for (std::size_t i = 0; i < results.size(); ++i) { | 362 | 0 | std::cerr << "got return " << std::dec << results[i] | 363 | 0 | << " from implementation " << implementations[i]->name() | 364 | 0 | << '\n'; | 365 | 0 | } | 366 | 0 | std::cerr << "end errormessage\n"; | 367 | 0 | if (inputisvalid) { | 368 | 0 | ret.implementations_agree = false; | 369 | 0 | } else { | 370 | 0 | std::cerr | 371 | 0 | << "implementations are allowed to disagree on invalid input\n"; | 372 | 0 | ret.implementations_agree = true; | 373 | 0 | } | 374 | 564 | } else { | 375 | 564 | ret.implementations_agree = true; | 376 | 564 | } | 377 | 564 | return ret; | 378 | 564 | } |
Conversion<(UtfEncodings)0, (UtfEncodings)4, unsigned long (simdutf::implementation::*)(unsigned long) noexcept const, unsigned long (simdutf::implementation::*)(char16_t const*, unsigned long, char*) noexcept const>::calculate_length(std::__1::span<char16_t const, 18446744073709551615ul>, bool) const Line | Count | Source | 342 | 63 | length_result calculate_length(FromSpan src, const bool inputisvalid) const { | 343 | 63 | length_result ret{}; | 344 | | | 345 | 63 | const auto implementations = get_supported_implementations(); | 346 | 63 | std::vector<std::size_t> results; | 347 | 63 | results.reserve(implementations.size()); | 348 | | | 349 | 189 | for (auto impl : implementations) { | 350 | 189 | const auto len = invoke_lengthcalc(impl, src); | 351 | 189 | results.push_back(len); | 352 | 189 | ret.length.push_back(len); | 353 | 189 | } | 354 | | | 355 | 63 | auto neq = [](const auto& a, const auto& b) { return a != b; }; | 356 | 63 | if (std::ranges::adjacent_find(results, neq) != results.end()) { | 357 | 0 | std::cerr << "begin errormessage for calculate_length\n"; | 358 | 0 | std::cerr << "in fuzz case invoking " << lengthcalcname << " with " | 359 | 0 | << src.size() << " elements with valid input=" << inputisvalid | 360 | 0 | << ":\n"; | 361 | 0 | for (std::size_t i = 0; i < results.size(); ++i) { | 362 | 0 | std::cerr << "got return " << std::dec << results[i] | 363 | 0 | << " from implementation " << implementations[i]->name() | 364 | 0 | << '\n'; | 365 | 0 | } | 366 | 0 | std::cerr << "end errormessage\n"; | 367 | 0 | if (inputisvalid) { | 368 | 0 | ret.implementations_agree = false; | 369 | 0 | } else { | 370 | 0 | std::cerr | 371 | 0 | << "implementations are allowed to disagree on invalid input\n"; | 372 | 0 | ret.implementations_agree = true; | 373 | 0 | } | 374 | 63 | } else { | 375 | 63 | ret.implementations_agree = true; | 376 | 63 | } | 377 | 63 | return ret; | 378 | 63 | } |
Conversion<(UtfEncodings)1, (UtfEncodings)4, unsigned long (simdutf::implementation::*)(unsigned long) noexcept const, unsigned long (simdutf::implementation::*)(char16_t const*, unsigned long, char*) noexcept const>::calculate_length(std::__1::span<char16_t const, 18446744073709551615ul>, bool) const Line | Count | Source | 342 | 62 | length_result calculate_length(FromSpan src, const bool inputisvalid) const { | 343 | 62 | length_result ret{}; | 344 | | | 345 | 62 | const auto implementations = get_supported_implementations(); | 346 | 62 | std::vector<std::size_t> results; | 347 | 62 | results.reserve(implementations.size()); | 348 | | | 349 | 186 | for (auto impl : implementations) { | 350 | 186 | const auto len = invoke_lengthcalc(impl, src); | 351 | 186 | results.push_back(len); | 352 | 186 | ret.length.push_back(len); | 353 | 186 | } | 354 | | | 355 | 62 | auto neq = [](const auto& a, const auto& b) { return a != b; }; | 356 | 62 | if (std::ranges::adjacent_find(results, neq) != results.end()) { | 357 | 0 | std::cerr << "begin errormessage for calculate_length\n"; | 358 | 0 | std::cerr << "in fuzz case invoking " << lengthcalcname << " with " | 359 | 0 | << src.size() << " elements with valid input=" << inputisvalid | 360 | 0 | << ":\n"; | 361 | 0 | for (std::size_t i = 0; i < results.size(); ++i) { | 362 | 0 | std::cerr << "got return " << std::dec << results[i] | 363 | 0 | << " from implementation " << implementations[i]->name() | 364 | 0 | << '\n'; | 365 | 0 | } | 366 | 0 | std::cerr << "end errormessage\n"; | 367 | 0 | if (inputisvalid) { | 368 | 0 | ret.implementations_agree = false; | 369 | 0 | } else { | 370 | 0 | std::cerr | 371 | 0 | << "implementations are allowed to disagree on invalid input\n"; | 372 | 0 | ret.implementations_agree = true; | 373 | 0 | } | 374 | 62 | } else { | 375 | 62 | ret.implementations_agree = true; | 376 | 62 | } | 377 | 62 | return ret; | 378 | 62 | } |
Conversion<(UtfEncodings)3, (UtfEncodings)4, unsigned long (simdutf::implementation::*)(unsigned long) noexcept const, unsigned long (simdutf::implementation::*)(char32_t const*, unsigned long, char*) noexcept const>::calculate_length(std::__1::span<char32_t const, 18446744073709551615ul>, bool) const Line | Count | Source | 342 | 94 | length_result calculate_length(FromSpan src, const bool inputisvalid) const { | 343 | 94 | length_result ret{}; | 344 | | | 345 | 94 | const auto implementations = get_supported_implementations(); | 346 | 94 | std::vector<std::size_t> results; | 347 | 94 | results.reserve(implementations.size()); | 348 | | | 349 | 282 | for (auto impl : implementations) { | 350 | 282 | const auto len = invoke_lengthcalc(impl, src); | 351 | 282 | results.push_back(len); | 352 | 282 | ret.length.push_back(len); | 353 | 282 | } | 354 | | | 355 | 94 | auto neq = [](const auto& a, const auto& b) { return a != b; }; | 356 | 94 | if (std::ranges::adjacent_find(results, neq) != results.end()) { | 357 | 0 | std::cerr << "begin errormessage for calculate_length\n"; | 358 | 0 | std::cerr << "in fuzz case invoking " << lengthcalcname << " with " | 359 | 0 | << src.size() << " elements with valid input=" << inputisvalid | 360 | 0 | << ":\n"; | 361 | 0 | for (std::size_t i = 0; i < results.size(); ++i) { | 362 | 0 | std::cerr << "got return " << std::dec << results[i] | 363 | 0 | << " from implementation " << implementations[i]->name() | 364 | 0 | << '\n'; | 365 | 0 | } | 366 | 0 | std::cerr << "end errormessage\n"; | 367 | 0 | if (inputisvalid) { | 368 | 0 | ret.implementations_agree = false; | 369 | 0 | } else { | 370 | 0 | std::cerr | 371 | 0 | << "implementations are allowed to disagree on invalid input\n"; | 372 | 0 | ret.implementations_agree = true; | 373 | 0 | } | 374 | 94 | } else { | 375 | 94 | ret.implementations_agree = true; | 376 | 94 | } | 377 | 94 | return ret; | 378 | 94 | } |
Conversion<(UtfEncodings)2, (UtfEncodings)4, unsigned long (simdutf::implementation::*)(char const*, unsigned long) noexcept const, unsigned long (simdutf::implementation::*)(char const*, unsigned long, char*) noexcept const>::calculate_length(std::__1::span<char const, 18446744073709551615ul>, bool) const Line | Count | Source | 342 | 281 | length_result calculate_length(FromSpan src, const bool inputisvalid) const { | 343 | 281 | length_result ret{}; | 344 | | | 345 | 281 | const auto implementations = get_supported_implementations(); | 346 | 281 | std::vector<std::size_t> results; | 347 | 281 | results.reserve(implementations.size()); | 348 | | | 349 | 843 | for (auto impl : implementations) { | 350 | 843 | const auto len = invoke_lengthcalc(impl, src); | 351 | 843 | results.push_back(len); | 352 | 843 | ret.length.push_back(len); | 353 | 843 | } | 354 | | | 355 | 281 | auto neq = [](const auto& a, const auto& b) { return a != b; }; | 356 | 281 | if (std::ranges::adjacent_find(results, neq) != results.end()) { | 357 | 0 | std::cerr << "begin errormessage for calculate_length\n"; | 358 | 0 | std::cerr << "in fuzz case invoking " << lengthcalcname << " with " | 359 | 0 | << src.size() << " elements with valid input=" << inputisvalid | 360 | 0 | << ":\n"; | 361 | 0 | for (std::size_t i = 0; i < results.size(); ++i) { | 362 | 0 | std::cerr << "got return " << std::dec << results[i] | 363 | 0 | << " from implementation " << implementations[i]->name() | 364 | 0 | << '\n'; | 365 | 0 | } | 366 | 0 | std::cerr << "end errormessage\n"; | 367 | 0 | if (inputisvalid) { | 368 | 0 | ret.implementations_agree = false; | 369 | 0 | } else { | 370 | 0 | std::cerr | 371 | 0 | << "implementations are allowed to disagree on invalid input\n"; | 372 | 0 | ret.implementations_agree = true; | 373 | 0 | } | 374 | 281 | } else { | 375 | 281 | ret.implementations_agree = true; | 376 | 281 | } | 377 | 281 | return ret; | 378 | 281 | } |
Conversion<(UtfEncodings)0, (UtfEncodings)4, unsigned long (simdutf::implementation::*)(unsigned long) noexcept const, simdutf::result (simdutf::implementation::*)(char16_t const*, unsigned long, char*) noexcept const>::calculate_length(std::__1::span<char16_t const, 18446744073709551615ul>, bool) const Line | Count | Source | 342 | 126 | length_result calculate_length(FromSpan src, const bool inputisvalid) const { | 343 | 126 | length_result ret{}; | 344 | | | 345 | 126 | const auto implementations = get_supported_implementations(); | 346 | 126 | std::vector<std::size_t> results; | 347 | 126 | results.reserve(implementations.size()); | 348 | | | 349 | 378 | for (auto impl : implementations) { | 350 | 378 | const auto len = invoke_lengthcalc(impl, src); | 351 | 378 | results.push_back(len); | 352 | 378 | ret.length.push_back(len); | 353 | 378 | } | 354 | | | 355 | 126 | auto neq = [](const auto& a, const auto& b) { return a != b; }; | 356 | 126 | if (std::ranges::adjacent_find(results, neq) != results.end()) { | 357 | 0 | std::cerr << "begin errormessage for calculate_length\n"; | 358 | 0 | std::cerr << "in fuzz case invoking " << lengthcalcname << " with " | 359 | 0 | << src.size() << " elements with valid input=" << inputisvalid | 360 | 0 | << ":\n"; | 361 | 0 | for (std::size_t i = 0; i < results.size(); ++i) { | 362 | 0 | std::cerr << "got return " << std::dec << results[i] | 363 | 0 | << " from implementation " << implementations[i]->name() | 364 | 0 | << '\n'; | 365 | 0 | } | 366 | 0 | std::cerr << "end errormessage\n"; | 367 | 0 | if (inputisvalid) { | 368 | 0 | ret.implementations_agree = false; | 369 | 0 | } else { | 370 | 0 | std::cerr | 371 | 0 | << "implementations are allowed to disagree on invalid input\n"; | 372 | 0 | ret.implementations_agree = true; | 373 | 0 | } | 374 | 126 | } else { | 375 | 126 | ret.implementations_agree = true; | 376 | 126 | } | 377 | 126 | return ret; | 378 | 126 | } |
Conversion<(UtfEncodings)0, (UtfEncodings)3, unsigned long (simdutf::implementation::*)(char16_t const*, unsigned long) noexcept const, simdutf::result (simdutf::implementation::*)(char16_t const*, unsigned long, char32_t*) noexcept const>::calculate_length(std::__1::span<char16_t const, 18446744073709551615ul>, bool) const Line | Count | Source | 342 | 150 | length_result calculate_length(FromSpan src, const bool inputisvalid) const { | 343 | 150 | length_result ret{}; | 344 | | | 345 | 150 | const auto implementations = get_supported_implementations(); | 346 | 150 | std::vector<std::size_t> results; | 347 | 150 | results.reserve(implementations.size()); | 348 | | | 349 | 450 | for (auto impl : implementations) { | 350 | 450 | const auto len = invoke_lengthcalc(impl, src); | 351 | 450 | results.push_back(len); | 352 | 450 | ret.length.push_back(len); | 353 | 450 | } | 354 | | | 355 | 150 | auto neq = [](const auto& a, const auto& b) { return a != b; }; | 356 | 150 | if (std::ranges::adjacent_find(results, neq) != results.end()) { | 357 | 0 | std::cerr << "begin errormessage for calculate_length\n"; | 358 | 0 | std::cerr << "in fuzz case invoking " << lengthcalcname << " with " | 359 | 0 | << src.size() << " elements with valid input=" << inputisvalid | 360 | 0 | << ":\n"; | 361 | 0 | for (std::size_t i = 0; i < results.size(); ++i) { | 362 | 0 | std::cerr << "got return " << std::dec << results[i] | 363 | 0 | << " from implementation " << implementations[i]->name() | 364 | 0 | << '\n'; | 365 | 0 | } | 366 | 0 | std::cerr << "end errormessage\n"; | 367 | 0 | if (inputisvalid) { | 368 | 0 | ret.implementations_agree = false; | 369 | 0 | } else { | 370 | 0 | std::cerr | 371 | 0 | << "implementations are allowed to disagree on invalid input\n"; | 372 | 0 | ret.implementations_agree = true; | 373 | 0 | } | 374 | 150 | } else { | 375 | 150 | ret.implementations_agree = true; | 376 | 150 | } | 377 | 150 | return ret; | 378 | 150 | } |
Conversion<(UtfEncodings)0, (UtfEncodings)2, unsigned long (simdutf::implementation::*)(char16_t const*, unsigned long) noexcept const, simdutf::result (simdutf::implementation::*)(char16_t const*, unsigned long, char*) noexcept const>::calculate_length(std::__1::span<char16_t const, 18446744073709551615ul>, bool) const Line | Count | Source | 342 | 293 | length_result calculate_length(FromSpan src, const bool inputisvalid) const { | 343 | 293 | length_result ret{}; | 344 | | | 345 | 293 | const auto implementations = get_supported_implementations(); | 346 | 293 | std::vector<std::size_t> results; | 347 | 293 | results.reserve(implementations.size()); | 348 | | | 349 | 879 | for (auto impl : implementations) { | 350 | 879 | const auto len = invoke_lengthcalc(impl, src); | 351 | 879 | results.push_back(len); | 352 | 879 | ret.length.push_back(len); | 353 | 879 | } | 354 | | | 355 | 293 | auto neq = [](const auto& a, const auto& b) { return a != b; }; | 356 | 293 | if (std::ranges::adjacent_find(results, neq) != results.end()) { | 357 | 0 | std::cerr << "begin errormessage for calculate_length\n"; | 358 | 0 | std::cerr << "in fuzz case invoking " << lengthcalcname << " with " | 359 | 0 | << src.size() << " elements with valid input=" << inputisvalid | 360 | 0 | << ":\n"; | 361 | 0 | for (std::size_t i = 0; i < results.size(); ++i) { | 362 | 0 | std::cerr << "got return " << std::dec << results[i] | 363 | 0 | << " from implementation " << implementations[i]->name() | 364 | 0 | << '\n'; | 365 | 0 | } | 366 | 0 | std::cerr << "end errormessage\n"; | 367 | 0 | if (inputisvalid) { | 368 | 0 | ret.implementations_agree = false; | 369 | 0 | } else { | 370 | 0 | std::cerr | 371 | 0 | << "implementations are allowed to disagree on invalid input\n"; | 372 | 0 | ret.implementations_agree = true; | 373 | 0 | } | 374 | 293 | } else { | 375 | 293 | ret.implementations_agree = true; | 376 | 293 | } | 377 | 293 | return ret; | 378 | 293 | } |
Conversion<(UtfEncodings)1, (UtfEncodings)4, unsigned long (simdutf::implementation::*)(unsigned long) noexcept const, simdutf::result (simdutf::implementation::*)(char16_t const*, unsigned long, char*) noexcept const>::calculate_length(std::__1::span<char16_t const, 18446744073709551615ul>, bool) const Line | Count | Source | 342 | 115 | length_result calculate_length(FromSpan src, const bool inputisvalid) const { | 343 | 115 | length_result ret{}; | 344 | | | 345 | 115 | const auto implementations = get_supported_implementations(); | 346 | 115 | std::vector<std::size_t> results; | 347 | 115 | results.reserve(implementations.size()); | 348 | | | 349 | 345 | for (auto impl : implementations) { | 350 | 345 | const auto len = invoke_lengthcalc(impl, src); | 351 | 345 | results.push_back(len); | 352 | 345 | ret.length.push_back(len); | 353 | 345 | } | 354 | | | 355 | 115 | auto neq = [](const auto& a, const auto& b) { return a != b; }; | 356 | 115 | if (std::ranges::adjacent_find(results, neq) != results.end()) { | 357 | 0 | std::cerr << "begin errormessage for calculate_length\n"; | 358 | 0 | std::cerr << "in fuzz case invoking " << lengthcalcname << " with " | 359 | 0 | << src.size() << " elements with valid input=" << inputisvalid | 360 | 0 | << ":\n"; | 361 | 0 | for (std::size_t i = 0; i < results.size(); ++i) { | 362 | 0 | std::cerr << "got return " << std::dec << results[i] | 363 | 0 | << " from implementation " << implementations[i]->name() | 364 | 0 | << '\n'; | 365 | 0 | } | 366 | 0 | std::cerr << "end errormessage\n"; | 367 | 0 | if (inputisvalid) { | 368 | 0 | ret.implementations_agree = false; | 369 | 0 | } else { | 370 | 0 | std::cerr | 371 | 0 | << "implementations are allowed to disagree on invalid input\n"; | 372 | 0 | ret.implementations_agree = true; | 373 | 0 | } | 374 | 115 | } else { | 375 | 115 | ret.implementations_agree = true; | 376 | 115 | } | 377 | 115 | return ret; | 378 | 115 | } |
Conversion<(UtfEncodings)1, (UtfEncodings)3, unsigned long (simdutf::implementation::*)(char16_t const*, unsigned long) noexcept const, simdutf::result (simdutf::implementation::*)(char16_t const*, unsigned long, char32_t*) noexcept const>::calculate_length(std::__1::span<char16_t const, 18446744073709551615ul>, bool) const Line | Count | Source | 342 | 207 | length_result calculate_length(FromSpan src, const bool inputisvalid) const { | 343 | 207 | length_result ret{}; | 344 | | | 345 | 207 | const auto implementations = get_supported_implementations(); | 346 | 207 | std::vector<std::size_t> results; | 347 | 207 | results.reserve(implementations.size()); | 348 | | | 349 | 621 | for (auto impl : implementations) { | 350 | 621 | const auto len = invoke_lengthcalc(impl, src); | 351 | 621 | results.push_back(len); | 352 | 621 | ret.length.push_back(len); | 353 | 621 | } | 354 | | | 355 | 207 | auto neq = [](const auto& a, const auto& b) { return a != b; }; | 356 | 207 | if (std::ranges::adjacent_find(results, neq) != results.end()) { | 357 | 0 | std::cerr << "begin errormessage for calculate_length\n"; | 358 | 0 | std::cerr << "in fuzz case invoking " << lengthcalcname << " with " | 359 | 0 | << src.size() << " elements with valid input=" << inputisvalid | 360 | 0 | << ":\n"; | 361 | 0 | for (std::size_t i = 0; i < results.size(); ++i) { | 362 | 0 | std::cerr << "got return " << std::dec << results[i] | 363 | 0 | << " from implementation " << implementations[i]->name() | 364 | 0 | << '\n'; | 365 | 0 | } | 366 | 0 | std::cerr << "end errormessage\n"; | 367 | 0 | if (inputisvalid) { | 368 | 0 | ret.implementations_agree = false; | 369 | 0 | } else { | 370 | 0 | std::cerr | 371 | 0 | << "implementations are allowed to disagree on invalid input\n"; | 372 | 0 | ret.implementations_agree = true; | 373 | 0 | } | 374 | 207 | } else { | 375 | 207 | ret.implementations_agree = true; | 376 | 207 | } | 377 | 207 | return ret; | 378 | 207 | } |
Conversion<(UtfEncodings)1, (UtfEncodings)2, unsigned long (simdutf::implementation::*)(char16_t const*, unsigned long) noexcept const, simdutf::result (simdutf::implementation::*)(char16_t const*, unsigned long, char*) noexcept const>::calculate_length(std::__1::span<char16_t const, 18446744073709551615ul>, bool) const Line | Count | Source | 342 | 315 | length_result calculate_length(FromSpan src, const bool inputisvalid) const { | 343 | 315 | length_result ret{}; | 344 | | | 345 | 315 | const auto implementations = get_supported_implementations(); | 346 | 315 | std::vector<std::size_t> results; | 347 | 315 | results.reserve(implementations.size()); | 348 | | | 349 | 945 | for (auto impl : implementations) { | 350 | 945 | const auto len = invoke_lengthcalc(impl, src); | 351 | 945 | results.push_back(len); | 352 | 945 | ret.length.push_back(len); | 353 | 945 | } | 354 | | | 355 | 315 | auto neq = [](const auto& a, const auto& b) { return a != b; }; | 356 | 315 | if (std::ranges::adjacent_find(results, neq) != results.end()) { | 357 | 0 | std::cerr << "begin errormessage for calculate_length\n"; | 358 | 0 | std::cerr << "in fuzz case invoking " << lengthcalcname << " with " | 359 | 0 | << src.size() << " elements with valid input=" << inputisvalid | 360 | 0 | << ":\n"; | 361 | 0 | for (std::size_t i = 0; i < results.size(); ++i) { | 362 | 0 | std::cerr << "got return " << std::dec << results[i] | 363 | 0 | << " from implementation " << implementations[i]->name() | 364 | 0 | << '\n'; | 365 | 0 | } | 366 | 0 | std::cerr << "end errormessage\n"; | 367 | 0 | if (inputisvalid) { | 368 | 0 | ret.implementations_agree = false; | 369 | 0 | } else { | 370 | 0 | std::cerr | 371 | 0 | << "implementations are allowed to disagree on invalid input\n"; | 372 | 0 | ret.implementations_agree = true; | 373 | 0 | } | 374 | 315 | } else { | 375 | 315 | ret.implementations_agree = true; | 376 | 315 | } | 377 | 315 | return ret; | 378 | 315 | } |
Conversion<(UtfEncodings)3, (UtfEncodings)4, unsigned long (simdutf::implementation::*)(unsigned long) noexcept const, simdutf::result (simdutf::implementation::*)(char32_t const*, unsigned long, char*) noexcept const>::calculate_length(std::__1::span<char32_t const, 18446744073709551615ul>, bool) const Line | Count | Source | 342 | 210 | length_result calculate_length(FromSpan src, const bool inputisvalid) const { | 343 | 210 | length_result ret{}; | 344 | | | 345 | 210 | const auto implementations = get_supported_implementations(); | 346 | 210 | std::vector<std::size_t> results; | 347 | 210 | results.reserve(implementations.size()); | 348 | | | 349 | 630 | for (auto impl : implementations) { | 350 | 630 | const auto len = invoke_lengthcalc(impl, src); | 351 | 630 | results.push_back(len); | 352 | 630 | ret.length.push_back(len); | 353 | 630 | } | 354 | | | 355 | 210 | auto neq = [](const auto& a, const auto& b) { return a != b; }; | 356 | 210 | if (std::ranges::adjacent_find(results, neq) != results.end()) { | 357 | 0 | std::cerr << "begin errormessage for calculate_length\n"; | 358 | 0 | std::cerr << "in fuzz case invoking " << lengthcalcname << " with " | 359 | 0 | << src.size() << " elements with valid input=" << inputisvalid | 360 | 0 | << ":\n"; | 361 | 0 | for (std::size_t i = 0; i < results.size(); ++i) { | 362 | 0 | std::cerr << "got return " << std::dec << results[i] | 363 | 0 | << " from implementation " << implementations[i]->name() | 364 | 0 | << '\n'; | 365 | 0 | } | 366 | 0 | std::cerr << "end errormessage\n"; | 367 | 0 | if (inputisvalid) { | 368 | 0 | ret.implementations_agree = false; | 369 | 0 | } else { | 370 | 0 | std::cerr | 371 | 0 | << "implementations are allowed to disagree on invalid input\n"; | 372 | 0 | ret.implementations_agree = true; | 373 | 0 | } | 374 | 210 | } else { | 375 | 210 | ret.implementations_agree = true; | 376 | 210 | } | 377 | 210 | return ret; | 378 | 210 | } |
Conversion<(UtfEncodings)3, (UtfEncodings)0, unsigned long (simdutf::implementation::*)(char32_t const*, unsigned long) noexcept const, simdutf::result (simdutf::implementation::*)(char32_t const*, unsigned long, char16_t*) noexcept const>::calculate_length(std::__1::span<char32_t const, 18446744073709551615ul>, bool) const Line | Count | Source | 342 | 303 | length_result calculate_length(FromSpan src, const bool inputisvalid) const { | 343 | 303 | length_result ret{}; | 344 | | | 345 | 303 | const auto implementations = get_supported_implementations(); | 346 | 303 | std::vector<std::size_t> results; | 347 | 303 | results.reserve(implementations.size()); | 348 | | | 349 | 909 | for (auto impl : implementations) { | 350 | 909 | const auto len = invoke_lengthcalc(impl, src); | 351 | 909 | results.push_back(len); | 352 | 909 | ret.length.push_back(len); | 353 | 909 | } | 354 | | | 355 | 303 | auto neq = [](const auto& a, const auto& b) { return a != b; }; | 356 | 303 | if (std::ranges::adjacent_find(results, neq) != results.end()) { | 357 | 0 | std::cerr << "begin errormessage for calculate_length\n"; | 358 | 0 | std::cerr << "in fuzz case invoking " << lengthcalcname << " with " | 359 | 0 | << src.size() << " elements with valid input=" << inputisvalid | 360 | 0 | << ":\n"; | 361 | 0 | for (std::size_t i = 0; i < results.size(); ++i) { | 362 | 0 | std::cerr << "got return " << std::dec << results[i] | 363 | 0 | << " from implementation " << implementations[i]->name() | 364 | 0 | << '\n'; | 365 | 0 | } | 366 | 0 | std::cerr << "end errormessage\n"; | 367 | 0 | if (inputisvalid) { | 368 | 0 | ret.implementations_agree = false; | 369 | 0 | } else { | 370 | 0 | std::cerr | 371 | 0 | << "implementations are allowed to disagree on invalid input\n"; | 372 | 0 | ret.implementations_agree = true; | 373 | 0 | } | 374 | 303 | } else { | 375 | 303 | ret.implementations_agree = true; | 376 | 303 | } | 377 | 303 | return ret; | 378 | 303 | } |
Conversion<(UtfEncodings)3, (UtfEncodings)1, unsigned long (simdutf::implementation::*)(char32_t const*, unsigned long) noexcept const, simdutf::result (simdutf::implementation::*)(char32_t const*, unsigned long, char16_t*) noexcept const>::calculate_length(std::__1::span<char32_t const, 18446744073709551615ul>, bool) const Line | Count | Source | 342 | 358 | length_result calculate_length(FromSpan src, const bool inputisvalid) const { | 343 | 358 | length_result ret{}; | 344 | | | 345 | 358 | const auto implementations = get_supported_implementations(); | 346 | 358 | std::vector<std::size_t> results; | 347 | 358 | results.reserve(implementations.size()); | 348 | | | 349 | 1.07k | for (auto impl : implementations) { | 350 | 1.07k | const auto len = invoke_lengthcalc(impl, src); | 351 | 1.07k | results.push_back(len); | 352 | 1.07k | ret.length.push_back(len); | 353 | 1.07k | } | 354 | | | 355 | 358 | auto neq = [](const auto& a, const auto& b) { return a != b; }; | 356 | 358 | if (std::ranges::adjacent_find(results, neq) != results.end()) { | 357 | 0 | std::cerr << "begin errormessage for calculate_length\n"; | 358 | 0 | std::cerr << "in fuzz case invoking " << lengthcalcname << " with " | 359 | 0 | << src.size() << " elements with valid input=" << inputisvalid | 360 | 0 | << ":\n"; | 361 | 0 | for (std::size_t i = 0; i < results.size(); ++i) { | 362 | 0 | std::cerr << "got return " << std::dec << results[i] | 363 | 0 | << " from implementation " << implementations[i]->name() | 364 | 0 | << '\n'; | 365 | 0 | } | 366 | 0 | std::cerr << "end errormessage\n"; | 367 | 0 | if (inputisvalid) { | 368 | 0 | ret.implementations_agree = false; | 369 | 0 | } else { | 370 | 0 | std::cerr | 371 | 0 | << "implementations are allowed to disagree on invalid input\n"; | 372 | 0 | ret.implementations_agree = true; | 373 | 0 | } | 374 | 358 | } else { | 375 | 358 | ret.implementations_agree = true; | 376 | 358 | } | 377 | 358 | return ret; | 378 | 358 | } |
Conversion<(UtfEncodings)3, (UtfEncodings)2, unsigned long (simdutf::implementation::*)(char32_t const*, unsigned long) noexcept const, simdutf::result (simdutf::implementation::*)(char32_t const*, unsigned long, char*) noexcept const>::calculate_length(std::__1::span<char32_t const, 18446744073709551615ul>, bool) const Line | Count | Source | 342 | 415 | length_result calculate_length(FromSpan src, const bool inputisvalid) const { | 343 | 415 | length_result ret{}; | 344 | | | 345 | 415 | const auto implementations = get_supported_implementations(); | 346 | 415 | std::vector<std::size_t> results; | 347 | 415 | results.reserve(implementations.size()); | 348 | | | 349 | 1.24k | for (auto impl : implementations) { | 350 | 1.24k | const auto len = invoke_lengthcalc(impl, src); | 351 | 1.24k | results.push_back(len); | 352 | 1.24k | ret.length.push_back(len); | 353 | 1.24k | } | 354 | | | 355 | 415 | auto neq = [](const auto& a, const auto& b) { return a != b; }; | 356 | 415 | if (std::ranges::adjacent_find(results, neq) != results.end()) { | 357 | 0 | std::cerr << "begin errormessage for calculate_length\n"; | 358 | 0 | std::cerr << "in fuzz case invoking " << lengthcalcname << " with " | 359 | 0 | << src.size() << " elements with valid input=" << inputisvalid | 360 | 0 | << ":\n"; | 361 | 0 | for (std::size_t i = 0; i < results.size(); ++i) { | 362 | 0 | std::cerr << "got return " << std::dec << results[i] | 363 | 0 | << " from implementation " << implementations[i]->name() | 364 | 0 | << '\n'; | 365 | 0 | } | 366 | 0 | std::cerr << "end errormessage\n"; | 367 | 0 | if (inputisvalid) { | 368 | 0 | ret.implementations_agree = false; | 369 | 0 | } else { | 370 | 0 | std::cerr | 371 | 0 | << "implementations are allowed to disagree on invalid input\n"; | 372 | 0 | ret.implementations_agree = true; | 373 | 0 | } | 374 | 415 | } else { | 375 | 415 | ret.implementations_agree = true; | 376 | 415 | } | 377 | 415 | return ret; | 378 | 415 | } |
Conversion<(UtfEncodings)2, (UtfEncodings)4, unsigned long (simdutf::implementation::*)(char const*, unsigned long) noexcept const, simdutf::result (simdutf::implementation::*)(char const*, unsigned long, char*) noexcept const>::calculate_length(std::__1::span<char const, 18446744073709551615ul>, bool) const Line | Count | Source | 342 | 258 | length_result calculate_length(FromSpan src, const bool inputisvalid) const { | 343 | 258 | length_result ret{}; | 344 | | | 345 | 258 | const auto implementations = get_supported_implementations(); | 346 | 258 | std::vector<std::size_t> results; | 347 | 258 | results.reserve(implementations.size()); | 348 | | | 349 | 774 | for (auto impl : implementations) { | 350 | 774 | const auto len = invoke_lengthcalc(impl, src); | 351 | 774 | results.push_back(len); | 352 | 774 | ret.length.push_back(len); | 353 | 774 | } | 354 | | | 355 | 258 | auto neq = [](const auto& a, const auto& b) { return a != b; }; | 356 | 258 | if (std::ranges::adjacent_find(results, neq) != results.end()) { | 357 | 0 | std::cerr << "begin errormessage for calculate_length\n"; | 358 | 0 | std::cerr << "in fuzz case invoking " << lengthcalcname << " with " | 359 | 0 | << src.size() << " elements with valid input=" << inputisvalid | 360 | 0 | << ":\n"; | 361 | 0 | for (std::size_t i = 0; i < results.size(); ++i) { | 362 | 0 | std::cerr << "got return " << std::dec << results[i] | 363 | 0 | << " from implementation " << implementations[i]->name() | 364 | 0 | << '\n'; | 365 | 0 | } | 366 | 0 | std::cerr << "end errormessage\n"; | 367 | 0 | if (inputisvalid) { | 368 | 0 | ret.implementations_agree = false; | 369 | 0 | } else { | 370 | 0 | std::cerr | 371 | 0 | << "implementations are allowed to disagree on invalid input\n"; | 372 | 0 | ret.implementations_agree = true; | 373 | 0 | } | 374 | 258 | } else { | 375 | 258 | ret.implementations_agree = true; | 376 | 258 | } | 377 | 258 | return ret; | 378 | 258 | } |
Conversion<(UtfEncodings)2, (UtfEncodings)0, unsigned long (simdutf::implementation::*)(char const*, unsigned long) noexcept const, simdutf::result (simdutf::implementation::*)(char const*, unsigned long, char16_t*) noexcept const>::calculate_length(std::__1::span<char const, 18446744073709551615ul>, bool) const Line | Count | Source | 342 | 351 | length_result calculate_length(FromSpan src, const bool inputisvalid) const { | 343 | 351 | length_result ret{}; | 344 | | | 345 | 351 | const auto implementations = get_supported_implementations(); | 346 | 351 | std::vector<std::size_t> results; | 347 | 351 | results.reserve(implementations.size()); | 348 | | | 349 | 1.05k | for (auto impl : implementations) { | 350 | 1.05k | const auto len = invoke_lengthcalc(impl, src); | 351 | 1.05k | results.push_back(len); | 352 | 1.05k | ret.length.push_back(len); | 353 | 1.05k | } | 354 | | | 355 | 351 | auto neq = [](const auto& a, const auto& b) { return a != b; }; | 356 | 351 | if (std::ranges::adjacent_find(results, neq) != results.end()) { | 357 | 0 | std::cerr << "begin errormessage for calculate_length\n"; | 358 | 0 | std::cerr << "in fuzz case invoking " << lengthcalcname << " with " | 359 | 0 | << src.size() << " elements with valid input=" << inputisvalid | 360 | 0 | << ":\n"; | 361 | 0 | for (std::size_t i = 0; i < results.size(); ++i) { | 362 | 0 | std::cerr << "got return " << std::dec << results[i] | 363 | 0 | << " from implementation " << implementations[i]->name() | 364 | 0 | << '\n'; | 365 | 0 | } | 366 | 0 | std::cerr << "end errormessage\n"; | 367 | 0 | if (inputisvalid) { | 368 | 0 | ret.implementations_agree = false; | 369 | 0 | } else { | 370 | 0 | std::cerr | 371 | 0 | << "implementations are allowed to disagree on invalid input\n"; | 372 | 0 | ret.implementations_agree = true; | 373 | 0 | } | 374 | 351 | } else { | 375 | 351 | ret.implementations_agree = true; | 376 | 351 | } | 377 | 351 | return ret; | 378 | 351 | } |
Conversion<(UtfEncodings)2, (UtfEncodings)1, unsigned long (simdutf::implementation::*)(char const*, unsigned long) noexcept const, simdutf::result (simdutf::implementation::*)(char const*, unsigned long, char16_t*) noexcept const>::calculate_length(std::__1::span<char const, 18446744073709551615ul>, bool) const Line | Count | Source | 342 | 287 | length_result calculate_length(FromSpan src, const bool inputisvalid) const { | 343 | 287 | length_result ret{}; | 344 | | | 345 | 287 | const auto implementations = get_supported_implementations(); | 346 | 287 | std::vector<std::size_t> results; | 347 | 287 | results.reserve(implementations.size()); | 348 | | | 349 | 861 | for (auto impl : implementations) { | 350 | 861 | const auto len = invoke_lengthcalc(impl, src); | 351 | 861 | results.push_back(len); | 352 | 861 | ret.length.push_back(len); | 353 | 861 | } | 354 | | | 355 | 287 | auto neq = [](const auto& a, const auto& b) { return a != b; }; | 356 | 287 | if (std::ranges::adjacent_find(results, neq) != results.end()) { | 357 | 0 | std::cerr << "begin errormessage for calculate_length\n"; | 358 | 0 | std::cerr << "in fuzz case invoking " << lengthcalcname << " with " | 359 | 0 | << src.size() << " elements with valid input=" << inputisvalid | 360 | 0 | << ":\n"; | 361 | 0 | for (std::size_t i = 0; i < results.size(); ++i) { | 362 | 0 | std::cerr << "got return " << std::dec << results[i] | 363 | 0 | << " from implementation " << implementations[i]->name() | 364 | 0 | << '\n'; | 365 | 0 | } | 366 | 0 | std::cerr << "end errormessage\n"; | 367 | 0 | if (inputisvalid) { | 368 | 0 | ret.implementations_agree = false; | 369 | 0 | } else { | 370 | 0 | std::cerr | 371 | 0 | << "implementations are allowed to disagree on invalid input\n"; | 372 | 0 | ret.implementations_agree = true; | 373 | 0 | } | 374 | 287 | } else { | 375 | 287 | ret.implementations_agree = true; | 376 | 287 | } | 377 | 287 | return ret; | 378 | 287 | } |
Conversion<(UtfEncodings)2, (UtfEncodings)3, unsigned long (simdutf::implementation::*)(char const*, unsigned long) noexcept const, simdutf::result (simdutf::implementation::*)(char const*, unsigned long, char32_t*) noexcept const>::calculate_length(std::__1::span<char const, 18446744073709551615ul>, bool) const Line | Count | Source | 342 | 369 | length_result calculate_length(FromSpan src, const bool inputisvalid) const { | 343 | 369 | length_result ret{}; | 344 | | | 345 | 369 | const auto implementations = get_supported_implementations(); | 346 | 369 | std::vector<std::size_t> results; | 347 | 369 | results.reserve(implementations.size()); | 348 | | | 349 | 1.10k | for (auto impl : implementations) { | 350 | 1.10k | const auto len = invoke_lengthcalc(impl, src); | 351 | 1.10k | results.push_back(len); | 352 | 1.10k | ret.length.push_back(len); | 353 | 1.10k | } | 354 | | | 355 | 369 | auto neq = [](const auto& a, const auto& b) { return a != b; }; | 356 | 369 | if (std::ranges::adjacent_find(results, neq) != results.end()) { | 357 | 0 | std::cerr << "begin errormessage for calculate_length\n"; | 358 | 0 | std::cerr << "in fuzz case invoking " << lengthcalcname << " with " | 359 | 0 | << src.size() << " elements with valid input=" << inputisvalid | 360 | 0 | << ":\n"; | 361 | 0 | for (std::size_t i = 0; i < results.size(); ++i) { | 362 | 0 | std::cerr << "got return " << std::dec << results[i] | 363 | 0 | << " from implementation " << implementations[i]->name() | 364 | 0 | << '\n'; | 365 | 0 | } | 366 | 0 | std::cerr << "end errormessage\n"; | 367 | 0 | if (inputisvalid) { | 368 | 0 | ret.implementations_agree = false; | 369 | 0 | } else { | 370 | 0 | std::cerr | 371 | 0 | << "implementations are allowed to disagree on invalid input\n"; | 372 | 0 | ret.implementations_agree = true; | 373 | 0 | } | 374 | 369 | } else { | 375 | 369 | ret.implementations_agree = true; | 376 | 369 | } | 377 | 369 | return ret; | 378 | 369 | } |
Conversion<(UtfEncodings)4, (UtfEncodings)3, unsigned long (simdutf::implementation::*)(unsigned long) noexcept const, unsigned long (simdutf::implementation::*)(char const*, unsigned long, char32_t*) noexcept const>::calculate_length(std::__1::span<char const, 18446744073709551615ul>, bool) const Line | Count | Source | 342 | 45 | length_result calculate_length(FromSpan src, const bool inputisvalid) const { | 343 | 45 | length_result ret{}; | 344 | | | 345 | 45 | const auto implementations = get_supported_implementations(); | 346 | 45 | std::vector<std::size_t> results; | 347 | 45 | results.reserve(implementations.size()); | 348 | | | 349 | 135 | for (auto impl : implementations) { | 350 | 135 | const auto len = invoke_lengthcalc(impl, src); | 351 | 135 | results.push_back(len); | 352 | 135 | ret.length.push_back(len); | 353 | 135 | } | 354 | | | 355 | 45 | auto neq = [](const auto& a, const auto& b) { return a != b; }; | 356 | 45 | if (std::ranges::adjacent_find(results, neq) != results.end()) { | 357 | 0 | std::cerr << "begin errormessage for calculate_length\n"; | 358 | 0 | std::cerr << "in fuzz case invoking " << lengthcalcname << " with " | 359 | 0 | << src.size() << " elements with valid input=" << inputisvalid | 360 | 0 | << ":\n"; | 361 | 0 | for (std::size_t i = 0; i < results.size(); ++i) { | 362 | 0 | std::cerr << "got return " << std::dec << results[i] | 363 | 0 | << " from implementation " << implementations[i]->name() | 364 | 0 | << '\n'; | 365 | 0 | } | 366 | 0 | std::cerr << "end errormessage\n"; | 367 | 0 | if (inputisvalid) { | 368 | 0 | ret.implementations_agree = false; | 369 | 0 | } else { | 370 | 0 | std::cerr | 371 | 0 | << "implementations are allowed to disagree on invalid input\n"; | 372 | 0 | ret.implementations_agree = true; | 373 | 0 | } | 374 | 45 | } else { | 375 | 45 | ret.implementations_agree = true; | 376 | 45 | } | 377 | 45 | return ret; | 378 | 45 | } |
Conversion<(UtfEncodings)4, (UtfEncodings)0, unsigned long (simdutf::implementation::*)(unsigned long) noexcept const, unsigned long (simdutf::implementation::*)(char const*, unsigned long, char16_t*) noexcept const>::calculate_length(std::__1::span<char const, 18446744073709551615ul>, bool) const Line | Count | Source | 342 | 40 | length_result calculate_length(FromSpan src, const bool inputisvalid) const { | 343 | 40 | length_result ret{}; | 344 | | | 345 | 40 | const auto implementations = get_supported_implementations(); | 346 | 40 | std::vector<std::size_t> results; | 347 | 40 | results.reserve(implementations.size()); | 348 | | | 349 | 120 | for (auto impl : implementations) { | 350 | 120 | const auto len = invoke_lengthcalc(impl, src); | 351 | 120 | results.push_back(len); | 352 | 120 | ret.length.push_back(len); | 353 | 120 | } | 354 | | | 355 | 40 | auto neq = [](const auto& a, const auto& b) { return a != b; }; | 356 | 40 | if (std::ranges::adjacent_find(results, neq) != results.end()) { | 357 | 0 | std::cerr << "begin errormessage for calculate_length\n"; | 358 | 0 | std::cerr << "in fuzz case invoking " << lengthcalcname << " with " | 359 | 0 | << src.size() << " elements with valid input=" << inputisvalid | 360 | 0 | << ":\n"; | 361 | 0 | for (std::size_t i = 0; i < results.size(); ++i) { | 362 | 0 | std::cerr << "got return " << std::dec << results[i] | 363 | 0 | << " from implementation " << implementations[i]->name() | 364 | 0 | << '\n'; | 365 | 0 | } | 366 | 0 | std::cerr << "end errormessage\n"; | 367 | 0 | if (inputisvalid) { | 368 | 0 | ret.implementations_agree = false; | 369 | 0 | } else { | 370 | 0 | std::cerr | 371 | 0 | << "implementations are allowed to disagree on invalid input\n"; | 372 | 0 | ret.implementations_agree = true; | 373 | 0 | } | 374 | 40 | } else { | 375 | 40 | ret.implementations_agree = true; | 376 | 40 | } | 377 | 40 | return ret; | 378 | 40 | } |
Conversion<(UtfEncodings)4, (UtfEncodings)1, unsigned long (simdutf::implementation::*)(unsigned long) noexcept const, unsigned long (simdutf::implementation::*)(char const*, unsigned long, char16_t*) noexcept const>::calculate_length(std::__1::span<char const, 18446744073709551615ul>, bool) const Line | Count | Source | 342 | 40 | length_result calculate_length(FromSpan src, const bool inputisvalid) const { | 343 | 40 | length_result ret{}; | 344 | | | 345 | 40 | const auto implementations = get_supported_implementations(); | 346 | 40 | std::vector<std::size_t> results; | 347 | 40 | results.reserve(implementations.size()); | 348 | | | 349 | 120 | for (auto impl : implementations) { | 350 | 120 | const auto len = invoke_lengthcalc(impl, src); | 351 | 120 | results.push_back(len); | 352 | 120 | ret.length.push_back(len); | 353 | 120 | } | 354 | | | 355 | 40 | auto neq = [](const auto& a, const auto& b) { return a != b; }; | 356 | 40 | if (std::ranges::adjacent_find(results, neq) != results.end()) { | 357 | 0 | std::cerr << "begin errormessage for calculate_length\n"; | 358 | 0 | std::cerr << "in fuzz case invoking " << lengthcalcname << " with " | 359 | 0 | << src.size() << " elements with valid input=" << inputisvalid | 360 | 0 | << ":\n"; | 361 | 0 | for (std::size_t i = 0; i < results.size(); ++i) { | 362 | 0 | std::cerr << "got return " << std::dec << results[i] | 363 | 0 | << " from implementation " << implementations[i]->name() | 364 | 0 | << '\n'; | 365 | 0 | } | 366 | 0 | std::cerr << "end errormessage\n"; | 367 | 0 | if (inputisvalid) { | 368 | 0 | ret.implementations_agree = false; | 369 | 0 | } else { | 370 | 0 | std::cerr | 371 | 0 | << "implementations are allowed to disagree on invalid input\n"; | 372 | 0 | ret.implementations_agree = true; | 373 | 0 | } | 374 | 40 | } else { | 375 | 40 | ret.implementations_agree = true; | 376 | 40 | } | 377 | 40 | return ret; | 378 | 40 | } |
Conversion<(UtfEncodings)4, (UtfEncodings)2, unsigned long (simdutf::implementation::*)(char const*, unsigned long) noexcept const, unsigned long (simdutf::implementation::*)(char const*, unsigned long, char*) noexcept const>::calculate_length(std::__1::span<char const, 18446744073709551615ul>, bool) const Line | Count | Source | 342 | 269 | length_result calculate_length(FromSpan src, const bool inputisvalid) const { | 343 | 269 | length_result ret{}; | 344 | | | 345 | 269 | const auto implementations = get_supported_implementations(); | 346 | 269 | std::vector<std::size_t> results; | 347 | 269 | results.reserve(implementations.size()); | 348 | | | 349 | 807 | for (auto impl : implementations) { | 350 | 807 | const auto len = invoke_lengthcalc(impl, src); | 351 | 807 | results.push_back(len); | 352 | 807 | ret.length.push_back(len); | 353 | 807 | } | 354 | | | 355 | 269 | auto neq = [](const auto& a, const auto& b) { return a != b; }; | 356 | 269 | if (std::ranges::adjacent_find(results, neq) != results.end()) { | 357 | 0 | std::cerr << "begin errormessage for calculate_length\n"; | 358 | 0 | std::cerr << "in fuzz case invoking " << lengthcalcname << " with " | 359 | 0 | << src.size() << " elements with valid input=" << inputisvalid | 360 | 0 | << ":\n"; | 361 | 0 | for (std::size_t i = 0; i < results.size(); ++i) { | 362 | 0 | std::cerr << "got return " << std::dec << results[i] | 363 | 0 | << " from implementation " << implementations[i]->name() | 364 | 0 | << '\n'; | 365 | 0 | } | 366 | 0 | std::cerr << "end errormessage\n"; | 367 | 0 | if (inputisvalid) { | 368 | 0 | ret.implementations_agree = false; | 369 | 0 | } else { | 370 | 0 | std::cerr | 371 | 0 | << "implementations are allowed to disagree on invalid input\n"; | 372 | 0 | ret.implementations_agree = true; | 373 | 0 | } | 374 | 269 | } else { | 375 | 269 | ret.implementations_agree = true; | 376 | 269 | } | 377 | 269 | return ret; | 378 | 269 | } |
|
379 | | |
380 | | conversion_result do_conversion(FromSpan src, |
381 | | const std::vector<std::size_t>& outlength, |
382 | 8.47k | const bool inputisvalid) const { |
383 | 8.47k | conversion_result ret{}; |
384 | | |
385 | 8.47k | const auto implementations = get_supported_implementations(); |
386 | | |
387 | 8.47k | std::vector<result<ConversionResult>> results; |
388 | 8.47k | results.reserve(implementations.size()); |
389 | | |
390 | | // put the output in a separate allocation to make access violations easier |
391 | | // to catch |
392 | 8.47k | std::vector<std::vector<ToType>> outputbuffers; |
393 | 8.47k | outputbuffers.reserve(implementations.size()); |
394 | 33.9k | for (std::size_t i = 0; i < implementations.size(); ++i) { |
395 | 25.4k | auto impl = implementations[i]; |
396 | 25.4k | const ToType canary1{42}; |
397 | 25.4k | auto& outputbuffer = outputbuffers.emplace_back(outlength.at(i), canary1); |
398 | 25.4k | const auto implret1 = std::invoke(conversion, impl, src.data(), |
399 | 25.4k | src.size(), outputbuffer.data()); |
400 | | // was the conversion successful? |
401 | 25.4k | const auto success = [](const ConversionResult& r) -> bool { |
402 | 25.4k | if constexpr (std::is_same_v<ConversionResult, std::size_t>) { |
403 | 14.1k | return r != 0; |
404 | 14.1k | } else { |
405 | 11.2k | return r.error == simdutf::error_code::SUCCESS; |
406 | 11.2k | } |
407 | 25.4k | }(implret1); Conversion<(UtfEncodings)0, (UtfEncodings)3, unsigned long (simdutf::implementation::*)(char16_t const*, unsigned long) noexcept const, unsigned long (simdutf::implementation::*)(char16_t const*, unsigned long, char32_t*) noexcept const>::do_conversion(std::__1::span<char16_t const, 18446744073709551615ul>, std::__1::vector<unsigned long, std::__1::allocator<unsigned long> > const&, bool) const::{lambda(unsigned long const&)#1}::operator()(unsigned long const&) constLine | Count | Source | 401 | 549 | const auto success = [](const ConversionResult& r) -> bool { | 402 | 549 | if constexpr (std::is_same_v<ConversionResult, std::size_t>) { | 403 | 549 | return r != 0; | 404 | | } else { | 405 | | return r.error == simdutf::error_code::SUCCESS; | 406 | | } | 407 | 549 | }(implret1); |
Conversion<(UtfEncodings)0, (UtfEncodings)2, unsigned long (simdutf::implementation::*)(char16_t const*, unsigned long) noexcept const, unsigned long (simdutf::implementation::*)(char16_t const*, unsigned long, char*) noexcept const>::do_conversion(std::__1::span<char16_t const, 18446744073709551615ul>, std::__1::vector<unsigned long, std::__1::allocator<unsigned long> > const&, bool) const::{lambda(unsigned long const&)#1}::operator()(unsigned long const&) constLine | Count | Source | 401 | 1.15k | const auto success = [](const ConversionResult& r) -> bool { | 402 | 1.15k | if constexpr (std::is_same_v<ConversionResult, std::size_t>) { | 403 | 1.15k | return r != 0; | 404 | | } else { | 405 | | return r.error == simdutf::error_code::SUCCESS; | 406 | | } | 407 | 1.15k | }(implret1); |
Conversion<(UtfEncodings)1, (UtfEncodings)3, unsigned long (simdutf::implementation::*)(char16_t const*, unsigned long) noexcept const, unsigned long (simdutf::implementation::*)(char16_t const*, unsigned long, char32_t*) noexcept const>::do_conversion(std::__1::span<char16_t const, 18446744073709551615ul>, std::__1::vector<unsigned long, std::__1::allocator<unsigned long> > const&, bool) const::{lambda(unsigned long const&)#1}::operator()(unsigned long const&) constLine | Count | Source | 401 | 576 | const auto success = [](const ConversionResult& r) -> bool { | 402 | 576 | if constexpr (std::is_same_v<ConversionResult, std::size_t>) { | 403 | 576 | return r != 0; | 404 | | } else { | 405 | | return r.error == simdutf::error_code::SUCCESS; | 406 | | } | 407 | 576 | }(implret1); |
Conversion<(UtfEncodings)1, (UtfEncodings)2, unsigned long (simdutf::implementation::*)(char16_t const*, unsigned long) noexcept const, unsigned long (simdutf::implementation::*)(char16_t const*, unsigned long, char*) noexcept const>::do_conversion(std::__1::span<char16_t const, 18446744073709551615ul>, std::__1::vector<unsigned long, std::__1::allocator<unsigned long> > const&, bool) const::{lambda(unsigned long const&)#1}::operator()(unsigned long const&) constLine | Count | Source | 401 | 1.20k | const auto success = [](const ConversionResult& r) -> bool { | 402 | 1.20k | if constexpr (std::is_same_v<ConversionResult, std::size_t>) { | 403 | 1.20k | return r != 0; | 404 | | } else { | 405 | | return r.error == simdutf::error_code::SUCCESS; | 406 | | } | 407 | 1.20k | }(implret1); |
Conversion<(UtfEncodings)3, (UtfEncodings)0, unsigned long (simdutf::implementation::*)(char32_t const*, unsigned long) noexcept const, unsigned long (simdutf::implementation::*)(char32_t const*, unsigned long, char16_t*) noexcept const>::do_conversion(std::__1::span<char32_t const, 18446744073709551615ul>, std::__1::vector<unsigned long, std::__1::allocator<unsigned long> > const&, bool) const::{lambda(unsigned long const&)#1}::operator()(unsigned long const&) constLine | Count | Source | 401 | 792 | const auto success = [](const ConversionResult& r) -> bool { | 402 | 792 | if constexpr (std::is_same_v<ConversionResult, std::size_t>) { | 403 | 792 | return r != 0; | 404 | | } else { | 405 | | return r.error == simdutf::error_code::SUCCESS; | 406 | | } | 407 | 792 | }(implret1); |
Conversion<(UtfEncodings)3, (UtfEncodings)1, unsigned long (simdutf::implementation::*)(char32_t const*, unsigned long) noexcept const, unsigned long (simdutf::implementation::*)(char32_t const*, unsigned long, char16_t*) noexcept const>::do_conversion(std::__1::span<char32_t const, 18446744073709551615ul>, std::__1::vector<unsigned long, std::__1::allocator<unsigned long> > const&, bool) const::{lambda(unsigned long const&)#1}::operator()(unsigned long const&) constLine | Count | Source | 401 | 1.08k | const auto success = [](const ConversionResult& r) -> bool { | 402 | 1.08k | if constexpr (std::is_same_v<ConversionResult, std::size_t>) { | 403 | 1.08k | return r != 0; | 404 | | } else { | 405 | | return r.error == simdutf::error_code::SUCCESS; | 406 | | } | 407 | 1.08k | }(implret1); |
Conversion<(UtfEncodings)3, (UtfEncodings)2, unsigned long (simdutf::implementation::*)(char32_t const*, unsigned long) noexcept const, unsigned long (simdutf::implementation::*)(char32_t const*, unsigned long, char*) noexcept const>::do_conversion(std::__1::span<char32_t const, 18446744073709551615ul>, std::__1::vector<unsigned long, std::__1::allocator<unsigned long> > const&, bool) const::{lambda(unsigned long const&)#1}::operator()(unsigned long const&) constLine | Count | Source | 401 | 1.19k | const auto success = [](const ConversionResult& r) -> bool { | 402 | 1.19k | if constexpr (std::is_same_v<ConversionResult, std::size_t>) { | 403 | 1.19k | return r != 0; | 404 | | } else { | 405 | | return r.error == simdutf::error_code::SUCCESS; | 406 | | } | 407 | 1.19k | }(implret1); |
Conversion<(UtfEncodings)2, (UtfEncodings)0, unsigned long (simdutf::implementation::*)(char const*, unsigned long) noexcept const, unsigned long (simdutf::implementation::*)(char const*, unsigned long, char16_t*) noexcept const>::do_conversion(std::__1::span<char const, 18446744073709551615ul>, std::__1::vector<unsigned long, std::__1::allocator<unsigned long> > const&, bool) const::{lambda(unsigned long const&)#1}::operator()(unsigned long const&) constLine | Count | Source | 401 | 1.72k | const auto success = [](const ConversionResult& r) -> bool { | 402 | 1.72k | if constexpr (std::is_same_v<ConversionResult, std::size_t>) { | 403 | 1.72k | return r != 0; | 404 | | } else { | 405 | | return r.error == simdutf::error_code::SUCCESS; | 406 | | } | 407 | 1.72k | }(implret1); |
Conversion<(UtfEncodings)2, (UtfEncodings)1, unsigned long (simdutf::implementation::*)(char const*, unsigned long) noexcept const, unsigned long (simdutf::implementation::*)(char const*, unsigned long, char16_t*) noexcept const>::do_conversion(std::__1::span<char const, 18446744073709551615ul>, std::__1::vector<unsigned long, std::__1::allocator<unsigned long> > const&, bool) const::{lambda(unsigned long const&)#1}::operator()(unsigned long const&) constLine | Count | Source | 401 | 1.54k | const auto success = [](const ConversionResult& r) -> bool { | 402 | 1.54k | if constexpr (std::is_same_v<ConversionResult, std::size_t>) { | 403 | 1.54k | return r != 0; | 404 | | } else { | 405 | | return r.error == simdutf::error_code::SUCCESS; | 406 | | } | 407 | 1.54k | }(implret1); |
Conversion<(UtfEncodings)2, (UtfEncodings)3, unsigned long (simdutf::implementation::*)(char const*, unsigned long) noexcept const, unsigned long (simdutf::implementation::*)(char const*, unsigned long, char32_t*) noexcept const>::do_conversion(std::__1::span<char const, 18446744073709551615ul>, std::__1::vector<unsigned long, std::__1::allocator<unsigned long> > const&, bool) const::{lambda(unsigned long const&)#1}::operator()(unsigned long const&) constLine | Count | Source | 401 | 1.65k | const auto success = [](const ConversionResult& r) -> bool { | 402 | 1.65k | if constexpr (std::is_same_v<ConversionResult, std::size_t>) { | 403 | 1.65k | return r != 0; | 404 | | } else { | 405 | | return r.error == simdutf::error_code::SUCCESS; | 406 | | } | 407 | 1.65k | }(implret1); |
Conversion<(UtfEncodings)0, (UtfEncodings)4, unsigned long (simdutf::implementation::*)(unsigned long) noexcept const, unsigned long (simdutf::implementation::*)(char16_t const*, unsigned long, char*) noexcept const>::do_conversion(std::__1::span<char16_t const, 18446744073709551615ul>, std::__1::vector<unsigned long, std::__1::allocator<unsigned long> > const&, bool) const::{lambda(unsigned long const&)#1}::operator()(unsigned long const&) constLine | Count | Source | 401 | 189 | const auto success = [](const ConversionResult& r) -> bool { | 402 | 189 | if constexpr (std::is_same_v<ConversionResult, std::size_t>) { | 403 | 189 | return r != 0; | 404 | | } else { | 405 | | return r.error == simdutf::error_code::SUCCESS; | 406 | | } | 407 | 189 | }(implret1); |
Conversion<(UtfEncodings)1, (UtfEncodings)4, unsigned long (simdutf::implementation::*)(unsigned long) noexcept const, unsigned long (simdutf::implementation::*)(char16_t const*, unsigned long, char*) noexcept const>::do_conversion(std::__1::span<char16_t const, 18446744073709551615ul>, std::__1::vector<unsigned long, std::__1::allocator<unsigned long> > const&, bool) const::{lambda(unsigned long const&)#1}::operator()(unsigned long const&) constLine | Count | Source | 401 | 186 | const auto success = [](const ConversionResult& r) -> bool { | 402 | 186 | if constexpr (std::is_same_v<ConversionResult, std::size_t>) { | 403 | 186 | return r != 0; | 404 | | } else { | 405 | | return r.error == simdutf::error_code::SUCCESS; | 406 | | } | 407 | 186 | }(implret1); |
Conversion<(UtfEncodings)3, (UtfEncodings)4, unsigned long (simdutf::implementation::*)(unsigned long) noexcept const, unsigned long (simdutf::implementation::*)(char32_t const*, unsigned long, char*) noexcept const>::do_conversion(std::__1::span<char32_t const, 18446744073709551615ul>, std::__1::vector<unsigned long, std::__1::allocator<unsigned long> > const&, bool) const::{lambda(unsigned long const&)#1}::operator()(unsigned long const&) constLine | Count | Source | 401 | 282 | const auto success = [](const ConversionResult& r) -> bool { | 402 | 282 | if constexpr (std::is_same_v<ConversionResult, std::size_t>) { | 403 | 282 | return r != 0; | 404 | | } else { | 405 | | return r.error == simdutf::error_code::SUCCESS; | 406 | | } | 407 | 282 | }(implret1); |
Conversion<(UtfEncodings)2, (UtfEncodings)4, unsigned long (simdutf::implementation::*)(char const*, unsigned long) noexcept const, unsigned long (simdutf::implementation::*)(char const*, unsigned long, char*) noexcept const>::do_conversion(std::__1::span<char const, 18446744073709551615ul>, std::__1::vector<unsigned long, std::__1::allocator<unsigned long> > const&, bool) const::{lambda(unsigned long const&)#1}::operator()(unsigned long const&) constLine | Count | Source | 401 | 843 | const auto success = [](const ConversionResult& r) -> bool { | 402 | 843 | if constexpr (std::is_same_v<ConversionResult, std::size_t>) { | 403 | 843 | return r != 0; | 404 | | } else { | 405 | | return r.error == simdutf::error_code::SUCCESS; | 406 | | } | 407 | 843 | }(implret1); |
Conversion<(UtfEncodings)0, (UtfEncodings)4, unsigned long (simdutf::implementation::*)(unsigned long) noexcept const, simdutf::result (simdutf::implementation::*)(char16_t const*, unsigned long, char*) noexcept const>::do_conversion(std::__1::span<char16_t const, 18446744073709551615ul>, std::__1::vector<unsigned long, std::__1::allocator<unsigned long> > const&, bool) const::{lambda(simdutf::result const&)#1}::operator()(simdutf::result const&) constLine | Count | Source | 401 | 378 | const auto success = [](const ConversionResult& r) -> bool { | 402 | | if constexpr (std::is_same_v<ConversionResult, std::size_t>) { | 403 | | return r != 0; | 404 | 378 | } else { | 405 | 378 | return r.error == simdutf::error_code::SUCCESS; | 406 | 378 | } | 407 | 378 | }(implret1); |
Conversion<(UtfEncodings)0, (UtfEncodings)3, unsigned long (simdutf::implementation::*)(char16_t const*, unsigned long) noexcept const, simdutf::result (simdutf::implementation::*)(char16_t const*, unsigned long, char32_t*) noexcept const>::do_conversion(std::__1::span<char16_t const, 18446744073709551615ul>, std::__1::vector<unsigned long, std::__1::allocator<unsigned long> > const&, bool) const::{lambda(simdutf::result const&)#1}::operator()(simdutf::result const&) constLine | Count | Source | 401 | 450 | const auto success = [](const ConversionResult& r) -> bool { | 402 | | if constexpr (std::is_same_v<ConversionResult, std::size_t>) { | 403 | | return r != 0; | 404 | 450 | } else { | 405 | 450 | return r.error == simdutf::error_code::SUCCESS; | 406 | 450 | } | 407 | 450 | }(implret1); |
Conversion<(UtfEncodings)0, (UtfEncodings)2, unsigned long (simdutf::implementation::*)(char16_t const*, unsigned long) noexcept const, simdutf::result (simdutf::implementation::*)(char16_t const*, unsigned long, char*) noexcept const>::do_conversion(std::__1::span<char16_t const, 18446744073709551615ul>, std::__1::vector<unsigned long, std::__1::allocator<unsigned long> > const&, bool) const::{lambda(simdutf::result const&)#1}::operator()(simdutf::result const&) constLine | Count | Source | 401 | 879 | const auto success = [](const ConversionResult& r) -> bool { | 402 | | if constexpr (std::is_same_v<ConversionResult, std::size_t>) { | 403 | | return r != 0; | 404 | 879 | } else { | 405 | 879 | return r.error == simdutf::error_code::SUCCESS; | 406 | 879 | } | 407 | 879 | }(implret1); |
Conversion<(UtfEncodings)1, (UtfEncodings)4, unsigned long (simdutf::implementation::*)(unsigned long) noexcept const, simdutf::result (simdutf::implementation::*)(char16_t const*, unsigned long, char*) noexcept const>::do_conversion(std::__1::span<char16_t const, 18446744073709551615ul>, std::__1::vector<unsigned long, std::__1::allocator<unsigned long> > const&, bool) const::{lambda(simdutf::result const&)#1}::operator()(simdutf::result const&) constLine | Count | Source | 401 | 345 | const auto success = [](const ConversionResult& r) -> bool { | 402 | | if constexpr (std::is_same_v<ConversionResult, std::size_t>) { | 403 | | return r != 0; | 404 | 345 | } else { | 405 | 345 | return r.error == simdutf::error_code::SUCCESS; | 406 | 345 | } | 407 | 345 | }(implret1); |
Conversion<(UtfEncodings)1, (UtfEncodings)3, unsigned long (simdutf::implementation::*)(char16_t const*, unsigned long) noexcept const, simdutf::result (simdutf::implementation::*)(char16_t const*, unsigned long, char32_t*) noexcept const>::do_conversion(std::__1::span<char16_t const, 18446744073709551615ul>, std::__1::vector<unsigned long, std::__1::allocator<unsigned long> > const&, bool) const::{lambda(simdutf::result const&)#1}::operator()(simdutf::result const&) constLine | Count | Source | 401 | 621 | const auto success = [](const ConversionResult& r) -> bool { | 402 | | if constexpr (std::is_same_v<ConversionResult, std::size_t>) { | 403 | | return r != 0; | 404 | 621 | } else { | 405 | 621 | return r.error == simdutf::error_code::SUCCESS; | 406 | 621 | } | 407 | 621 | }(implret1); |
Conversion<(UtfEncodings)1, (UtfEncodings)2, unsigned long (simdutf::implementation::*)(char16_t const*, unsigned long) noexcept const, simdutf::result (simdutf::implementation::*)(char16_t const*, unsigned long, char*) noexcept const>::do_conversion(std::__1::span<char16_t const, 18446744073709551615ul>, std::__1::vector<unsigned long, std::__1::allocator<unsigned long> > const&, bool) const::{lambda(simdutf::result const&)#1}::operator()(simdutf::result const&) constLine | Count | Source | 401 | 945 | const auto success = [](const ConversionResult& r) -> bool { | 402 | | if constexpr (std::is_same_v<ConversionResult, std::size_t>) { | 403 | | return r != 0; | 404 | 945 | } else { | 405 | 945 | return r.error == simdutf::error_code::SUCCESS; | 406 | 945 | } | 407 | 945 | }(implret1); |
Conversion<(UtfEncodings)3, (UtfEncodings)4, unsigned long (simdutf::implementation::*)(unsigned long) noexcept const, simdutf::result (simdutf::implementation::*)(char32_t const*, unsigned long, char*) noexcept const>::do_conversion(std::__1::span<char32_t const, 18446744073709551615ul>, std::__1::vector<unsigned long, std::__1::allocator<unsigned long> > const&, bool) const::{lambda(simdutf::result const&)#1}::operator()(simdutf::result const&) constLine | Count | Source | 401 | 630 | const auto success = [](const ConversionResult& r) -> bool { | 402 | | if constexpr (std::is_same_v<ConversionResult, std::size_t>) { | 403 | | return r != 0; | 404 | 630 | } else { | 405 | 630 | return r.error == simdutf::error_code::SUCCESS; | 406 | 630 | } | 407 | 630 | }(implret1); |
Conversion<(UtfEncodings)3, (UtfEncodings)0, unsigned long (simdutf::implementation::*)(char32_t const*, unsigned long) noexcept const, simdutf::result (simdutf::implementation::*)(char32_t const*, unsigned long, char16_t*) noexcept const>::do_conversion(std::__1::span<char32_t const, 18446744073709551615ul>, std::__1::vector<unsigned long, std::__1::allocator<unsigned long> > const&, bool) const::{lambda(simdutf::result const&)#1}::operator()(simdutf::result const&) constLine | Count | Source | 401 | 909 | const auto success = [](const ConversionResult& r) -> bool { | 402 | | if constexpr (std::is_same_v<ConversionResult, std::size_t>) { | 403 | | return r != 0; | 404 | 909 | } else { | 405 | 909 | return r.error == simdutf::error_code::SUCCESS; | 406 | 909 | } | 407 | 909 | }(implret1); |
Conversion<(UtfEncodings)3, (UtfEncodings)1, unsigned long (simdutf::implementation::*)(char32_t const*, unsigned long) noexcept const, simdutf::result (simdutf::implementation::*)(char32_t const*, unsigned long, char16_t*) noexcept const>::do_conversion(std::__1::span<char32_t const, 18446744073709551615ul>, std::__1::vector<unsigned long, std::__1::allocator<unsigned long> > const&, bool) const::{lambda(simdutf::result const&)#1}::operator()(simdutf::result const&) constLine | Count | Source | 401 | 1.07k | const auto success = [](const ConversionResult& r) -> bool { | 402 | | if constexpr (std::is_same_v<ConversionResult, std::size_t>) { | 403 | | return r != 0; | 404 | 1.07k | } else { | 405 | 1.07k | return r.error == simdutf::error_code::SUCCESS; | 406 | 1.07k | } | 407 | 1.07k | }(implret1); |
Conversion<(UtfEncodings)3, (UtfEncodings)2, unsigned long (simdutf::implementation::*)(char32_t const*, unsigned long) noexcept const, simdutf::result (simdutf::implementation::*)(char32_t const*, unsigned long, char*) noexcept const>::do_conversion(std::__1::span<char32_t const, 18446744073709551615ul>, std::__1::vector<unsigned long, std::__1::allocator<unsigned long> > const&, bool) const::{lambda(simdutf::result const&)#1}::operator()(simdutf::result const&) constLine | Count | Source | 401 | 1.24k | const auto success = [](const ConversionResult& r) -> bool { | 402 | | if constexpr (std::is_same_v<ConversionResult, std::size_t>) { | 403 | | return r != 0; | 404 | 1.24k | } else { | 405 | 1.24k | return r.error == simdutf::error_code::SUCCESS; | 406 | 1.24k | } | 407 | 1.24k | }(implret1); |
Conversion<(UtfEncodings)2, (UtfEncodings)4, unsigned long (simdutf::implementation::*)(char const*, unsigned long) noexcept const, simdutf::result (simdutf::implementation::*)(char const*, unsigned long, char*) noexcept const>::do_conversion(std::__1::span<char const, 18446744073709551615ul>, std::__1::vector<unsigned long, std::__1::allocator<unsigned long> > const&, bool) const::{lambda(simdutf::result const&)#1}::operator()(simdutf::result const&) constLine | Count | Source | 401 | 774 | const auto success = [](const ConversionResult& r) -> bool { | 402 | | if constexpr (std::is_same_v<ConversionResult, std::size_t>) { | 403 | | return r != 0; | 404 | 774 | } else { | 405 | 774 | return r.error == simdutf::error_code::SUCCESS; | 406 | 774 | } | 407 | 774 | }(implret1); |
Conversion<(UtfEncodings)2, (UtfEncodings)0, unsigned long (simdutf::implementation::*)(char const*, unsigned long) noexcept const, simdutf::result (simdutf::implementation::*)(char const*, unsigned long, char16_t*) noexcept const>::do_conversion(std::__1::span<char const, 18446744073709551615ul>, std::__1::vector<unsigned long, std::__1::allocator<unsigned long> > const&, bool) const::{lambda(simdutf::result const&)#1}::operator()(simdutf::result const&) constLine | Count | Source | 401 | 1.05k | const auto success = [](const ConversionResult& r) -> bool { | 402 | | if constexpr (std::is_same_v<ConversionResult, std::size_t>) { | 403 | | return r != 0; | 404 | 1.05k | } else { | 405 | 1.05k | return r.error == simdutf::error_code::SUCCESS; | 406 | 1.05k | } | 407 | 1.05k | }(implret1); |
Conversion<(UtfEncodings)2, (UtfEncodings)1, unsigned long (simdutf::implementation::*)(char const*, unsigned long) noexcept const, simdutf::result (simdutf::implementation::*)(char const*, unsigned long, char16_t*) noexcept const>::do_conversion(std::__1::span<char const, 18446744073709551615ul>, std::__1::vector<unsigned long, std::__1::allocator<unsigned long> > const&, bool) const::{lambda(simdutf::result const&)#1}::operator()(simdutf::result const&) constLine | Count | Source | 401 | 861 | const auto success = [](const ConversionResult& r) -> bool { | 402 | | if constexpr (std::is_same_v<ConversionResult, std::size_t>) { | 403 | | return r != 0; | 404 | 861 | } else { | 405 | 861 | return r.error == simdutf::error_code::SUCCESS; | 406 | 861 | } | 407 | 861 | }(implret1); |
Conversion<(UtfEncodings)2, (UtfEncodings)3, unsigned long (simdutf::implementation::*)(char const*, unsigned long) noexcept const, simdutf::result (simdutf::implementation::*)(char const*, unsigned long, char32_t*) noexcept const>::do_conversion(std::__1::span<char const, 18446744073709551615ul>, std::__1::vector<unsigned long, std::__1::allocator<unsigned long> > const&, bool) const::{lambda(simdutf::result const&)#1}::operator()(simdutf::result const&) constLine | Count | Source | 401 | 1.10k | const auto success = [](const ConversionResult& r) -> bool { | 402 | | if constexpr (std::is_same_v<ConversionResult, std::size_t>) { | 403 | | return r != 0; | 404 | 1.10k | } else { | 405 | 1.10k | return r.error == simdutf::error_code::SUCCESS; | 406 | 1.10k | } | 407 | 1.10k | }(implret1); |
Conversion<(UtfEncodings)4, (UtfEncodings)3, unsigned long (simdutf::implementation::*)(unsigned long) noexcept const, unsigned long (simdutf::implementation::*)(char const*, unsigned long, char32_t*) noexcept const>::do_conversion(std::__1::span<char const, 18446744073709551615ul>, std::__1::vector<unsigned long, std::__1::allocator<unsigned long> > const&, bool) const::{lambda(unsigned long const&)#1}::operator()(unsigned long const&) constLine | Count | Source | 401 | 135 | const auto success = [](const ConversionResult& r) -> bool { | 402 | 135 | if constexpr (std::is_same_v<ConversionResult, std::size_t>) { | 403 | 135 | return r != 0; | 404 | | } else { | 405 | | return r.error == simdutf::error_code::SUCCESS; | 406 | | } | 407 | 135 | }(implret1); |
Conversion<(UtfEncodings)4, (UtfEncodings)0, unsigned long (simdutf::implementation::*)(unsigned long) noexcept const, unsigned long (simdutf::implementation::*)(char const*, unsigned long, char16_t*) noexcept const>::do_conversion(std::__1::span<char const, 18446744073709551615ul>, std::__1::vector<unsigned long, std::__1::allocator<unsigned long> > const&, bool) const::{lambda(unsigned long const&)#1}::operator()(unsigned long const&) constLine | Count | Source | 401 | 120 | const auto success = [](const ConversionResult& r) -> bool { | 402 | 120 | if constexpr (std::is_same_v<ConversionResult, std::size_t>) { | 403 | 120 | return r != 0; | 404 | | } else { | 405 | | return r.error == simdutf::error_code::SUCCESS; | 406 | | } | 407 | 120 | }(implret1); |
Conversion<(UtfEncodings)4, (UtfEncodings)1, unsigned long (simdutf::implementation::*)(unsigned long) noexcept const, unsigned long (simdutf::implementation::*)(char const*, unsigned long, char16_t*) noexcept const>::do_conversion(std::__1::span<char const, 18446744073709551615ul>, std::__1::vector<unsigned long, std::__1::allocator<unsigned long> > const&, bool) const::{lambda(unsigned long const&)#1}::operator()(unsigned long const&) constLine | Count | Source | 401 | 120 | const auto success = [](const ConversionResult& r) -> bool { | 402 | 120 | if constexpr (std::is_same_v<ConversionResult, std::size_t>) { | 403 | 120 | return r != 0; | 404 | | } else { | 405 | | return r.error == simdutf::error_code::SUCCESS; | 406 | | } | 407 | 120 | }(implret1); |
Conversion<(UtfEncodings)4, (UtfEncodings)2, unsigned long (simdutf::implementation::*)(char const*, unsigned long) noexcept const, unsigned long (simdutf::implementation::*)(char const*, unsigned long, char*) noexcept const>::do_conversion(std::__1::span<char const, 18446744073709551615ul>, std::__1::vector<unsigned long, std::__1::allocator<unsigned long> > const&, bool) const::{lambda(unsigned long const&)#1}::operator()(unsigned long const&) constLine | Count | Source | 401 | 807 | const auto success = [](const ConversionResult& r) -> bool { | 402 | 807 | if constexpr (std::is_same_v<ConversionResult, std::size_t>) { | 403 | 807 | return r != 0; | 404 | | } else { | 405 | | return r.error == simdutf::error_code::SUCCESS; | 406 | | } | 407 | 807 | }(implret1); |
|
408 | 25.4k | const auto hash1 = FNV1A_hash::as_str(outputbuffer); |
409 | 25.4k | if constexpr (use_canary_in_output) { |
410 | | // optionally convert again, this time with the buffer filled with |
411 | | // a different value. if the output differs, it means some of the buffer |
412 | | // was not written to by the conversion function. |
413 | 25.4k | const ToType canary2{25}; |
414 | 25.4k | const auto outputbuffer_first_run = outputbuffer; |
415 | 25.4k | std::ranges::fill(outputbuffer, canary2); |
416 | 25.4k | const auto implret2 = std::invoke(conversion, impl, src.data(), |
417 | 25.4k | src.size(), outputbuffer.data()); |
418 | | |
419 | 25.4k | if (implret1 != implret2) { |
420 | 0 | std::cerr << "different return value the second time!\n"; |
421 | 0 | std::abort(); |
422 | 0 | } |
423 | 25.4k | if (inputisvalid && success) { |
424 | | // only care about the output if the input is valid |
425 | 12.8k | const auto hash2 = FNV1A_hash::as_str(outputbuffer); |
426 | 12.8k | if (hash1 != hash2) { |
427 | 0 | std::cerr << "different output the second time!\n"; |
428 | 0 | std::cerr << "implementation " << impl->name() << " " << name |
429 | 0 | << '\n'; |
430 | 0 | std::cerr << "input is valid=" << inputisvalid << '\n'; |
431 | 0 | std::cerr << "output length=" << outputbuffer.size() << '\n'; |
432 | 0 | std::cerr << "conversion was a success? " << success << '\n'; |
433 | 0 | for (std::size_t j = 0; j < outputbuffer.size(); ++j) { |
434 | 0 | std::cerr << "output[" << j << "]\t" << +outputbuffer_first_run[j] |
435 | 0 | << '\t' << +outputbuffer[j] << '\n'; |
436 | 0 | } |
437 | 0 | std::abort(); |
438 | 0 | } |
439 | 12.8k | } |
440 | 25.4k | } |
441 | 25.4k | results.emplace_back(implret1, success ? hash1 : ""); |
442 | 25.4k | } |
443 | | |
444 | | // do not require implementations to give the same output if |
445 | | // the input is not valid. |
446 | 8.47k | if (!inputisvalid) { |
447 | 11.8k | for (auto& e : results) { |
448 | 11.8k | e.outputhash.clear(); |
449 | 11.8k | } |
450 | 3.95k | } |
451 | | |
452 | 16.9k | auto neq = [](const auto& a, const auto& b) { return a != b; };auto Conversion<(UtfEncodings)0, (UtfEncodings)3, unsigned long (simdutf::implementation::*)(char16_t const*, unsigned long) noexcept const, unsigned long (simdutf::implementation::*)(char16_t const*, unsigned long, char32_t*) noexcept const>::do_conversion(std::__1::span<char16_t const, 18446744073709551615ul>, std::__1::vector<unsigned long, std::__1::allocator<unsigned long> > const&, bool) const::{lambda(auto:1 const&, auto:2 const&)#1}::operator()<result<unsigned long>, result>(result<unsigned long> const&, result const&) constLine | Count | Source | 452 | 366 | auto neq = [](const auto& a, const auto& b) { return a != b; }; |
auto Conversion<(UtfEncodings)0, (UtfEncodings)2, unsigned long (simdutf::implementation::*)(char16_t const*, unsigned long) noexcept const, unsigned long (simdutf::implementation::*)(char16_t const*, unsigned long, char*) noexcept const>::do_conversion(std::__1::span<char16_t const, 18446744073709551615ul>, std::__1::vector<unsigned long, std::__1::allocator<unsigned long> > const&, bool) const::{lambda(auto:1 const&, auto:2 const&)#1}::operator()<result<unsigned long>, result>(result<unsigned long> const&, result const&) constLine | Count | Source | 452 | 768 | auto neq = [](const auto& a, const auto& b) { return a != b; }; |
auto Conversion<(UtfEncodings)1, (UtfEncodings)3, unsigned long (simdutf::implementation::*)(char16_t const*, unsigned long) noexcept const, unsigned long (simdutf::implementation::*)(char16_t const*, unsigned long, char32_t*) noexcept const>::do_conversion(std::__1::span<char16_t const, 18446744073709551615ul>, std::__1::vector<unsigned long, std::__1::allocator<unsigned long> > const&, bool) const::{lambda(auto:1 const&, auto:2 const&)#1}::operator()<result<unsigned long>, result>(result<unsigned long> const&, result const&) constLine | Count | Source | 452 | 384 | auto neq = [](const auto& a, const auto& b) { return a != b; }; |
auto Conversion<(UtfEncodings)1, (UtfEncodings)2, unsigned long (simdutf::implementation::*)(char16_t const*, unsigned long) noexcept const, unsigned long (simdutf::implementation::*)(char16_t const*, unsigned long, char*) noexcept const>::do_conversion(std::__1::span<char16_t const, 18446744073709551615ul>, std::__1::vector<unsigned long, std::__1::allocator<unsigned long> > const&, bool) const::{lambda(auto:1 const&, auto:2 const&)#1}::operator()<result<unsigned long>, result>(result<unsigned long> const&, result const&) constLine | Count | Source | 452 | 802 | auto neq = [](const auto& a, const auto& b) { return a != b; }; |
auto Conversion<(UtfEncodings)3, (UtfEncodings)0, unsigned long (simdutf::implementation::*)(char32_t const*, unsigned long) noexcept const, unsigned long (simdutf::implementation::*)(char32_t const*, unsigned long, char16_t*) noexcept const>::do_conversion(std::__1::span<char32_t const, 18446744073709551615ul>, std::__1::vector<unsigned long, std::__1::allocator<unsigned long> > const&, bool) const::{lambda(auto:1 const&, auto:2 const&)#1}::operator()<result<unsigned long>, result>(result<unsigned long> const&, result const&) constLine | Count | Source | 452 | 528 | auto neq = [](const auto& a, const auto& b) { return a != b; }; |
auto Conversion<(UtfEncodings)3, (UtfEncodings)1, unsigned long (simdutf::implementation::*)(char32_t const*, unsigned long) noexcept const, unsigned long (simdutf::implementation::*)(char32_t const*, unsigned long, char16_t*) noexcept const>::do_conversion(std::__1::span<char32_t const, 18446744073709551615ul>, std::__1::vector<unsigned long, std::__1::allocator<unsigned long> > const&, bool) const::{lambda(auto:1 const&, auto:2 const&)#1}::operator()<result<unsigned long>, result>(result<unsigned long> const&, result const&) constLine | Count | Source | 452 | 722 | auto neq = [](const auto& a, const auto& b) { return a != b; }; |
auto Conversion<(UtfEncodings)3, (UtfEncodings)2, unsigned long (simdutf::implementation::*)(char32_t const*, unsigned long) noexcept const, unsigned long (simdutf::implementation::*)(char32_t const*, unsigned long, char*) noexcept const>::do_conversion(std::__1::span<char32_t const, 18446744073709551615ul>, std::__1::vector<unsigned long, std::__1::allocator<unsigned long> > const&, bool) const::{lambda(auto:1 const&, auto:2 const&)#1}::operator()<result<unsigned long>, result>(result<unsigned long> const&, result const&) constLine | Count | Source | 452 | 796 | auto neq = [](const auto& a, const auto& b) { return a != b; }; |
auto Conversion<(UtfEncodings)2, (UtfEncodings)0, unsigned long (simdutf::implementation::*)(char const*, unsigned long) noexcept const, unsigned long (simdutf::implementation::*)(char const*, unsigned long, char16_t*) noexcept const>::do_conversion(std::__1::span<char const, 18446744073709551615ul>, std::__1::vector<unsigned long, std::__1::allocator<unsigned long> > const&, bool) const::{lambda(auto:1 const&, auto:2 const&)#1}::operator()<result<unsigned long>, result>(result<unsigned long> const&, result const&) constLine | Count | Source | 452 | 1.15k | auto neq = [](const auto& a, const auto& b) { return a != b; }; |
auto Conversion<(UtfEncodings)2, (UtfEncodings)1, unsigned long (simdutf::implementation::*)(char const*, unsigned long) noexcept const, unsigned long (simdutf::implementation::*)(char const*, unsigned long, char16_t*) noexcept const>::do_conversion(std::__1::span<char const, 18446744073709551615ul>, std::__1::vector<unsigned long, std::__1::allocator<unsigned long> > const&, bool) const::{lambda(auto:1 const&, auto:2 const&)#1}::operator()<result<unsigned long>, result>(result<unsigned long> const&, result const&) constLine | Count | Source | 452 | 1.02k | auto neq = [](const auto& a, const auto& b) { return a != b; }; |
auto Conversion<(UtfEncodings)2, (UtfEncodings)3, unsigned long (simdutf::implementation::*)(char const*, unsigned long) noexcept const, unsigned long (simdutf::implementation::*)(char const*, unsigned long, char32_t*) noexcept const>::do_conversion(std::__1::span<char const, 18446744073709551615ul>, std::__1::vector<unsigned long, std::__1::allocator<unsigned long> > const&, bool) const::{lambda(auto:1 const&, auto:2 const&)#1}::operator()<result<unsigned long>, result>(result<unsigned long> const&, result const&) constLine | Count | Source | 452 | 1.10k | auto neq = [](const auto& a, const auto& b) { return a != b; }; |
auto Conversion<(UtfEncodings)0, (UtfEncodings)4, unsigned long (simdutf::implementation::*)(unsigned long) noexcept const, unsigned long (simdutf::implementation::*)(char16_t const*, unsigned long, char*) noexcept const>::do_conversion(std::__1::span<char16_t const, 18446744073709551615ul>, std::__1::vector<unsigned long, std::__1::allocator<unsigned long> > const&, bool) const::{lambda(auto:1 const&, auto:2 const&)#1}::operator()<result<unsigned long>, result>(result<unsigned long> const&, result const&) constLine | Count | Source | 452 | 126 | auto neq = [](const auto& a, const auto& b) { return a != b; }; |
auto Conversion<(UtfEncodings)1, (UtfEncodings)4, unsigned long (simdutf::implementation::*)(unsigned long) noexcept const, unsigned long (simdutf::implementation::*)(char16_t const*, unsigned long, char*) noexcept const>::do_conversion(std::__1::span<char16_t const, 18446744073709551615ul>, std::__1::vector<unsigned long, std::__1::allocator<unsigned long> > const&, bool) const::{lambda(auto:1 const&, auto:2 const&)#1}::operator()<result<unsigned long>, result>(result<unsigned long> const&, result const&) constLine | Count | Source | 452 | 124 | auto neq = [](const auto& a, const auto& b) { return a != b; }; |
auto Conversion<(UtfEncodings)3, (UtfEncodings)4, unsigned long (simdutf::implementation::*)(unsigned long) noexcept const, unsigned long (simdutf::implementation::*)(char32_t const*, unsigned long, char*) noexcept const>::do_conversion(std::__1::span<char32_t const, 18446744073709551615ul>, std::__1::vector<unsigned long, std::__1::allocator<unsigned long> > const&, bool) const::{lambda(auto:1 const&, auto:2 const&)#1}::operator()<result<unsigned long>, result>(result<unsigned long> const&, result const&) constLine | Count | Source | 452 | 188 | auto neq = [](const auto& a, const auto& b) { return a != b; }; |
auto Conversion<(UtfEncodings)2, (UtfEncodings)4, unsigned long (simdutf::implementation::*)(char const*, unsigned long) noexcept const, unsigned long (simdutf::implementation::*)(char const*, unsigned long, char*) noexcept const>::do_conversion(std::__1::span<char const, 18446744073709551615ul>, std::__1::vector<unsigned long, std::__1::allocator<unsigned long> > const&, bool) const::{lambda(auto:1 const&, auto:2 const&)#1}::operator()<result<unsigned long>, result>(result<unsigned long> const&, result const&) constLine | Count | Source | 452 | 562 | auto neq = [](const auto& a, const auto& b) { return a != b; }; |
auto Conversion<(UtfEncodings)0, (UtfEncodings)4, unsigned long (simdutf::implementation::*)(unsigned long) noexcept const, simdutf::result (simdutf::implementation::*)(char16_t const*, unsigned long, char*) noexcept const>::do_conversion(std::__1::span<char16_t const, 18446744073709551615ul>, std::__1::vector<unsigned long, std::__1::allocator<unsigned long> > const&, bool) const::{lambda(auto:1 const&, auto:2 const&)#1}::operator()<result<simdutf::result>, result>(result<simdutf::result> const&, result const&) constLine | Count | Source | 452 | 252 | auto neq = [](const auto& a, const auto& b) { return a != b; }; |
auto Conversion<(UtfEncodings)0, (UtfEncodings)3, unsigned long (simdutf::implementation::*)(char16_t const*, unsigned long) noexcept const, simdutf::result (simdutf::implementation::*)(char16_t const*, unsigned long, char32_t*) noexcept const>::do_conversion(std::__1::span<char16_t const, 18446744073709551615ul>, std::__1::vector<unsigned long, std::__1::allocator<unsigned long> > const&, bool) const::{lambda(auto:1 const&, auto:2 const&)#1}::operator()<result<simdutf::result>, result>(result<simdutf::result> const&, result const&) constLine | Count | Source | 452 | 300 | auto neq = [](const auto& a, const auto& b) { return a != b; }; |
auto Conversion<(UtfEncodings)0, (UtfEncodings)2, unsigned long (simdutf::implementation::*)(char16_t const*, unsigned long) noexcept const, simdutf::result (simdutf::implementation::*)(char16_t const*, unsigned long, char*) noexcept const>::do_conversion(std::__1::span<char16_t const, 18446744073709551615ul>, std::__1::vector<unsigned long, std::__1::allocator<unsigned long> > const&, bool) const::{lambda(auto:1 const&, auto:2 const&)#1}::operator()<result<simdutf::result>, result>(result<simdutf::result> const&, result const&) constLine | Count | Source | 452 | 586 | auto neq = [](const auto& a, const auto& b) { return a != b; }; |
auto Conversion<(UtfEncodings)1, (UtfEncodings)4, unsigned long (simdutf::implementation::*)(unsigned long) noexcept const, simdutf::result (simdutf::implementation::*)(char16_t const*, unsigned long, char*) noexcept const>::do_conversion(std::__1::span<char16_t const, 18446744073709551615ul>, std::__1::vector<unsigned long, std::__1::allocator<unsigned long> > const&, bool) const::{lambda(auto:1 const&, auto:2 const&)#1}::operator()<result<simdutf::result>, result>(result<simdutf::result> const&, result const&) constLine | Count | Source | 452 | 230 | auto neq = [](const auto& a, const auto& b) { return a != b; }; |
auto Conversion<(UtfEncodings)1, (UtfEncodings)3, unsigned long (simdutf::implementation::*)(char16_t const*, unsigned long) noexcept const, simdutf::result (simdutf::implementation::*)(char16_t const*, unsigned long, char32_t*) noexcept const>::do_conversion(std::__1::span<char16_t const, 18446744073709551615ul>, std::__1::vector<unsigned long, std::__1::allocator<unsigned long> > const&, bool) const::{lambda(auto:1 const&, auto:2 const&)#1}::operator()<result<simdutf::result>, result>(result<simdutf::result> const&, result const&) constLine | Count | Source | 452 | 414 | auto neq = [](const auto& a, const auto& b) { return a != b; }; |
auto Conversion<(UtfEncodings)1, (UtfEncodings)2, unsigned long (simdutf::implementation::*)(char16_t const*, unsigned long) noexcept const, simdutf::result (simdutf::implementation::*)(char16_t const*, unsigned long, char*) noexcept const>::do_conversion(std::__1::span<char16_t const, 18446744073709551615ul>, std::__1::vector<unsigned long, std::__1::allocator<unsigned long> > const&, bool) const::{lambda(auto:1 const&, auto:2 const&)#1}::operator()<result<simdutf::result>, result>(result<simdutf::result> const&, result const&) constLine | Count | Source | 452 | 630 | auto neq = [](const auto& a, const auto& b) { return a != b; }; |
auto Conversion<(UtfEncodings)3, (UtfEncodings)4, unsigned long (simdutf::implementation::*)(unsigned long) noexcept const, simdutf::result (simdutf::implementation::*)(char32_t const*, unsigned long, char*) noexcept const>::do_conversion(std::__1::span<char32_t const, 18446744073709551615ul>, std::__1::vector<unsigned long, std::__1::allocator<unsigned long> > const&, bool) const::{lambda(auto:1 const&, auto:2 const&)#1}::operator()<result<simdutf::result>, result>(result<simdutf::result> const&, result const&) constLine | Count | Source | 452 | 420 | auto neq = [](const auto& a, const auto& b) { return a != b; }; |
auto Conversion<(UtfEncodings)3, (UtfEncodings)0, unsigned long (simdutf::implementation::*)(char32_t const*, unsigned long) noexcept const, simdutf::result (simdutf::implementation::*)(char32_t const*, unsigned long, char16_t*) noexcept const>::do_conversion(std::__1::span<char32_t const, 18446744073709551615ul>, std::__1::vector<unsigned long, std::__1::allocator<unsigned long> > const&, bool) const::{lambda(auto:1 const&, auto:2 const&)#1}::operator()<result<simdutf::result>, result>(result<simdutf::result> const&, result const&) constLine | Count | Source | 452 | 606 | auto neq = [](const auto& a, const auto& b) { return a != b; }; |
auto Conversion<(UtfEncodings)3, (UtfEncodings)1, unsigned long (simdutf::implementation::*)(char32_t const*, unsigned long) noexcept const, simdutf::result (simdutf::implementation::*)(char32_t const*, unsigned long, char16_t*) noexcept const>::do_conversion(std::__1::span<char32_t const, 18446744073709551615ul>, std::__1::vector<unsigned long, std::__1::allocator<unsigned long> > const&, bool) const::{lambda(auto:1 const&, auto:2 const&)#1}::operator()<result<simdutf::result>, result>(result<simdutf::result> const&, result const&) constLine | Count | Source | 452 | 716 | auto neq = [](const auto& a, const auto& b) { return a != b; }; |
auto Conversion<(UtfEncodings)3, (UtfEncodings)2, unsigned long (simdutf::implementation::*)(char32_t const*, unsigned long) noexcept const, simdutf::result (simdutf::implementation::*)(char32_t const*, unsigned long, char*) noexcept const>::do_conversion(std::__1::span<char32_t const, 18446744073709551615ul>, std::__1::vector<unsigned long, std::__1::allocator<unsigned long> > const&, bool) const::{lambda(auto:1 const&, auto:2 const&)#1}::operator()<result<simdutf::result>, result>(result<simdutf::result> const&, result const&) constLine | Count | Source | 452 | 830 | auto neq = [](const auto& a, const auto& b) { return a != b; }; |
auto Conversion<(UtfEncodings)2, (UtfEncodings)4, unsigned long (simdutf::implementation::*)(char const*, unsigned long) noexcept const, simdutf::result (simdutf::implementation::*)(char const*, unsigned long, char*) noexcept const>::do_conversion(std::__1::span<char const, 18446744073709551615ul>, std::__1::vector<unsigned long, std::__1::allocator<unsigned long> > const&, bool) const::{lambda(auto:1 const&, auto:2 const&)#1}::operator()<result<simdutf::result>, result>(result<simdutf::result> const&, result const&) constLine | Count | Source | 452 | 516 | auto neq = [](const auto& a, const auto& b) { return a != b; }; |
auto Conversion<(UtfEncodings)2, (UtfEncodings)0, unsigned long (simdutf::implementation::*)(char const*, unsigned long) noexcept const, simdutf::result (simdutf::implementation::*)(char const*, unsigned long, char16_t*) noexcept const>::do_conversion(std::__1::span<char const, 18446744073709551615ul>, std::__1::vector<unsigned long, std::__1::allocator<unsigned long> > const&, bool) const::{lambda(auto:1 const&, auto:2 const&)#1}::operator()<result<simdutf::result>, result>(result<simdutf::result> const&, result const&) constLine | Count | Source | 452 | 702 | auto neq = [](const auto& a, const auto& b) { return a != b; }; |
auto Conversion<(UtfEncodings)2, (UtfEncodings)1, unsigned long (simdutf::implementation::*)(char const*, unsigned long) noexcept const, simdutf::result (simdutf::implementation::*)(char const*, unsigned long, char16_t*) noexcept const>::do_conversion(std::__1::span<char const, 18446744073709551615ul>, std::__1::vector<unsigned long, std::__1::allocator<unsigned long> > const&, bool) const::{lambda(auto:1 const&, auto:2 const&)#1}::operator()<result<simdutf::result>, result>(result<simdutf::result> const&, result const&) constLine | Count | Source | 452 | 574 | auto neq = [](const auto& a, const auto& b) { return a != b; }; |
auto Conversion<(UtfEncodings)2, (UtfEncodings)3, unsigned long (simdutf::implementation::*)(char const*, unsigned long) noexcept const, simdutf::result (simdutf::implementation::*)(char const*, unsigned long, char32_t*) noexcept const>::do_conversion(std::__1::span<char const, 18446744073709551615ul>, std::__1::vector<unsigned long, std::__1::allocator<unsigned long> > const&, bool) const::{lambda(auto:1 const&, auto:2 const&)#1}::operator()<result<simdutf::result>, result>(result<simdutf::result> const&, result const&) constLine | Count | Source | 452 | 738 | auto neq = [](const auto& a, const auto& b) { return a != b; }; |
auto Conversion<(UtfEncodings)4, (UtfEncodings)3, unsigned long (simdutf::implementation::*)(unsigned long) noexcept const, unsigned long (simdutf::implementation::*)(char const*, unsigned long, char32_t*) noexcept const>::do_conversion(std::__1::span<char const, 18446744073709551615ul>, std::__1::vector<unsigned long, std::__1::allocator<unsigned long> > const&, bool) const::{lambda(auto:1 const&, auto:2 const&)#1}::operator()<result<unsigned long>, result>(result<unsigned long> const&, result const&) constLine | Count | Source | 452 | 90 | auto neq = [](const auto& a, const auto& b) { return a != b; }; |
auto Conversion<(UtfEncodings)4, (UtfEncodings)0, unsigned long (simdutf::implementation::*)(unsigned long) noexcept const, unsigned long (simdutf::implementation::*)(char const*, unsigned long, char16_t*) noexcept const>::do_conversion(std::__1::span<char const, 18446744073709551615ul>, std::__1::vector<unsigned long, std::__1::allocator<unsigned long> > const&, bool) const::{lambda(auto:1 const&, auto:2 const&)#1}::operator()<result<unsigned long>, result>(result<unsigned long> const&, result const&) constLine | Count | Source | 452 | 80 | auto neq = [](const auto& a, const auto& b) { return a != b; }; |
auto Conversion<(UtfEncodings)4, (UtfEncodings)1, unsigned long (simdutf::implementation::*)(unsigned long) noexcept const, unsigned long (simdutf::implementation::*)(char const*, unsigned long, char16_t*) noexcept const>::do_conversion(std::__1::span<char const, 18446744073709551615ul>, std::__1::vector<unsigned long, std::__1::allocator<unsigned long> > const&, bool) const::{lambda(auto:1 const&, auto:2 const&)#1}::operator()<result<unsigned long>, result>(result<unsigned long> const&, result const&) constLine | Count | Source | 452 | 80 | auto neq = [](const auto& a, const auto& b) { return a != b; }; |
auto Conversion<(UtfEncodings)4, (UtfEncodings)2, unsigned long (simdutf::implementation::*)(char const*, unsigned long) noexcept const, unsigned long (simdutf::implementation::*)(char const*, unsigned long, char*) noexcept const>::do_conversion(std::__1::span<char const, 18446744073709551615ul>, std::__1::vector<unsigned long, std::__1::allocator<unsigned long> > const&, bool) const::{lambda(auto:1 const&, auto:2 const&)#1}::operator()<result<unsigned long>, result>(result<unsigned long> const&, result const&) constLine | Count | Source | 452 | 538 | auto neq = [](const auto& a, const auto& b) { return a != b; }; |
|
453 | 8.47k | if (std::ranges::adjacent_find(results, neq) != results.end()) { |
454 | 0 | std::cerr << "begin errormessage for do_conversion\n"; |
455 | 0 | std::cerr << "in fuzz case for " << name << " invoked with " << src.size() |
456 | 0 | << " elements:\n"; |
457 | 0 | std::cerr << "input data is valid ? " << inputisvalid << '\n'; |
458 | 0 | for (std::size_t i = 0; i < results.size(); ++i) { |
459 | 0 | std::cerr << "got return " << std::dec << results[i] |
460 | 0 | << " from implementation " << implementations[i]->name() |
461 | 0 | << " using outlen=" << outlength.at(i) << '\n'; |
462 | 0 | } |
463 | 0 | for (std::size_t i = 0; i < results.size(); ++i) { |
464 | 0 | std::cerr << "implementation " << implementations[i]->name() |
465 | 0 | << " out: "; |
466 | 0 | for (const auto e : outputbuffers.at(i)) { |
467 | 0 | std::cerr << +e << ", "; |
468 | 0 | } |
469 | 0 | std::cerr << '\n'; |
470 | 0 | } |
471 | 0 | std::cerr << "end errormessage\n"; |
472 | 0 | ret.implementations_agree = false; |
473 | 8.47k | } else { |
474 | 8.47k | ret.implementations_agree = true; |
475 | 8.47k | } |
476 | 8.47k | return ret; |
477 | 8.47k | } Conversion<(UtfEncodings)0, (UtfEncodings)3, unsigned long (simdutf::implementation::*)(char16_t const*, unsigned long) noexcept const, unsigned long (simdutf::implementation::*)(char16_t const*, unsigned long, char32_t*) noexcept const>::do_conversion(std::__1::span<char16_t const, 18446744073709551615ul>, std::__1::vector<unsigned long, std::__1::allocator<unsigned long> > const&, bool) const Line | Count | Source | 382 | 183 | const bool inputisvalid) const { | 383 | 183 | conversion_result ret{}; | 384 | | | 385 | 183 | const auto implementations = get_supported_implementations(); | 386 | | | 387 | 183 | std::vector<result<ConversionResult>> results; | 388 | 183 | results.reserve(implementations.size()); | 389 | | | 390 | | // put the output in a separate allocation to make access violations easier | 391 | | // to catch | 392 | 183 | std::vector<std::vector<ToType>> outputbuffers; | 393 | 183 | outputbuffers.reserve(implementations.size()); | 394 | 732 | for (std::size_t i = 0; i < implementations.size(); ++i) { | 395 | 549 | auto impl = implementations[i]; | 396 | 549 | const ToType canary1{42}; | 397 | 549 | auto& outputbuffer = outputbuffers.emplace_back(outlength.at(i), canary1); | 398 | 549 | const auto implret1 = std::invoke(conversion, impl, src.data(), | 399 | 549 | src.size(), outputbuffer.data()); | 400 | | // was the conversion successful? | 401 | 549 | const auto success = [](const ConversionResult& r) -> bool { | 402 | 549 | if constexpr (std::is_same_v<ConversionResult, std::size_t>) { | 403 | 549 | return r != 0; | 404 | 549 | } else { | 405 | 549 | return r.error == simdutf::error_code::SUCCESS; | 406 | 549 | } | 407 | 549 | }(implret1); | 408 | 549 | const auto hash1 = FNV1A_hash::as_str(outputbuffer); | 409 | 549 | if constexpr (use_canary_in_output) { | 410 | | // optionally convert again, this time with the buffer filled with | 411 | | // a different value. if the output differs, it means some of the buffer | 412 | | // was not written to by the conversion function. | 413 | 549 | const ToType canary2{25}; | 414 | 549 | const auto outputbuffer_first_run = outputbuffer; | 415 | 549 | std::ranges::fill(outputbuffer, canary2); | 416 | 549 | const auto implret2 = std::invoke(conversion, impl, src.data(), | 417 | 549 | src.size(), outputbuffer.data()); | 418 | | | 419 | 549 | if (implret1 != implret2) { | 420 | 0 | std::cerr << "different return value the second time!\n"; | 421 | 0 | std::abort(); | 422 | 0 | } | 423 | 549 | if (inputisvalid && success) { | 424 | | // only care about the output if the input is valid | 425 | 318 | const auto hash2 = FNV1A_hash::as_str(outputbuffer); | 426 | 318 | if (hash1 != hash2) { | 427 | 0 | std::cerr << "different output the second time!\n"; | 428 | 0 | std::cerr << "implementation " << impl->name() << " " << name | 429 | 0 | << '\n'; | 430 | 0 | std::cerr << "input is valid=" << inputisvalid << '\n'; | 431 | 0 | std::cerr << "output length=" << outputbuffer.size() << '\n'; | 432 | 0 | std::cerr << "conversion was a success? " << success << '\n'; | 433 | 0 | for (std::size_t j = 0; j < outputbuffer.size(); ++j) { | 434 | 0 | std::cerr << "output[" << j << "]\t" << +outputbuffer_first_run[j] | 435 | 0 | << '\t' << +outputbuffer[j] << '\n'; | 436 | 0 | } | 437 | 0 | std::abort(); | 438 | 0 | } | 439 | 318 | } | 440 | 549 | } | 441 | 549 | results.emplace_back(implret1, success ? hash1 : ""); | 442 | 549 | } | 443 | | | 444 | | // do not require implementations to give the same output if | 445 | | // the input is not valid. | 446 | 183 | if (!inputisvalid) { | 447 | 222 | for (auto& e : results) { | 448 | 222 | e.outputhash.clear(); | 449 | 222 | } | 450 | 74 | } | 451 | | | 452 | 183 | auto neq = [](const auto& a, const auto& b) { return a != b; }; | 453 | 183 | if (std::ranges::adjacent_find(results, neq) != results.end()) { | 454 | 0 | std::cerr << "begin errormessage for do_conversion\n"; | 455 | 0 | std::cerr << "in fuzz case for " << name << " invoked with " << src.size() | 456 | 0 | << " elements:\n"; | 457 | 0 | std::cerr << "input data is valid ? " << inputisvalid << '\n'; | 458 | 0 | for (std::size_t i = 0; i < results.size(); ++i) { | 459 | 0 | std::cerr << "got return " << std::dec << results[i] | 460 | 0 | << " from implementation " << implementations[i]->name() | 461 | 0 | << " using outlen=" << outlength.at(i) << '\n'; | 462 | 0 | } | 463 | 0 | for (std::size_t i = 0; i < results.size(); ++i) { | 464 | 0 | std::cerr << "implementation " << implementations[i]->name() | 465 | 0 | << " out: "; | 466 | 0 | for (const auto e : outputbuffers.at(i)) { | 467 | 0 | std::cerr << +e << ", "; | 468 | 0 | } | 469 | 0 | std::cerr << '\n'; | 470 | 0 | } | 471 | 0 | std::cerr << "end errormessage\n"; | 472 | 0 | ret.implementations_agree = false; | 473 | 183 | } else { | 474 | 183 | ret.implementations_agree = true; | 475 | 183 | } | 476 | 183 | return ret; | 477 | 183 | } |
Conversion<(UtfEncodings)0, (UtfEncodings)2, unsigned long (simdutf::implementation::*)(char16_t const*, unsigned long) noexcept const, unsigned long (simdutf::implementation::*)(char16_t const*, unsigned long, char*) noexcept const>::do_conversion(std::__1::span<char16_t const, 18446744073709551615ul>, std::__1::vector<unsigned long, std::__1::allocator<unsigned long> > const&, bool) const Line | Count | Source | 382 | 384 | const bool inputisvalid) const { | 383 | 384 | conversion_result ret{}; | 384 | | | 385 | 384 | const auto implementations = get_supported_implementations(); | 386 | | | 387 | 384 | std::vector<result<ConversionResult>> results; | 388 | 384 | results.reserve(implementations.size()); | 389 | | | 390 | | // put the output in a separate allocation to make access violations easier | 391 | | // to catch | 392 | 384 | std::vector<std::vector<ToType>> outputbuffers; | 393 | 384 | outputbuffers.reserve(implementations.size()); | 394 | 1.53k | for (std::size_t i = 0; i < implementations.size(); ++i) { | 395 | 1.15k | auto impl = implementations[i]; | 396 | 1.15k | const ToType canary1{42}; | 397 | 1.15k | auto& outputbuffer = outputbuffers.emplace_back(outlength.at(i), canary1); | 398 | 1.15k | const auto implret1 = std::invoke(conversion, impl, src.data(), | 399 | 1.15k | src.size(), outputbuffer.data()); | 400 | | // was the conversion successful? | 401 | 1.15k | const auto success = [](const ConversionResult& r) -> bool { | 402 | 1.15k | if constexpr (std::is_same_v<ConversionResult, std::size_t>) { | 403 | 1.15k | return r != 0; | 404 | 1.15k | } else { | 405 | 1.15k | return r.error == simdutf::error_code::SUCCESS; | 406 | 1.15k | } | 407 | 1.15k | }(implret1); | 408 | 1.15k | const auto hash1 = FNV1A_hash::as_str(outputbuffer); | 409 | 1.15k | if constexpr (use_canary_in_output) { | 410 | | // optionally convert again, this time with the buffer filled with | 411 | | // a different value. if the output differs, it means some of the buffer | 412 | | // was not written to by the conversion function. | 413 | 1.15k | const ToType canary2{25}; | 414 | 1.15k | const auto outputbuffer_first_run = outputbuffer; | 415 | 1.15k | std::ranges::fill(outputbuffer, canary2); | 416 | 1.15k | const auto implret2 = std::invoke(conversion, impl, src.data(), | 417 | 1.15k | src.size(), outputbuffer.data()); | 418 | | | 419 | 1.15k | if (implret1 != implret2) { | 420 | 0 | std::cerr << "different return value the second time!\n"; | 421 | 0 | std::abort(); | 422 | 0 | } | 423 | 1.15k | if (inputisvalid && success) { | 424 | | // only care about the output if the input is valid | 425 | 945 | const auto hash2 = FNV1A_hash::as_str(outputbuffer); | 426 | 945 | if (hash1 != hash2) { | 427 | 0 | std::cerr << "different output the second time!\n"; | 428 | 0 | std::cerr << "implementation " << impl->name() << " " << name | 429 | 0 | << '\n'; | 430 | 0 | std::cerr << "input is valid=" << inputisvalid << '\n'; | 431 | 0 | std::cerr << "output length=" << outputbuffer.size() << '\n'; | 432 | 0 | std::cerr << "conversion was a success? " << success << '\n'; | 433 | 0 | for (std::size_t j = 0; j < outputbuffer.size(); ++j) { | 434 | 0 | std::cerr << "output[" << j << "]\t" << +outputbuffer_first_run[j] | 435 | 0 | << '\t' << +outputbuffer[j] << '\n'; | 436 | 0 | } | 437 | 0 | std::abort(); | 438 | 0 | } | 439 | 945 | } | 440 | 1.15k | } | 441 | 1.15k | results.emplace_back(implret1, success ? hash1 : ""); | 442 | 1.15k | } | 443 | | | 444 | | // do not require implementations to give the same output if | 445 | | // the input is not valid. | 446 | 384 | if (!inputisvalid) { | 447 | 198 | for (auto& e : results) { | 448 | 198 | e.outputhash.clear(); | 449 | 198 | } | 450 | 66 | } | 451 | | | 452 | 384 | auto neq = [](const auto& a, const auto& b) { return a != b; }; | 453 | 384 | if (std::ranges::adjacent_find(results, neq) != results.end()) { | 454 | 0 | std::cerr << "begin errormessage for do_conversion\n"; | 455 | 0 | std::cerr << "in fuzz case for " << name << " invoked with " << src.size() | 456 | 0 | << " elements:\n"; | 457 | 0 | std::cerr << "input data is valid ? " << inputisvalid << '\n'; | 458 | 0 | for (std::size_t i = 0; i < results.size(); ++i) { | 459 | 0 | std::cerr << "got return " << std::dec << results[i] | 460 | 0 | << " from implementation " << implementations[i]->name() | 461 | 0 | << " using outlen=" << outlength.at(i) << '\n'; | 462 | 0 | } | 463 | 0 | for (std::size_t i = 0; i < results.size(); ++i) { | 464 | 0 | std::cerr << "implementation " << implementations[i]->name() | 465 | 0 | << " out: "; | 466 | 0 | for (const auto e : outputbuffers.at(i)) { | 467 | 0 | std::cerr << +e << ", "; | 468 | 0 | } | 469 | 0 | std::cerr << '\n'; | 470 | 0 | } | 471 | 0 | std::cerr << "end errormessage\n"; | 472 | 0 | ret.implementations_agree = false; | 473 | 384 | } else { | 474 | 384 | ret.implementations_agree = true; | 475 | 384 | } | 476 | 384 | return ret; | 477 | 384 | } |
Conversion<(UtfEncodings)1, (UtfEncodings)3, unsigned long (simdutf::implementation::*)(char16_t const*, unsigned long) noexcept const, unsigned long (simdutf::implementation::*)(char16_t const*, unsigned long, char32_t*) noexcept const>::do_conversion(std::__1::span<char16_t const, 18446744073709551615ul>, std::__1::vector<unsigned long, std::__1::allocator<unsigned long> > const&, bool) const Line | Count | Source | 382 | 192 | const bool inputisvalid) const { | 383 | 192 | conversion_result ret{}; | 384 | | | 385 | 192 | const auto implementations = get_supported_implementations(); | 386 | | | 387 | 192 | std::vector<result<ConversionResult>> results; | 388 | 192 | results.reserve(implementations.size()); | 389 | | | 390 | | // put the output in a separate allocation to make access violations easier | 391 | | // to catch | 392 | 192 | std::vector<std::vector<ToType>> outputbuffers; | 393 | 192 | outputbuffers.reserve(implementations.size()); | 394 | 768 | for (std::size_t i = 0; i < implementations.size(); ++i) { | 395 | 576 | auto impl = implementations[i]; | 396 | 576 | const ToType canary1{42}; | 397 | 576 | auto& outputbuffer = outputbuffers.emplace_back(outlength.at(i), canary1); | 398 | 576 | const auto implret1 = std::invoke(conversion, impl, src.data(), | 399 | 576 | src.size(), outputbuffer.data()); | 400 | | // was the conversion successful? | 401 | 576 | const auto success = [](const ConversionResult& r) -> bool { | 402 | 576 | if constexpr (std::is_same_v<ConversionResult, std::size_t>) { | 403 | 576 | return r != 0; | 404 | 576 | } else { | 405 | 576 | return r.error == simdutf::error_code::SUCCESS; | 406 | 576 | } | 407 | 576 | }(implret1); | 408 | 576 | const auto hash1 = FNV1A_hash::as_str(outputbuffer); | 409 | 576 | if constexpr (use_canary_in_output) { | 410 | | // optionally convert again, this time with the buffer filled with | 411 | | // a different value. if the output differs, it means some of the buffer | 412 | | // was not written to by the conversion function. | 413 | 576 | const ToType canary2{25}; | 414 | 576 | const auto outputbuffer_first_run = outputbuffer; | 415 | 576 | std::ranges::fill(outputbuffer, canary2); | 416 | 576 | const auto implret2 = std::invoke(conversion, impl, src.data(), | 417 | 576 | src.size(), outputbuffer.data()); | 418 | | | 419 | 576 | if (implret1 != implret2) { | 420 | 0 | std::cerr << "different return value the second time!\n"; | 421 | 0 | std::abort(); | 422 | 0 | } | 423 | 576 | if (inputisvalid && success) { | 424 | | // only care about the output if the input is valid | 425 | 309 | const auto hash2 = FNV1A_hash::as_str(outputbuffer); | 426 | 309 | if (hash1 != hash2) { | 427 | 0 | std::cerr << "different output the second time!\n"; | 428 | 0 | std::cerr << "implementation " << impl->name() << " " << name | 429 | 0 | << '\n'; | 430 | 0 | std::cerr << "input is valid=" << inputisvalid << '\n'; | 431 | 0 | std::cerr << "output length=" << outputbuffer.size() << '\n'; | 432 | 0 | std::cerr << "conversion was a success? " << success << '\n'; | 433 | 0 | for (std::size_t j = 0; j < outputbuffer.size(); ++j) { | 434 | 0 | std::cerr << "output[" << j << "]\t" << +outputbuffer_first_run[j] | 435 | 0 | << '\t' << +outputbuffer[j] << '\n'; | 436 | 0 | } | 437 | 0 | std::abort(); | 438 | 0 | } | 439 | 309 | } | 440 | 576 | } | 441 | 576 | results.emplace_back(implret1, success ? hash1 : ""); | 442 | 576 | } | 443 | | | 444 | | // do not require implementations to give the same output if | 445 | | // the input is not valid. | 446 | 192 | if (!inputisvalid) { | 447 | 255 | for (auto& e : results) { | 448 | 255 | e.outputhash.clear(); | 449 | 255 | } | 450 | 85 | } | 451 | | | 452 | 192 | auto neq = [](const auto& a, const auto& b) { return a != b; }; | 453 | 192 | if (std::ranges::adjacent_find(results, neq) != results.end()) { | 454 | 0 | std::cerr << "begin errormessage for do_conversion\n"; | 455 | 0 | std::cerr << "in fuzz case for " << name << " invoked with " << src.size() | 456 | 0 | << " elements:\n"; | 457 | 0 | std::cerr << "input data is valid ? " << inputisvalid << '\n'; | 458 | 0 | for (std::size_t i = 0; i < results.size(); ++i) { | 459 | 0 | std::cerr << "got return " << std::dec << results[i] | 460 | 0 | << " from implementation " << implementations[i]->name() | 461 | 0 | << " using outlen=" << outlength.at(i) << '\n'; | 462 | 0 | } | 463 | 0 | for (std::size_t i = 0; i < results.size(); ++i) { | 464 | 0 | std::cerr << "implementation " << implementations[i]->name() | 465 | 0 | << " out: "; | 466 | 0 | for (const auto e : outputbuffers.at(i)) { | 467 | 0 | std::cerr << +e << ", "; | 468 | 0 | } | 469 | 0 | std::cerr << '\n'; | 470 | 0 | } | 471 | 0 | std::cerr << "end errormessage\n"; | 472 | 0 | ret.implementations_agree = false; | 473 | 192 | } else { | 474 | 192 | ret.implementations_agree = true; | 475 | 192 | } | 476 | 192 | return ret; | 477 | 192 | } |
Conversion<(UtfEncodings)1, (UtfEncodings)2, unsigned long (simdutf::implementation::*)(char16_t const*, unsigned long) noexcept const, unsigned long (simdutf::implementation::*)(char16_t const*, unsigned long, char*) noexcept const>::do_conversion(std::__1::span<char16_t const, 18446744073709551615ul>, std::__1::vector<unsigned long, std::__1::allocator<unsigned long> > const&, bool) const Line | Count | Source | 382 | 401 | const bool inputisvalid) const { | 383 | 401 | conversion_result ret{}; | 384 | | | 385 | 401 | const auto implementations = get_supported_implementations(); | 386 | | | 387 | 401 | std::vector<result<ConversionResult>> results; | 388 | 401 | results.reserve(implementations.size()); | 389 | | | 390 | | // put the output in a separate allocation to make access violations easier | 391 | | // to catch | 392 | 401 | std::vector<std::vector<ToType>> outputbuffers; | 393 | 401 | outputbuffers.reserve(implementations.size()); | 394 | 1.60k | for (std::size_t i = 0; i < implementations.size(); ++i) { | 395 | 1.20k | auto impl = implementations[i]; | 396 | 1.20k | const ToType canary1{42}; | 397 | 1.20k | auto& outputbuffer = outputbuffers.emplace_back(outlength.at(i), canary1); | 398 | 1.20k | const auto implret1 = std::invoke(conversion, impl, src.data(), | 399 | 1.20k | src.size(), outputbuffer.data()); | 400 | | // was the conversion successful? | 401 | 1.20k | const auto success = [](const ConversionResult& r) -> bool { | 402 | 1.20k | if constexpr (std::is_same_v<ConversionResult, std::size_t>) { | 403 | 1.20k | return r != 0; | 404 | 1.20k | } else { | 405 | 1.20k | return r.error == simdutf::error_code::SUCCESS; | 406 | 1.20k | } | 407 | 1.20k | }(implret1); | 408 | 1.20k | const auto hash1 = FNV1A_hash::as_str(outputbuffer); | 409 | 1.20k | if constexpr (use_canary_in_output) { | 410 | | // optionally convert again, this time with the buffer filled with | 411 | | // a different value. if the output differs, it means some of the buffer | 412 | | // was not written to by the conversion function. | 413 | 1.20k | const ToType canary2{25}; | 414 | 1.20k | const auto outputbuffer_first_run = outputbuffer; | 415 | 1.20k | std::ranges::fill(outputbuffer, canary2); | 416 | 1.20k | const auto implret2 = std::invoke(conversion, impl, src.data(), | 417 | 1.20k | src.size(), outputbuffer.data()); | 418 | | | 419 | 1.20k | if (implret1 != implret2) { | 420 | 0 | std::cerr << "different return value the second time!\n"; | 421 | 0 | std::abort(); | 422 | 0 | } | 423 | 1.20k | if (inputisvalid && success) { | 424 | | // only care about the output if the input is valid | 425 | 951 | const auto hash2 = FNV1A_hash::as_str(outputbuffer); | 426 | 951 | if (hash1 != hash2) { | 427 | 0 | std::cerr << "different output the second time!\n"; | 428 | 0 | std::cerr << "implementation " << impl->name() << " " << name | 429 | 0 | << '\n'; | 430 | 0 | std::cerr << "input is valid=" << inputisvalid << '\n'; | 431 | 0 | std::cerr << "output length=" << outputbuffer.size() << '\n'; | 432 | 0 | std::cerr << "conversion was a success? " << success << '\n'; | 433 | 0 | for (std::size_t j = 0; j < outputbuffer.size(); ++j) { | 434 | 0 | std::cerr << "output[" << j << "]\t" << +outputbuffer_first_run[j] | 435 | 0 | << '\t' << +outputbuffer[j] << '\n'; | 436 | 0 | } | 437 | 0 | std::abort(); | 438 | 0 | } | 439 | 951 | } | 440 | 1.20k | } | 441 | 1.20k | results.emplace_back(implret1, success ? hash1 : ""); | 442 | 1.20k | } | 443 | | | 444 | | // do not require implementations to give the same output if | 445 | | // the input is not valid. | 446 | 401 | if (!inputisvalid) { | 447 | 240 | for (auto& e : results) { | 448 | 240 | e.outputhash.clear(); | 449 | 240 | } | 450 | 80 | } | 451 | | | 452 | 401 | auto neq = [](const auto& a, const auto& b) { return a != b; }; | 453 | 401 | if (std::ranges::adjacent_find(results, neq) != results.end()) { | 454 | 0 | std::cerr << "begin errormessage for do_conversion\n"; | 455 | 0 | std::cerr << "in fuzz case for " << name << " invoked with " << src.size() | 456 | 0 | << " elements:\n"; | 457 | 0 | std::cerr << "input data is valid ? " << inputisvalid << '\n'; | 458 | 0 | for (std::size_t i = 0; i < results.size(); ++i) { | 459 | 0 | std::cerr << "got return " << std::dec << results[i] | 460 | 0 | << " from implementation " << implementations[i]->name() | 461 | 0 | << " using outlen=" << outlength.at(i) << '\n'; | 462 | 0 | } | 463 | 0 | for (std::size_t i = 0; i < results.size(); ++i) { | 464 | 0 | std::cerr << "implementation " << implementations[i]->name() | 465 | 0 | << " out: "; | 466 | 0 | for (const auto e : outputbuffers.at(i)) { | 467 | 0 | std::cerr << +e << ", "; | 468 | 0 | } | 469 | 0 | std::cerr << '\n'; | 470 | 0 | } | 471 | 0 | std::cerr << "end errormessage\n"; | 472 | 0 | ret.implementations_agree = false; | 473 | 401 | } else { | 474 | 401 | ret.implementations_agree = true; | 475 | 401 | } | 476 | 401 | return ret; | 477 | 401 | } |
Conversion<(UtfEncodings)3, (UtfEncodings)0, unsigned long (simdutf::implementation::*)(char32_t const*, unsigned long) noexcept const, unsigned long (simdutf::implementation::*)(char32_t const*, unsigned long, char16_t*) noexcept const>::do_conversion(std::__1::span<char32_t const, 18446744073709551615ul>, std::__1::vector<unsigned long, std::__1::allocator<unsigned long> > const&, bool) const Line | Count | Source | 382 | 264 | const bool inputisvalid) const { | 383 | 264 | conversion_result ret{}; | 384 | | | 385 | 264 | const auto implementations = get_supported_implementations(); | 386 | | | 387 | 264 | std::vector<result<ConversionResult>> results; | 388 | 264 | results.reserve(implementations.size()); | 389 | | | 390 | | // put the output in a separate allocation to make access violations easier | 391 | | // to catch | 392 | 264 | std::vector<std::vector<ToType>> outputbuffers; | 393 | 264 | outputbuffers.reserve(implementations.size()); | 394 | 1.05k | for (std::size_t i = 0; i < implementations.size(); ++i) { | 395 | 792 | auto impl = implementations[i]; | 396 | 792 | const ToType canary1{42}; | 397 | 792 | auto& outputbuffer = outputbuffers.emplace_back(outlength.at(i), canary1); | 398 | 792 | const auto implret1 = std::invoke(conversion, impl, src.data(), | 399 | 792 | src.size(), outputbuffer.data()); | 400 | | // was the conversion successful? | 401 | 792 | const auto success = [](const ConversionResult& r) -> bool { | 402 | 792 | if constexpr (std::is_same_v<ConversionResult, std::size_t>) { | 403 | 792 | return r != 0; | 404 | 792 | } else { | 405 | 792 | return r.error == simdutf::error_code::SUCCESS; | 406 | 792 | } | 407 | 792 | }(implret1); | 408 | 792 | const auto hash1 = FNV1A_hash::as_str(outputbuffer); | 409 | 792 | if constexpr (use_canary_in_output) { | 410 | | // optionally convert again, this time with the buffer filled with | 411 | | // a different value. if the output differs, it means some of the buffer | 412 | | // was not written to by the conversion function. | 413 | 792 | const ToType canary2{25}; | 414 | 792 | const auto outputbuffer_first_run = outputbuffer; | 415 | 792 | std::ranges::fill(outputbuffer, canary2); | 416 | 792 | const auto implret2 = std::invoke(conversion, impl, src.data(), | 417 | 792 | src.size(), outputbuffer.data()); | 418 | | | 419 | 792 | if (implret1 != implret2) { | 420 | 0 | std::cerr << "different return value the second time!\n"; | 421 | 0 | std::abort(); | 422 | 0 | } | 423 | 792 | if (inputisvalid && success) { | 424 | | // only care about the output if the input is valid | 425 | 291 | const auto hash2 = FNV1A_hash::as_str(outputbuffer); | 426 | 291 | if (hash1 != hash2) { | 427 | 0 | std::cerr << "different output the second time!\n"; | 428 | 0 | std::cerr << "implementation " << impl->name() << " " << name | 429 | 0 | << '\n'; | 430 | 0 | std::cerr << "input is valid=" << inputisvalid << '\n'; | 431 | 0 | std::cerr << "output length=" << outputbuffer.size() << '\n'; | 432 | 0 | std::cerr << "conversion was a success? " << success << '\n'; | 433 | 0 | for (std::size_t j = 0; j < outputbuffer.size(); ++j) { | 434 | 0 | std::cerr << "output[" << j << "]\t" << +outputbuffer_first_run[j] | 435 | 0 | << '\t' << +outputbuffer[j] << '\n'; | 436 | 0 | } | 437 | 0 | std::abort(); | 438 | 0 | } | 439 | 291 | } | 440 | 792 | } | 441 | 792 | results.emplace_back(implret1, success ? hash1 : ""); | 442 | 792 | } | 443 | | | 444 | | // do not require implementations to give the same output if | 445 | | // the input is not valid. | 446 | 264 | if (!inputisvalid) { | 447 | 492 | for (auto& e : results) { | 448 | 492 | e.outputhash.clear(); | 449 | 492 | } | 450 | 164 | } | 451 | | | 452 | 264 | auto neq = [](const auto& a, const auto& b) { return a != b; }; | 453 | 264 | if (std::ranges::adjacent_find(results, neq) != results.end()) { | 454 | 0 | std::cerr << "begin errormessage for do_conversion\n"; | 455 | 0 | std::cerr << "in fuzz case for " << name << " invoked with " << src.size() | 456 | 0 | << " elements:\n"; | 457 | 0 | std::cerr << "input data is valid ? " << inputisvalid << '\n'; | 458 | 0 | for (std::size_t i = 0; i < results.size(); ++i) { | 459 | 0 | std::cerr << "got return " << std::dec << results[i] | 460 | 0 | << " from implementation " << implementations[i]->name() | 461 | 0 | << " using outlen=" << outlength.at(i) << '\n'; | 462 | 0 | } | 463 | 0 | for (std::size_t i = 0; i < results.size(); ++i) { | 464 | 0 | std::cerr << "implementation " << implementations[i]->name() | 465 | 0 | << " out: "; | 466 | 0 | for (const auto e : outputbuffers.at(i)) { | 467 | 0 | std::cerr << +e << ", "; | 468 | 0 | } | 469 | 0 | std::cerr << '\n'; | 470 | 0 | } | 471 | 0 | std::cerr << "end errormessage\n"; | 472 | 0 | ret.implementations_agree = false; | 473 | 264 | } else { | 474 | 264 | ret.implementations_agree = true; | 475 | 264 | } | 476 | 264 | return ret; | 477 | 264 | } |
Conversion<(UtfEncodings)3, (UtfEncodings)1, unsigned long (simdutf::implementation::*)(char32_t const*, unsigned long) noexcept const, unsigned long (simdutf::implementation::*)(char32_t const*, unsigned long, char16_t*) noexcept const>::do_conversion(std::__1::span<char32_t const, 18446744073709551615ul>, std::__1::vector<unsigned long, std::__1::allocator<unsigned long> > const&, bool) const Line | Count | Source | 382 | 361 | const bool inputisvalid) const { | 383 | 361 | conversion_result ret{}; | 384 | | | 385 | 361 | const auto implementations = get_supported_implementations(); | 386 | | | 387 | 361 | std::vector<result<ConversionResult>> results; | 388 | 361 | results.reserve(implementations.size()); | 389 | | | 390 | | // put the output in a separate allocation to make access violations easier | 391 | | // to catch | 392 | 361 | std::vector<std::vector<ToType>> outputbuffers; | 393 | 361 | outputbuffers.reserve(implementations.size()); | 394 | 1.44k | for (std::size_t i = 0; i < implementations.size(); ++i) { | 395 | 1.08k | auto impl = implementations[i]; | 396 | 1.08k | const ToType canary1{42}; | 397 | 1.08k | auto& outputbuffer = outputbuffers.emplace_back(outlength.at(i), canary1); | 398 | 1.08k | const auto implret1 = std::invoke(conversion, impl, src.data(), | 399 | 1.08k | src.size(), outputbuffer.data()); | 400 | | // was the conversion successful? | 401 | 1.08k | const auto success = [](const ConversionResult& r) -> bool { | 402 | 1.08k | if constexpr (std::is_same_v<ConversionResult, std::size_t>) { | 403 | 1.08k | return r != 0; | 404 | 1.08k | } else { | 405 | 1.08k | return r.error == simdutf::error_code::SUCCESS; | 406 | 1.08k | } | 407 | 1.08k | }(implret1); | 408 | 1.08k | const auto hash1 = FNV1A_hash::as_str(outputbuffer); | 409 | 1.08k | if constexpr (use_canary_in_output) { | 410 | | // optionally convert again, this time with the buffer filled with | 411 | | // a different value. if the output differs, it means some of the buffer | 412 | | // was not written to by the conversion function. | 413 | 1.08k | const ToType canary2{25}; | 414 | 1.08k | const auto outputbuffer_first_run = outputbuffer; | 415 | 1.08k | std::ranges::fill(outputbuffer, canary2); | 416 | 1.08k | const auto implret2 = std::invoke(conversion, impl, src.data(), | 417 | 1.08k | src.size(), outputbuffer.data()); | 418 | | | 419 | 1.08k | if (implret1 != implret2) { | 420 | 0 | std::cerr << "different return value the second time!\n"; | 421 | 0 | std::abort(); | 422 | 0 | } | 423 | 1.08k | if (inputisvalid && success) { | 424 | | // only care about the output if the input is valid | 425 | 648 | const auto hash2 = FNV1A_hash::as_str(outputbuffer); | 426 | 648 | if (hash1 != hash2) { | 427 | 0 | std::cerr << "different output the second time!\n"; | 428 | 0 | std::cerr << "implementation " << impl->name() << " " << name | 429 | 0 | << '\n'; | 430 | 0 | std::cerr << "input is valid=" << inputisvalid << '\n'; | 431 | 0 | std::cerr << "output length=" << outputbuffer.size() << '\n'; | 432 | 0 | std::cerr << "conversion was a success? " << success << '\n'; | 433 | 0 | for (std::size_t j = 0; j < outputbuffer.size(); ++j) { | 434 | 0 | std::cerr << "output[" << j << "]\t" << +outputbuffer_first_run[j] | 435 | 0 | << '\t' << +outputbuffer[j] << '\n'; | 436 | 0 | } | 437 | 0 | std::abort(); | 438 | 0 | } | 439 | 648 | } | 440 | 1.08k | } | 441 | 1.08k | results.emplace_back(implret1, success ? hash1 : ""); | 442 | 1.08k | } | 443 | | | 444 | | // do not require implementations to give the same output if | 445 | | // the input is not valid. | 446 | 361 | if (!inputisvalid) { | 447 | 423 | for (auto& e : results) { | 448 | 423 | e.outputhash.clear(); | 449 | 423 | } | 450 | 141 | } | 451 | | | 452 | 361 | auto neq = [](const auto& a, const auto& b) { return a != b; }; | 453 | 361 | if (std::ranges::adjacent_find(results, neq) != results.end()) { | 454 | 0 | std::cerr << "begin errormessage for do_conversion\n"; | 455 | 0 | std::cerr << "in fuzz case for " << name << " invoked with " << src.size() | 456 | 0 | << " elements:\n"; | 457 | 0 | std::cerr << "input data is valid ? " << inputisvalid << '\n'; | 458 | 0 | for (std::size_t i = 0; i < results.size(); ++i) { | 459 | 0 | std::cerr << "got return " << std::dec << results[i] | 460 | 0 | << " from implementation " << implementations[i]->name() | 461 | 0 | << " using outlen=" << outlength.at(i) << '\n'; | 462 | 0 | } | 463 | 0 | for (std::size_t i = 0; i < results.size(); ++i) { | 464 | 0 | std::cerr << "implementation " << implementations[i]->name() | 465 | 0 | << " out: "; | 466 | 0 | for (const auto e : outputbuffers.at(i)) { | 467 | 0 | std::cerr << +e << ", "; | 468 | 0 | } | 469 | 0 | std::cerr << '\n'; | 470 | 0 | } | 471 | 0 | std::cerr << "end errormessage\n"; | 472 | 0 | ret.implementations_agree = false; | 473 | 361 | } else { | 474 | 361 | ret.implementations_agree = true; | 475 | 361 | } | 476 | 361 | return ret; | 477 | 361 | } |
Conversion<(UtfEncodings)3, (UtfEncodings)2, unsigned long (simdutf::implementation::*)(char32_t const*, unsigned long) noexcept const, unsigned long (simdutf::implementation::*)(char32_t const*, unsigned long, char*) noexcept const>::do_conversion(std::__1::span<char32_t const, 18446744073709551615ul>, std::__1::vector<unsigned long, std::__1::allocator<unsigned long> > const&, bool) const Line | Count | Source | 382 | 398 | const bool inputisvalid) const { | 383 | 398 | conversion_result ret{}; | 384 | | | 385 | 398 | const auto implementations = get_supported_implementations(); | 386 | | | 387 | 398 | std::vector<result<ConversionResult>> results; | 388 | 398 | results.reserve(implementations.size()); | 389 | | | 390 | | // put the output in a separate allocation to make access violations easier | 391 | | // to catch | 392 | 398 | std::vector<std::vector<ToType>> outputbuffers; | 393 | 398 | outputbuffers.reserve(implementations.size()); | 394 | 1.59k | for (std::size_t i = 0; i < implementations.size(); ++i) { | 395 | 1.19k | auto impl = implementations[i]; | 396 | 1.19k | const ToType canary1{42}; | 397 | 1.19k | auto& outputbuffer = outputbuffers.emplace_back(outlength.at(i), canary1); | 398 | 1.19k | const auto implret1 = std::invoke(conversion, impl, src.data(), | 399 | 1.19k | src.size(), outputbuffer.data()); | 400 | | // was the conversion successful? | 401 | 1.19k | const auto success = [](const ConversionResult& r) -> bool { | 402 | 1.19k | if constexpr (std::is_same_v<ConversionResult, std::size_t>) { | 403 | 1.19k | return r != 0; | 404 | 1.19k | } else { | 405 | 1.19k | return r.error == simdutf::error_code::SUCCESS; | 406 | 1.19k | } | 407 | 1.19k | }(implret1); | 408 | 1.19k | const auto hash1 = FNV1A_hash::as_str(outputbuffer); | 409 | 1.19k | if constexpr (use_canary_in_output) { | 410 | | // optionally convert again, this time with the buffer filled with | 411 | | // a different value. if the output differs, it means some of the buffer | 412 | | // was not written to by the conversion function. | 413 | 1.19k | const ToType canary2{25}; | 414 | 1.19k | const auto outputbuffer_first_run = outputbuffer; | 415 | 1.19k | std::ranges::fill(outputbuffer, canary2); | 416 | 1.19k | const auto implret2 = std::invoke(conversion, impl, src.data(), | 417 | 1.19k | src.size(), outputbuffer.data()); | 418 | | | 419 | 1.19k | if (implret1 != implret2) { | 420 | 0 | std::cerr << "different return value the second time!\n"; | 421 | 0 | std::abort(); | 422 | 0 | } | 423 | 1.19k | if (inputisvalid && success) { | 424 | | // only care about the output if the input is valid | 425 | 435 | const auto hash2 = FNV1A_hash::as_str(outputbuffer); | 426 | 435 | if (hash1 != hash2) { | 427 | 0 | std::cerr << "different output the second time!\n"; | 428 | 0 | std::cerr << "implementation " << impl->name() << " " << name | 429 | 0 | << '\n'; | 430 | 0 | std::cerr << "input is valid=" << inputisvalid << '\n'; | 431 | 0 | std::cerr << "output length=" << outputbuffer.size() << '\n'; | 432 | 0 | std::cerr << "conversion was a success? " << success << '\n'; | 433 | 0 | for (std::size_t j = 0; j < outputbuffer.size(); ++j) { | 434 | 0 | std::cerr << "output[" << j << "]\t" << +outputbuffer_first_run[j] | 435 | 0 | << '\t' << +outputbuffer[j] << '\n'; | 436 | 0 | } | 437 | 0 | std::abort(); | 438 | 0 | } | 439 | 435 | } | 440 | 1.19k | } | 441 | 1.19k | results.emplace_back(implret1, success ? hash1 : ""); | 442 | 1.19k | } | 443 | | | 444 | | // do not require implementations to give the same output if | 445 | | // the input is not valid. | 446 | 398 | if (!inputisvalid) { | 447 | 750 | for (auto& e : results) { | 448 | 750 | e.outputhash.clear(); | 449 | 750 | } | 450 | 250 | } | 451 | | | 452 | 398 | auto neq = [](const auto& a, const auto& b) { return a != b; }; | 453 | 398 | if (std::ranges::adjacent_find(results, neq) != results.end()) { | 454 | 0 | std::cerr << "begin errormessage for do_conversion\n"; | 455 | 0 | std::cerr << "in fuzz case for " << name << " invoked with " << src.size() | 456 | 0 | << " elements:\n"; | 457 | 0 | std::cerr << "input data is valid ? " << inputisvalid << '\n'; | 458 | 0 | for (std::size_t i = 0; i < results.size(); ++i) { | 459 | 0 | std::cerr << "got return " << std::dec << results[i] | 460 | 0 | << " from implementation " << implementations[i]->name() | 461 | 0 | << " using outlen=" << outlength.at(i) << '\n'; | 462 | 0 | } | 463 | 0 | for (std::size_t i = 0; i < results.size(); ++i) { | 464 | 0 | std::cerr << "implementation " << implementations[i]->name() | 465 | 0 | << " out: "; | 466 | 0 | for (const auto e : outputbuffers.at(i)) { | 467 | 0 | std::cerr << +e << ", "; | 468 | 0 | } | 469 | 0 | std::cerr << '\n'; | 470 | 0 | } | 471 | 0 | std::cerr << "end errormessage\n"; | 472 | 0 | ret.implementations_agree = false; | 473 | 398 | } else { | 474 | 398 | ret.implementations_agree = true; | 475 | 398 | } | 476 | 398 | return ret; | 477 | 398 | } |
Conversion<(UtfEncodings)2, (UtfEncodings)0, unsigned long (simdutf::implementation::*)(char const*, unsigned long) noexcept const, unsigned long (simdutf::implementation::*)(char const*, unsigned long, char16_t*) noexcept const>::do_conversion(std::__1::span<char const, 18446744073709551615ul>, std::__1::vector<unsigned long, std::__1::allocator<unsigned long> > const&, bool) const Line | Count | Source | 382 | 575 | const bool inputisvalid) const { | 383 | 575 | conversion_result ret{}; | 384 | | | 385 | 575 | const auto implementations = get_supported_implementations(); | 386 | | | 387 | 575 | std::vector<result<ConversionResult>> results; | 388 | 575 | results.reserve(implementations.size()); | 389 | | | 390 | | // put the output in a separate allocation to make access violations easier | 391 | | // to catch | 392 | 575 | std::vector<std::vector<ToType>> outputbuffers; | 393 | 575 | outputbuffers.reserve(implementations.size()); | 394 | 2.30k | for (std::size_t i = 0; i < implementations.size(); ++i) { | 395 | 1.72k | auto impl = implementations[i]; | 396 | 1.72k | const ToType canary1{42}; | 397 | 1.72k | auto& outputbuffer = outputbuffers.emplace_back(outlength.at(i), canary1); | 398 | 1.72k | const auto implret1 = std::invoke(conversion, impl, src.data(), | 399 | 1.72k | src.size(), outputbuffer.data()); | 400 | | // was the conversion successful? | 401 | 1.72k | const auto success = [](const ConversionResult& r) -> bool { | 402 | 1.72k | if constexpr (std::is_same_v<ConversionResult, std::size_t>) { | 403 | 1.72k | return r != 0; | 404 | 1.72k | } else { | 405 | 1.72k | return r.error == simdutf::error_code::SUCCESS; | 406 | 1.72k | } | 407 | 1.72k | }(implret1); | 408 | 1.72k | const auto hash1 = FNV1A_hash::as_str(outputbuffer); | 409 | 1.72k | if constexpr (use_canary_in_output) { | 410 | | // optionally convert again, this time with the buffer filled with | 411 | | // a different value. if the output differs, it means some of the buffer | 412 | | // was not written to by the conversion function. | 413 | 1.72k | const ToType canary2{25}; | 414 | 1.72k | const auto outputbuffer_first_run = outputbuffer; | 415 | 1.72k | std::ranges::fill(outputbuffer, canary2); | 416 | 1.72k | const auto implret2 = std::invoke(conversion, impl, src.data(), | 417 | 1.72k | src.size(), outputbuffer.data()); | 418 | | | 419 | 1.72k | if (implret1 != implret2) { | 420 | 0 | std::cerr << "different return value the second time!\n"; | 421 | 0 | std::abort(); | 422 | 0 | } | 423 | 1.72k | if (inputisvalid && success) { | 424 | | // only care about the output if the input is valid | 425 | 939 | const auto hash2 = FNV1A_hash::as_str(outputbuffer); | 426 | 939 | if (hash1 != hash2) { | 427 | 0 | std::cerr << "different output the second time!\n"; | 428 | 0 | std::cerr << "implementation " << impl->name() << " " << name | 429 | 0 | << '\n'; | 430 | 0 | std::cerr << "input is valid=" << inputisvalid << '\n'; | 431 | 0 | std::cerr << "output length=" << outputbuffer.size() << '\n'; | 432 | 0 | std::cerr << "conversion was a success? " << success << '\n'; | 433 | 0 | for (std::size_t j = 0; j < outputbuffer.size(); ++j) { | 434 | 0 | std::cerr << "output[" << j << "]\t" << +outputbuffer_first_run[j] | 435 | 0 | << '\t' << +outputbuffer[j] << '\n'; | 436 | 0 | } | 437 | 0 | std::abort(); | 438 | 0 | } | 439 | 939 | } | 440 | 1.72k | } | 441 | 1.72k | results.emplace_back(implret1, success ? hash1 : ""); | 442 | 1.72k | } | 443 | | | 444 | | // do not require implementations to give the same output if | 445 | | // the input is not valid. | 446 | 575 | if (!inputisvalid) { | 447 | 777 | for (auto& e : results) { | 448 | 777 | e.outputhash.clear(); | 449 | 777 | } | 450 | 259 | } | 451 | | | 452 | 575 | auto neq = [](const auto& a, const auto& b) { return a != b; }; | 453 | 575 | if (std::ranges::adjacent_find(results, neq) != results.end()) { | 454 | 0 | std::cerr << "begin errormessage for do_conversion\n"; | 455 | 0 | std::cerr << "in fuzz case for " << name << " invoked with " << src.size() | 456 | 0 | << " elements:\n"; | 457 | 0 | std::cerr << "input data is valid ? " << inputisvalid << '\n'; | 458 | 0 | for (std::size_t i = 0; i < results.size(); ++i) { | 459 | 0 | std::cerr << "got return " << std::dec << results[i] | 460 | 0 | << " from implementation " << implementations[i]->name() | 461 | 0 | << " using outlen=" << outlength.at(i) << '\n'; | 462 | 0 | } | 463 | 0 | for (std::size_t i = 0; i < results.size(); ++i) { | 464 | 0 | std::cerr << "implementation " << implementations[i]->name() | 465 | 0 | << " out: "; | 466 | 0 | for (const auto e : outputbuffers.at(i)) { | 467 | 0 | std::cerr << +e << ", "; | 468 | 0 | } | 469 | 0 | std::cerr << '\n'; | 470 | 0 | } | 471 | 0 | std::cerr << "end errormessage\n"; | 472 | 0 | ret.implementations_agree = false; | 473 | 575 | } else { | 474 | 575 | ret.implementations_agree = true; | 475 | 575 | } | 476 | 575 | return ret; | 477 | 575 | } |
Conversion<(UtfEncodings)2, (UtfEncodings)1, unsigned long (simdutf::implementation::*)(char const*, unsigned long) noexcept const, unsigned long (simdutf::implementation::*)(char const*, unsigned long, char16_t*) noexcept const>::do_conversion(std::__1::span<char const, 18446744073709551615ul>, std::__1::vector<unsigned long, std::__1::allocator<unsigned long> > const&, bool) const Line | Count | Source | 382 | 514 | const bool inputisvalid) const { | 383 | 514 | conversion_result ret{}; | 384 | | | 385 | 514 | const auto implementations = get_supported_implementations(); | 386 | | | 387 | 514 | std::vector<result<ConversionResult>> results; | 388 | 514 | results.reserve(implementations.size()); | 389 | | | 390 | | // put the output in a separate allocation to make access violations easier | 391 | | // to catch | 392 | 514 | std::vector<std::vector<ToType>> outputbuffers; | 393 | 514 | outputbuffers.reserve(implementations.size()); | 394 | 2.05k | for (std::size_t i = 0; i < implementations.size(); ++i) { | 395 | 1.54k | auto impl = implementations[i]; | 396 | 1.54k | const ToType canary1{42}; | 397 | 1.54k | auto& outputbuffer = outputbuffers.emplace_back(outlength.at(i), canary1); | 398 | 1.54k | const auto implret1 = std::invoke(conversion, impl, src.data(), | 399 | 1.54k | src.size(), outputbuffer.data()); | 400 | | // was the conversion successful? | 401 | 1.54k | const auto success = [](const ConversionResult& r) -> bool { | 402 | 1.54k | if constexpr (std::is_same_v<ConversionResult, std::size_t>) { | 403 | 1.54k | return r != 0; | 404 | 1.54k | } else { | 405 | 1.54k | return r.error == simdutf::error_code::SUCCESS; | 406 | 1.54k | } | 407 | 1.54k | }(implret1); | 408 | 1.54k | const auto hash1 = FNV1A_hash::as_str(outputbuffer); | 409 | 1.54k | if constexpr (use_canary_in_output) { | 410 | | // optionally convert again, this time with the buffer filled with | 411 | | // a different value. if the output differs, it means some of the buffer | 412 | | // was not written to by the conversion function. | 413 | 1.54k | const ToType canary2{25}; | 414 | 1.54k | const auto outputbuffer_first_run = outputbuffer; | 415 | 1.54k | std::ranges::fill(outputbuffer, canary2); | 416 | 1.54k | const auto implret2 = std::invoke(conversion, impl, src.data(), | 417 | 1.54k | src.size(), outputbuffer.data()); | 418 | | | 419 | 1.54k | if (implret1 != implret2) { | 420 | 0 | std::cerr << "different return value the second time!\n"; | 421 | 0 | std::abort(); | 422 | 0 | } | 423 | 1.54k | if (inputisvalid && success) { | 424 | | // only care about the output if the input is valid | 425 | 882 | const auto hash2 = FNV1A_hash::as_str(outputbuffer); | 426 | 882 | if (hash1 != hash2) { | 427 | 0 | std::cerr << "different output the second time!\n"; | 428 | 0 | std::cerr << "implementation " << impl->name() << " " << name | 429 | 0 | << '\n'; | 430 | 0 | std::cerr << "input is valid=" << inputisvalid << '\n'; | 431 | 0 | std::cerr << "output length=" << outputbuffer.size() << '\n'; | 432 | 0 | std::cerr << "conversion was a success? " << success << '\n'; | 433 | 0 | for (std::size_t j = 0; j < outputbuffer.size(); ++j) { | 434 | 0 | std::cerr << "output[" << j << "]\t" << +outputbuffer_first_run[j] | 435 | 0 | << '\t' << +outputbuffer[j] << '\n'; | 436 | 0 | } | 437 | 0 | std::abort(); | 438 | 0 | } | 439 | 882 | } | 440 | 1.54k | } | 441 | 1.54k | results.emplace_back(implret1, success ? hash1 : ""); | 442 | 1.54k | } | 443 | | | 444 | | // do not require implementations to give the same output if | 445 | | // the input is not valid. | 446 | 514 | if (!inputisvalid) { | 447 | 651 | for (auto& e : results) { | 448 | 651 | e.outputhash.clear(); | 449 | 651 | } | 450 | 217 | } | 451 | | | 452 | 514 | auto neq = [](const auto& a, const auto& b) { return a != b; }; | 453 | 514 | if (std::ranges::adjacent_find(results, neq) != results.end()) { | 454 | 0 | std::cerr << "begin errormessage for do_conversion\n"; | 455 | 0 | std::cerr << "in fuzz case for " << name << " invoked with " << src.size() | 456 | 0 | << " elements:\n"; | 457 | 0 | std::cerr << "input data is valid ? " << inputisvalid << '\n'; | 458 | 0 | for (std::size_t i = 0; i < results.size(); ++i) { | 459 | 0 | std::cerr << "got return " << std::dec << results[i] | 460 | 0 | << " from implementation " << implementations[i]->name() | 461 | 0 | << " using outlen=" << outlength.at(i) << '\n'; | 462 | 0 | } | 463 | 0 | for (std::size_t i = 0; i < results.size(); ++i) { | 464 | 0 | std::cerr << "implementation " << implementations[i]->name() | 465 | 0 | << " out: "; | 466 | 0 | for (const auto e : outputbuffers.at(i)) { | 467 | 0 | std::cerr << +e << ", "; | 468 | 0 | } | 469 | 0 | std::cerr << '\n'; | 470 | 0 | } | 471 | 0 | std::cerr << "end errormessage\n"; | 472 | 0 | ret.implementations_agree = false; | 473 | 514 | } else { | 474 | 514 | ret.implementations_agree = true; | 475 | 514 | } | 476 | 514 | return ret; | 477 | 514 | } |
Conversion<(UtfEncodings)2, (UtfEncodings)3, unsigned long (simdutf::implementation::*)(char const*, unsigned long) noexcept const, unsigned long (simdutf::implementation::*)(char const*, unsigned long, char32_t*) noexcept const>::do_conversion(std::__1::span<char const, 18446744073709551615ul>, std::__1::vector<unsigned long, std::__1::allocator<unsigned long> > const&, bool) const Line | Count | Source | 382 | 553 | const bool inputisvalid) const { | 383 | 553 | conversion_result ret{}; | 384 | | | 385 | 553 | const auto implementations = get_supported_implementations(); | 386 | | | 387 | 553 | std::vector<result<ConversionResult>> results; | 388 | 553 | results.reserve(implementations.size()); | 389 | | | 390 | | // put the output in a separate allocation to make access violations easier | 391 | | // to catch | 392 | 553 | std::vector<std::vector<ToType>> outputbuffers; | 393 | 553 | outputbuffers.reserve(implementations.size()); | 394 | 2.21k | for (std::size_t i = 0; i < implementations.size(); ++i) { | 395 | 1.65k | auto impl = implementations[i]; | 396 | 1.65k | const ToType canary1{42}; | 397 | 1.65k | auto& outputbuffer = outputbuffers.emplace_back(outlength.at(i), canary1); | 398 | 1.65k | const auto implret1 = std::invoke(conversion, impl, src.data(), | 399 | 1.65k | src.size(), outputbuffer.data()); | 400 | | // was the conversion successful? | 401 | 1.65k | const auto success = [](const ConversionResult& r) -> bool { | 402 | 1.65k | if constexpr (std::is_same_v<ConversionResult, std::size_t>) { | 403 | 1.65k | return r != 0; | 404 | 1.65k | } else { | 405 | 1.65k | return r.error == simdutf::error_code::SUCCESS; | 406 | 1.65k | } | 407 | 1.65k | }(implret1); | 408 | 1.65k | const auto hash1 = FNV1A_hash::as_str(outputbuffer); | 409 | 1.65k | if constexpr (use_canary_in_output) { | 410 | | // optionally convert again, this time with the buffer filled with | 411 | | // a different value. if the output differs, it means some of the buffer | 412 | | // was not written to by the conversion function. | 413 | 1.65k | const ToType canary2{25}; | 414 | 1.65k | const auto outputbuffer_first_run = outputbuffer; | 415 | 1.65k | std::ranges::fill(outputbuffer, canary2); | 416 | 1.65k | const auto implret2 = std::invoke(conversion, impl, src.data(), | 417 | 1.65k | src.size(), outputbuffer.data()); | 418 | | | 419 | 1.65k | if (implret1 != implret2) { | 420 | 0 | std::cerr << "different return value the second time!\n"; | 421 | 0 | std::abort(); | 422 | 0 | } | 423 | 1.65k | if (inputisvalid && success) { | 424 | | // only care about the output if the input is valid | 425 | 999 | const auto hash2 = FNV1A_hash::as_str(outputbuffer); | 426 | 999 | if (hash1 != hash2) { | 427 | 0 | std::cerr << "different output the second time!\n"; | 428 | 0 | std::cerr << "implementation " << impl->name() << " " << name | 429 | 0 | << '\n'; | 430 | 0 | std::cerr << "input is valid=" << inputisvalid << '\n'; | 431 | 0 | std::cerr << "output length=" << outputbuffer.size() << '\n'; | 432 | 0 | std::cerr << "conversion was a success? " << success << '\n'; | 433 | 0 | for (std::size_t j = 0; j < outputbuffer.size(); ++j) { | 434 | 0 | std::cerr << "output[" << j << "]\t" << +outputbuffer_first_run[j] | 435 | 0 | << '\t' << +outputbuffer[j] << '\n'; | 436 | 0 | } | 437 | 0 | std::abort(); | 438 | 0 | } | 439 | 999 | } | 440 | 1.65k | } | 441 | 1.65k | results.emplace_back(implret1, success ? hash1 : ""); | 442 | 1.65k | } | 443 | | | 444 | | // do not require implementations to give the same output if | 445 | | // the input is not valid. | 446 | 553 | if (!inputisvalid) { | 447 | 654 | for (auto& e : results) { | 448 | 654 | e.outputhash.clear(); | 449 | 654 | } | 450 | 218 | } | 451 | | | 452 | 553 | auto neq = [](const auto& a, const auto& b) { return a != b; }; | 453 | 553 | if (std::ranges::adjacent_find(results, neq) != results.end()) { | 454 | 0 | std::cerr << "begin errormessage for do_conversion\n"; | 455 | 0 | std::cerr << "in fuzz case for " << name << " invoked with " << src.size() | 456 | 0 | << " elements:\n"; | 457 | 0 | std::cerr << "input data is valid ? " << inputisvalid << '\n'; | 458 | 0 | for (std::size_t i = 0; i < results.size(); ++i) { | 459 | 0 | std::cerr << "got return " << std::dec << results[i] | 460 | 0 | << " from implementation " << implementations[i]->name() | 461 | 0 | << " using outlen=" << outlength.at(i) << '\n'; | 462 | 0 | } | 463 | 0 | for (std::size_t i = 0; i < results.size(); ++i) { | 464 | 0 | std::cerr << "implementation " << implementations[i]->name() | 465 | 0 | << " out: "; | 466 | 0 | for (const auto e : outputbuffers.at(i)) { | 467 | 0 | std::cerr << +e << ", "; | 468 | 0 | } | 469 | 0 | std::cerr << '\n'; | 470 | 0 | } | 471 | 0 | std::cerr << "end errormessage\n"; | 472 | 0 | ret.implementations_agree = false; | 473 | 553 | } else { | 474 | 553 | ret.implementations_agree = true; | 475 | 553 | } | 476 | 553 | return ret; | 477 | 553 | } |
Conversion<(UtfEncodings)0, (UtfEncodings)4, unsigned long (simdutf::implementation::*)(unsigned long) noexcept const, unsigned long (simdutf::implementation::*)(char16_t const*, unsigned long, char*) noexcept const>::do_conversion(std::__1::span<char16_t const, 18446744073709551615ul>, std::__1::vector<unsigned long, std::__1::allocator<unsigned long> > const&, bool) const Line | Count | Source | 382 | 63 | const bool inputisvalid) const { | 383 | 63 | conversion_result ret{}; | 384 | | | 385 | 63 | const auto implementations = get_supported_implementations(); | 386 | | | 387 | 63 | std::vector<result<ConversionResult>> results; | 388 | 63 | results.reserve(implementations.size()); | 389 | | | 390 | | // put the output in a separate allocation to make access violations easier | 391 | | // to catch | 392 | 63 | std::vector<std::vector<ToType>> outputbuffers; | 393 | 63 | outputbuffers.reserve(implementations.size()); | 394 | 252 | for (std::size_t i = 0; i < implementations.size(); ++i) { | 395 | 189 | auto impl = implementations[i]; | 396 | 189 | const ToType canary1{42}; | 397 | 189 | auto& outputbuffer = outputbuffers.emplace_back(outlength.at(i), canary1); | 398 | 189 | const auto implret1 = std::invoke(conversion, impl, src.data(), | 399 | 189 | src.size(), outputbuffer.data()); | 400 | | // was the conversion successful? | 401 | 189 | const auto success = [](const ConversionResult& r) -> bool { | 402 | 189 | if constexpr (std::is_same_v<ConversionResult, std::size_t>) { | 403 | 189 | return r != 0; | 404 | 189 | } else { | 405 | 189 | return r.error == simdutf::error_code::SUCCESS; | 406 | 189 | } | 407 | 189 | }(implret1); | 408 | 189 | const auto hash1 = FNV1A_hash::as_str(outputbuffer); | 409 | 189 | if constexpr (use_canary_in_output) { | 410 | | // optionally convert again, this time with the buffer filled with | 411 | | // a different value. if the output differs, it means some of the buffer | 412 | | // was not written to by the conversion function. | 413 | 189 | const ToType canary2{25}; | 414 | 189 | const auto outputbuffer_first_run = outputbuffer; | 415 | 189 | std::ranges::fill(outputbuffer, canary2); | 416 | 189 | const auto implret2 = std::invoke(conversion, impl, src.data(), | 417 | 189 | src.size(), outputbuffer.data()); | 418 | | | 419 | 189 | if (implret1 != implret2) { | 420 | 0 | std::cerr << "different return value the second time!\n"; | 421 | 0 | std::abort(); | 422 | 0 | } | 423 | 189 | if (inputisvalid && success) { | 424 | | // only care about the output if the input is valid | 425 | 93 | const auto hash2 = FNV1A_hash::as_str(outputbuffer); | 426 | 93 | if (hash1 != hash2) { | 427 | 0 | std::cerr << "different output the second time!\n"; | 428 | 0 | std::cerr << "implementation " << impl->name() << " " << name | 429 | 0 | << '\n'; | 430 | 0 | std::cerr << "input is valid=" << inputisvalid << '\n'; | 431 | 0 | std::cerr << "output length=" << outputbuffer.size() << '\n'; | 432 | 0 | std::cerr << "conversion was a success? " << success << '\n'; | 433 | 0 | for (std::size_t j = 0; j < outputbuffer.size(); ++j) { | 434 | 0 | std::cerr << "output[" << j << "]\t" << +outputbuffer_first_run[j] | 435 | 0 | << '\t' << +outputbuffer[j] << '\n'; | 436 | 0 | } | 437 | 0 | std::abort(); | 438 | 0 | } | 439 | 93 | } | 440 | 189 | } | 441 | 189 | results.emplace_back(implret1, success ? hash1 : ""); | 442 | 189 | } | 443 | | | 444 | | // do not require implementations to give the same output if | 445 | | // the input is not valid. | 446 | 63 | if (!inputisvalid) { | 447 | 27 | for (auto& e : results) { | 448 | 27 | e.outputhash.clear(); | 449 | 27 | } | 450 | 9 | } | 451 | | | 452 | 63 | auto neq = [](const auto& a, const auto& b) { return a != b; }; | 453 | 63 | if (std::ranges::adjacent_find(results, neq) != results.end()) { | 454 | 0 | std::cerr << "begin errormessage for do_conversion\n"; | 455 | 0 | std::cerr << "in fuzz case for " << name << " invoked with " << src.size() | 456 | 0 | << " elements:\n"; | 457 | 0 | std::cerr << "input data is valid ? " << inputisvalid << '\n'; | 458 | 0 | for (std::size_t i = 0; i < results.size(); ++i) { | 459 | 0 | std::cerr << "got return " << std::dec << results[i] | 460 | 0 | << " from implementation " << implementations[i]->name() | 461 | 0 | << " using outlen=" << outlength.at(i) << '\n'; | 462 | 0 | } | 463 | 0 | for (std::size_t i = 0; i < results.size(); ++i) { | 464 | 0 | std::cerr << "implementation " << implementations[i]->name() | 465 | 0 | << " out: "; | 466 | 0 | for (const auto e : outputbuffers.at(i)) { | 467 | 0 | std::cerr << +e << ", "; | 468 | 0 | } | 469 | 0 | std::cerr << '\n'; | 470 | 0 | } | 471 | 0 | std::cerr << "end errormessage\n"; | 472 | 0 | ret.implementations_agree = false; | 473 | 63 | } else { | 474 | 63 | ret.implementations_agree = true; | 475 | 63 | } | 476 | 63 | return ret; | 477 | 63 | } |
Conversion<(UtfEncodings)1, (UtfEncodings)4, unsigned long (simdutf::implementation::*)(unsigned long) noexcept const, unsigned long (simdutf::implementation::*)(char16_t const*, unsigned long, char*) noexcept const>::do_conversion(std::__1::span<char16_t const, 18446744073709551615ul>, std::__1::vector<unsigned long, std::__1::allocator<unsigned long> > const&, bool) const Line | Count | Source | 382 | 62 | const bool inputisvalid) const { | 383 | 62 | conversion_result ret{}; | 384 | | | 385 | 62 | const auto implementations = get_supported_implementations(); | 386 | | | 387 | 62 | std::vector<result<ConversionResult>> results; | 388 | 62 | results.reserve(implementations.size()); | 389 | | | 390 | | // put the output in a separate allocation to make access violations easier | 391 | | // to catch | 392 | 62 | std::vector<std::vector<ToType>> outputbuffers; | 393 | 62 | outputbuffers.reserve(implementations.size()); | 394 | 248 | for (std::size_t i = 0; i < implementations.size(); ++i) { | 395 | 186 | auto impl = implementations[i]; | 396 | 186 | const ToType canary1{42}; | 397 | 186 | auto& outputbuffer = outputbuffers.emplace_back(outlength.at(i), canary1); | 398 | 186 | const auto implret1 = std::invoke(conversion, impl, src.data(), | 399 | 186 | src.size(), outputbuffer.data()); | 400 | | // was the conversion successful? | 401 | 186 | const auto success = [](const ConversionResult& r) -> bool { | 402 | 186 | if constexpr (std::is_same_v<ConversionResult, std::size_t>) { | 403 | 186 | return r != 0; | 404 | 186 | } else { | 405 | 186 | return r.error == simdutf::error_code::SUCCESS; | 406 | 186 | } | 407 | 186 | }(implret1); | 408 | 186 | const auto hash1 = FNV1A_hash::as_str(outputbuffer); | 409 | 186 | if constexpr (use_canary_in_output) { | 410 | | // optionally convert again, this time with the buffer filled with | 411 | | // a different value. if the output differs, it means some of the buffer | 412 | | // was not written to by the conversion function. | 413 | 186 | const ToType canary2{25}; | 414 | 186 | const auto outputbuffer_first_run = outputbuffer; | 415 | 186 | std::ranges::fill(outputbuffer, canary2); | 416 | 186 | const auto implret2 = std::invoke(conversion, impl, src.data(), | 417 | 186 | src.size(), outputbuffer.data()); | 418 | | | 419 | 186 | if (implret1 != implret2) { | 420 | 0 | std::cerr << "different return value the second time!\n"; | 421 | 0 | std::abort(); | 422 | 0 | } | 423 | 186 | if (inputisvalid && success) { | 424 | | // only care about the output if the input is valid | 425 | 57 | const auto hash2 = FNV1A_hash::as_str(outputbuffer); | 426 | 57 | if (hash1 != hash2) { | 427 | 0 | std::cerr << "different output the second time!\n"; | 428 | 0 | std::cerr << "implementation " << impl->name() << " " << name | 429 | 0 | << '\n'; | 430 | 0 | std::cerr << "input is valid=" << inputisvalid << '\n'; | 431 | 0 | std::cerr << "output length=" << outputbuffer.size() << '\n'; | 432 | 0 | std::cerr << "conversion was a success? " << success << '\n'; | 433 | 0 | for (std::size_t j = 0; j < outputbuffer.size(); ++j) { | 434 | 0 | std::cerr << "output[" << j << "]\t" << +outputbuffer_first_run[j] | 435 | 0 | << '\t' << +outputbuffer[j] << '\n'; | 436 | 0 | } | 437 | 0 | std::abort(); | 438 | 0 | } | 439 | 57 | } | 440 | 186 | } | 441 | 186 | results.emplace_back(implret1, success ? hash1 : ""); | 442 | 186 | } | 443 | | | 444 | | // do not require implementations to give the same output if | 445 | | // the input is not valid. | 446 | 62 | if (!inputisvalid) { | 447 | 48 | for (auto& e : results) { | 448 | 48 | e.outputhash.clear(); | 449 | 48 | } | 450 | 16 | } | 451 | | | 452 | 62 | auto neq = [](const auto& a, const auto& b) { return a != b; }; | 453 | 62 | if (std::ranges::adjacent_find(results, neq) != results.end()) { | 454 | 0 | std::cerr << "begin errormessage for do_conversion\n"; | 455 | 0 | std::cerr << "in fuzz case for " << name << " invoked with " << src.size() | 456 | 0 | << " elements:\n"; | 457 | 0 | std::cerr << "input data is valid ? " << inputisvalid << '\n'; | 458 | 0 | for (std::size_t i = 0; i < results.size(); ++i) { | 459 | 0 | std::cerr << "got return " << std::dec << results[i] | 460 | 0 | << " from implementation " << implementations[i]->name() | 461 | 0 | << " using outlen=" << outlength.at(i) << '\n'; | 462 | 0 | } | 463 | 0 | for (std::size_t i = 0; i < results.size(); ++i) { | 464 | 0 | std::cerr << "implementation " << implementations[i]->name() | 465 | 0 | << " out: "; | 466 | 0 | for (const auto e : outputbuffers.at(i)) { | 467 | 0 | std::cerr << +e << ", "; | 468 | 0 | } | 469 | 0 | std::cerr << '\n'; | 470 | 0 | } | 471 | 0 | std::cerr << "end errormessage\n"; | 472 | 0 | ret.implementations_agree = false; | 473 | 62 | } else { | 474 | 62 | ret.implementations_agree = true; | 475 | 62 | } | 476 | 62 | return ret; | 477 | 62 | } |
Conversion<(UtfEncodings)3, (UtfEncodings)4, unsigned long (simdutf::implementation::*)(unsigned long) noexcept const, unsigned long (simdutf::implementation::*)(char32_t const*, unsigned long, char*) noexcept const>::do_conversion(std::__1::span<char32_t const, 18446744073709551615ul>, std::__1::vector<unsigned long, std::__1::allocator<unsigned long> > const&, bool) const Line | Count | Source | 382 | 94 | const bool inputisvalid) const { | 383 | 94 | conversion_result ret{}; | 384 | | | 385 | 94 | const auto implementations = get_supported_implementations(); | 386 | | | 387 | 94 | std::vector<result<ConversionResult>> results; | 388 | 94 | results.reserve(implementations.size()); | 389 | | | 390 | | // put the output in a separate allocation to make access violations easier | 391 | | // to catch | 392 | 94 | std::vector<std::vector<ToType>> outputbuffers; | 393 | 94 | outputbuffers.reserve(implementations.size()); | 394 | 376 | for (std::size_t i = 0; i < implementations.size(); ++i) { | 395 | 282 | auto impl = implementations[i]; | 396 | 282 | const ToType canary1{42}; | 397 | 282 | auto& outputbuffer = outputbuffers.emplace_back(outlength.at(i), canary1); | 398 | 282 | const auto implret1 = std::invoke(conversion, impl, src.data(), | 399 | 282 | src.size(), outputbuffer.data()); | 400 | | // was the conversion successful? | 401 | 282 | const auto success = [](const ConversionResult& r) -> bool { | 402 | 282 | if constexpr (std::is_same_v<ConversionResult, std::size_t>) { | 403 | 282 | return r != 0; | 404 | 282 | } else { | 405 | 282 | return r.error == simdutf::error_code::SUCCESS; | 406 | 282 | } | 407 | 282 | }(implret1); | 408 | 282 | const auto hash1 = FNV1A_hash::as_str(outputbuffer); | 409 | 282 | if constexpr (use_canary_in_output) { | 410 | | // optionally convert again, this time with the buffer filled with | 411 | | // a different value. if the output differs, it means some of the buffer | 412 | | // was not written to by the conversion function. | 413 | 282 | const ToType canary2{25}; | 414 | 282 | const auto outputbuffer_first_run = outputbuffer; | 415 | 282 | std::ranges::fill(outputbuffer, canary2); | 416 | 282 | const auto implret2 = std::invoke(conversion, impl, src.data(), | 417 | 282 | src.size(), outputbuffer.data()); | 418 | | | 419 | 282 | if (implret1 != implret2) { | 420 | 0 | std::cerr << "different return value the second time!\n"; | 421 | 0 | std::abort(); | 422 | 0 | } | 423 | 282 | if (inputisvalid && success) { | 424 | | // only care about the output if the input is valid | 425 | 84 | const auto hash2 = FNV1A_hash::as_str(outputbuffer); | 426 | 84 | if (hash1 != hash2) { | 427 | 0 | std::cerr << "different output the second time!\n"; | 428 | 0 | std::cerr << "implementation " << impl->name() << " " << name | 429 | 0 | << '\n'; | 430 | 0 | std::cerr << "input is valid=" << inputisvalid << '\n'; | 431 | 0 | std::cerr << "output length=" << outputbuffer.size() << '\n'; | 432 | 0 | std::cerr << "conversion was a success? " << success << '\n'; | 433 | 0 | for (std::size_t j = 0; j < outputbuffer.size(); ++j) { | 434 | 0 | std::cerr << "output[" << j << "]\t" << +outputbuffer_first_run[j] | 435 | 0 | << '\t' << +outputbuffer[j] << '\n'; | 436 | 0 | } | 437 | 0 | std::abort(); | 438 | 0 | } | 439 | 84 | } | 440 | 282 | } | 441 | 282 | results.emplace_back(implret1, success ? hash1 : ""); | 442 | 282 | } | 443 | | | 444 | | // do not require implementations to give the same output if | 445 | | // the input is not valid. | 446 | 94 | if (!inputisvalid) { | 447 | 186 | for (auto& e : results) { | 448 | 186 | e.outputhash.clear(); | 449 | 186 | } | 450 | 62 | } | 451 | | | 452 | 94 | auto neq = [](const auto& a, const auto& b) { return a != b; }; | 453 | 94 | if (std::ranges::adjacent_find(results, neq) != results.end()) { | 454 | 0 | std::cerr << "begin errormessage for do_conversion\n"; | 455 | 0 | std::cerr << "in fuzz case for " << name << " invoked with " << src.size() | 456 | 0 | << " elements:\n"; | 457 | 0 | std::cerr << "input data is valid ? " << inputisvalid << '\n'; | 458 | 0 | for (std::size_t i = 0; i < results.size(); ++i) { | 459 | 0 | std::cerr << "got return " << std::dec << results[i] | 460 | 0 | << " from implementation " << implementations[i]->name() | 461 | 0 | << " using outlen=" << outlength.at(i) << '\n'; | 462 | 0 | } | 463 | 0 | for (std::size_t i = 0; i < results.size(); ++i) { | 464 | 0 | std::cerr << "implementation " << implementations[i]->name() | 465 | 0 | << " out: "; | 466 | 0 | for (const auto e : outputbuffers.at(i)) { | 467 | 0 | std::cerr << +e << ", "; | 468 | 0 | } | 469 | 0 | std::cerr << '\n'; | 470 | 0 | } | 471 | 0 | std::cerr << "end errormessage\n"; | 472 | 0 | ret.implementations_agree = false; | 473 | 94 | } else { | 474 | 94 | ret.implementations_agree = true; | 475 | 94 | } | 476 | 94 | return ret; | 477 | 94 | } |
Conversion<(UtfEncodings)2, (UtfEncodings)4, unsigned long (simdutf::implementation::*)(char const*, unsigned long) noexcept const, unsigned long (simdutf::implementation::*)(char const*, unsigned long, char*) noexcept const>::do_conversion(std::__1::span<char const, 18446744073709551615ul>, std::__1::vector<unsigned long, std::__1::allocator<unsigned long> > const&, bool) const Line | Count | Source | 382 | 281 | const bool inputisvalid) const { | 383 | 281 | conversion_result ret{}; | 384 | | | 385 | 281 | const auto implementations = get_supported_implementations(); | 386 | | | 387 | 281 | std::vector<result<ConversionResult>> results; | 388 | 281 | results.reserve(implementations.size()); | 389 | | | 390 | | // put the output in a separate allocation to make access violations easier | 391 | | // to catch | 392 | 281 | std::vector<std::vector<ToType>> outputbuffers; | 393 | 281 | outputbuffers.reserve(implementations.size()); | 394 | 1.12k | for (std::size_t i = 0; i < implementations.size(); ++i) { | 395 | 843 | auto impl = implementations[i]; | 396 | 843 | const ToType canary1{42}; | 397 | 843 | auto& outputbuffer = outputbuffers.emplace_back(outlength.at(i), canary1); | 398 | 843 | const auto implret1 = std::invoke(conversion, impl, src.data(), | 399 | 843 | src.size(), outputbuffer.data()); | 400 | | // was the conversion successful? | 401 | 843 | const auto success = [](const ConversionResult& r) -> bool { | 402 | 843 | if constexpr (std::is_same_v<ConversionResult, std::size_t>) { | 403 | 843 | return r != 0; | 404 | 843 | } else { | 405 | 843 | return r.error == simdutf::error_code::SUCCESS; | 406 | 843 | } | 407 | 843 | }(implret1); | 408 | 843 | const auto hash1 = FNV1A_hash::as_str(outputbuffer); | 409 | 843 | if constexpr (use_canary_in_output) { | 410 | | // optionally convert again, this time with the buffer filled with | 411 | | // a different value. if the output differs, it means some of the buffer | 412 | | // was not written to by the conversion function. | 413 | 843 | const ToType canary2{25}; | 414 | 843 | const auto outputbuffer_first_run = outputbuffer; | 415 | 843 | std::ranges::fill(outputbuffer, canary2); | 416 | 843 | const auto implret2 = std::invoke(conversion, impl, src.data(), | 417 | 843 | src.size(), outputbuffer.data()); | 418 | | | 419 | 843 | if (implret1 != implret2) { | 420 | 0 | std::cerr << "different return value the second time!\n"; | 421 | 0 | std::abort(); | 422 | 0 | } | 423 | 843 | if (inputisvalid && success) { | 424 | | // only care about the output if the input is valid | 425 | 258 | const auto hash2 = FNV1A_hash::as_str(outputbuffer); | 426 | 258 | if (hash1 != hash2) { | 427 | 0 | std::cerr << "different output the second time!\n"; | 428 | 0 | std::cerr << "implementation " << impl->name() << " " << name | 429 | 0 | << '\n'; | 430 | 0 | std::cerr << "input is valid=" << inputisvalid << '\n'; | 431 | 0 | std::cerr << "output length=" << outputbuffer.size() << '\n'; | 432 | 0 | std::cerr << "conversion was a success? " << success << '\n'; | 433 | 0 | for (std::size_t j = 0; j < outputbuffer.size(); ++j) { | 434 | 0 | std::cerr << "output[" << j << "]\t" << +outputbuffer_first_run[j] | 435 | 0 | << '\t' << +outputbuffer[j] << '\n'; | 436 | 0 | } | 437 | 0 | std::abort(); | 438 | 0 | } | 439 | 258 | } | 440 | 843 | } | 441 | 843 | results.emplace_back(implret1, success ? hash1 : ""); | 442 | 843 | } | 443 | | | 444 | | // do not require implementations to give the same output if | 445 | | // the input is not valid. | 446 | 281 | if (!inputisvalid) { | 447 | 558 | for (auto& e : results) { | 448 | 558 | e.outputhash.clear(); | 449 | 558 | } | 450 | 186 | } | 451 | | | 452 | 281 | auto neq = [](const auto& a, const auto& b) { return a != b; }; | 453 | 281 | if (std::ranges::adjacent_find(results, neq) != results.end()) { | 454 | 0 | std::cerr << "begin errormessage for do_conversion\n"; | 455 | 0 | std::cerr << "in fuzz case for " << name << " invoked with " << src.size() | 456 | 0 | << " elements:\n"; | 457 | 0 | std::cerr << "input data is valid ? " << inputisvalid << '\n'; | 458 | 0 | for (std::size_t i = 0; i < results.size(); ++i) { | 459 | 0 | std::cerr << "got return " << std::dec << results[i] | 460 | 0 | << " from implementation " << implementations[i]->name() | 461 | 0 | << " using outlen=" << outlength.at(i) << '\n'; | 462 | 0 | } | 463 | 0 | for (std::size_t i = 0; i < results.size(); ++i) { | 464 | 0 | std::cerr << "implementation " << implementations[i]->name() | 465 | 0 | << " out: "; | 466 | 0 | for (const auto e : outputbuffers.at(i)) { | 467 | 0 | std::cerr << +e << ", "; | 468 | 0 | } | 469 | 0 | std::cerr << '\n'; | 470 | 0 | } | 471 | 0 | std::cerr << "end errormessage\n"; | 472 | 0 | ret.implementations_agree = false; | 473 | 281 | } else { | 474 | 281 | ret.implementations_agree = true; | 475 | 281 | } | 476 | 281 | return ret; | 477 | 281 | } |
Conversion<(UtfEncodings)0, (UtfEncodings)4, unsigned long (simdutf::implementation::*)(unsigned long) noexcept const, simdutf::result (simdutf::implementation::*)(char16_t const*, unsigned long, char*) noexcept const>::do_conversion(std::__1::span<char16_t const, 18446744073709551615ul>, std::__1::vector<unsigned long, std::__1::allocator<unsigned long> > const&, bool) const Line | Count | Source | 382 | 126 | const bool inputisvalid) const { | 383 | 126 | conversion_result ret{}; | 384 | | | 385 | 126 | const auto implementations = get_supported_implementations(); | 386 | | | 387 | 126 | std::vector<result<ConversionResult>> results; | 388 | 126 | results.reserve(implementations.size()); | 389 | | | 390 | | // put the output in a separate allocation to make access violations easier | 391 | | // to catch | 392 | 126 | std::vector<std::vector<ToType>> outputbuffers; | 393 | 126 | outputbuffers.reserve(implementations.size()); | 394 | 504 | for (std::size_t i = 0; i < implementations.size(); ++i) { | 395 | 378 | auto impl = implementations[i]; | 396 | 378 | const ToType canary1{42}; | 397 | 378 | auto& outputbuffer = outputbuffers.emplace_back(outlength.at(i), canary1); | 398 | 378 | const auto implret1 = std::invoke(conversion, impl, src.data(), | 399 | 378 | src.size(), outputbuffer.data()); | 400 | | // was the conversion successful? | 401 | 378 | const auto success = [](const ConversionResult& r) -> bool { | 402 | 378 | if constexpr (std::is_same_v<ConversionResult, std::size_t>) { | 403 | 378 | return r != 0; | 404 | 378 | } else { | 405 | 378 | return r.error == simdutf::error_code::SUCCESS; | 406 | 378 | } | 407 | 378 | }(implret1); | 408 | 378 | const auto hash1 = FNV1A_hash::as_str(outputbuffer); | 409 | 378 | if constexpr (use_canary_in_output) { | 410 | | // optionally convert again, this time with the buffer filled with | 411 | | // a different value. if the output differs, it means some of the buffer | 412 | | // was not written to by the conversion function. | 413 | 378 | const ToType canary2{25}; | 414 | 378 | const auto outputbuffer_first_run = outputbuffer; | 415 | 378 | std::ranges::fill(outputbuffer, canary2); | 416 | 378 | const auto implret2 = std::invoke(conversion, impl, src.data(), | 417 | 378 | src.size(), outputbuffer.data()); | 418 | | | 419 | 378 | if (implret1 != implret2) { | 420 | 0 | std::cerr << "different return value the second time!\n"; | 421 | 0 | std::abort(); | 422 | 0 | } | 423 | 378 | if (inputisvalid && success) { | 424 | | // only care about the output if the input is valid | 425 | 144 | const auto hash2 = FNV1A_hash::as_str(outputbuffer); | 426 | 144 | if (hash1 != hash2) { | 427 | 0 | std::cerr << "different output the second time!\n"; | 428 | 0 | std::cerr << "implementation " << impl->name() << " " << name | 429 | 0 | << '\n'; | 430 | 0 | std::cerr << "input is valid=" << inputisvalid << '\n'; | 431 | 0 | std::cerr << "output length=" << outputbuffer.size() << '\n'; | 432 | 0 | std::cerr << "conversion was a success? " << success << '\n'; | 433 | 0 | for (std::size_t j = 0; j < outputbuffer.size(); ++j) { | 434 | 0 | std::cerr << "output[" << j << "]\t" << +outputbuffer_first_run[j] | 435 | 0 | << '\t' << +outputbuffer[j] << '\n'; | 436 | 0 | } | 437 | 0 | std::abort(); | 438 | 0 | } | 439 | 144 | } | 440 | 378 | } | 441 | 378 | results.emplace_back(implret1, success ? hash1 : ""); | 442 | 378 | } | 443 | | | 444 | | // do not require implementations to give the same output if | 445 | | // the input is not valid. | 446 | 126 | if (!inputisvalid) { | 447 | 63 | for (auto& e : results) { | 448 | 63 | e.outputhash.clear(); | 449 | 63 | } | 450 | 21 | } | 451 | | | 452 | 126 | auto neq = [](const auto& a, const auto& b) { return a != b; }; | 453 | 126 | if (std::ranges::adjacent_find(results, neq) != results.end()) { | 454 | 0 | std::cerr << "begin errormessage for do_conversion\n"; | 455 | 0 | std::cerr << "in fuzz case for " << name << " invoked with " << src.size() | 456 | 0 | << " elements:\n"; | 457 | 0 | std::cerr << "input data is valid ? " << inputisvalid << '\n'; | 458 | 0 | for (std::size_t i = 0; i < results.size(); ++i) { | 459 | 0 | std::cerr << "got return " << std::dec << results[i] | 460 | 0 | << " from implementation " << implementations[i]->name() | 461 | 0 | << " using outlen=" << outlength.at(i) << '\n'; | 462 | 0 | } | 463 | 0 | for (std::size_t i = 0; i < results.size(); ++i) { | 464 | 0 | std::cerr << "implementation " << implementations[i]->name() | 465 | 0 | << " out: "; | 466 | 0 | for (const auto e : outputbuffers.at(i)) { | 467 | 0 | std::cerr << +e << ", "; | 468 | 0 | } | 469 | 0 | std::cerr << '\n'; | 470 | 0 | } | 471 | 0 | std::cerr << "end errormessage\n"; | 472 | 0 | ret.implementations_agree = false; | 473 | 126 | } else { | 474 | 126 | ret.implementations_agree = true; | 475 | 126 | } | 476 | 126 | return ret; | 477 | 126 | } |
Conversion<(UtfEncodings)0, (UtfEncodings)3, unsigned long (simdutf::implementation::*)(char16_t const*, unsigned long) noexcept const, simdutf::result (simdutf::implementation::*)(char16_t const*, unsigned long, char32_t*) noexcept const>::do_conversion(std::__1::span<char16_t const, 18446744073709551615ul>, std::__1::vector<unsigned long, std::__1::allocator<unsigned long> > const&, bool) const Line | Count | Source | 382 | 150 | const bool inputisvalid) const { | 383 | 150 | conversion_result ret{}; | 384 | | | 385 | 150 | const auto implementations = get_supported_implementations(); | 386 | | | 387 | 150 | std::vector<result<ConversionResult>> results; | 388 | 150 | results.reserve(implementations.size()); | 389 | | | 390 | | // put the output in a separate allocation to make access violations easier | 391 | | // to catch | 392 | 150 | std::vector<std::vector<ToType>> outputbuffers; | 393 | 150 | outputbuffers.reserve(implementations.size()); | 394 | 600 | for (std::size_t i = 0; i < implementations.size(); ++i) { | 395 | 450 | auto impl = implementations[i]; | 396 | 450 | const ToType canary1{42}; | 397 | 450 | auto& outputbuffer = outputbuffers.emplace_back(outlength.at(i), canary1); | 398 | 450 | const auto implret1 = std::invoke(conversion, impl, src.data(), | 399 | 450 | src.size(), outputbuffer.data()); | 400 | | // was the conversion successful? | 401 | 450 | const auto success = [](const ConversionResult& r) -> bool { | 402 | 450 | if constexpr (std::is_same_v<ConversionResult, std::size_t>) { | 403 | 450 | return r != 0; | 404 | 450 | } else { | 405 | 450 | return r.error == simdutf::error_code::SUCCESS; | 406 | 450 | } | 407 | 450 | }(implret1); | 408 | 450 | const auto hash1 = FNV1A_hash::as_str(outputbuffer); | 409 | 450 | if constexpr (use_canary_in_output) { | 410 | | // optionally convert again, this time with the buffer filled with | 411 | | // a different value. if the output differs, it means some of the buffer | 412 | | // was not written to by the conversion function. | 413 | 450 | const ToType canary2{25}; | 414 | 450 | const auto outputbuffer_first_run = outputbuffer; | 415 | 450 | std::ranges::fill(outputbuffer, canary2); | 416 | 450 | const auto implret2 = std::invoke(conversion, impl, src.data(), | 417 | 450 | src.size(), outputbuffer.data()); | 418 | | | 419 | 450 | if (implret1 != implret2) { | 420 | 0 | std::cerr << "different return value the second time!\n"; | 421 | 0 | std::abort(); | 422 | 0 | } | 423 | 450 | if (inputisvalid && success) { | 424 | | // only care about the output if the input is valid | 425 | 240 | const auto hash2 = FNV1A_hash::as_str(outputbuffer); | 426 | 240 | if (hash1 != hash2) { | 427 | 0 | std::cerr << "different output the second time!\n"; | 428 | 0 | std::cerr << "implementation " << impl->name() << " " << name | 429 | 0 | << '\n'; | 430 | 0 | std::cerr << "input is valid=" << inputisvalid << '\n'; | 431 | 0 | std::cerr << "output length=" << outputbuffer.size() << '\n'; | 432 | 0 | std::cerr << "conversion was a success? " << success << '\n'; | 433 | 0 | for (std::size_t j = 0; j < outputbuffer.size(); ++j) { | 434 | 0 | std::cerr << "output[" << j << "]\t" << +outputbuffer_first_run[j] | 435 | 0 | << '\t' << +outputbuffer[j] << '\n'; | 436 | 0 | } | 437 | 0 | std::abort(); | 438 | 0 | } | 439 | 240 | } | 440 | 450 | } | 441 | 450 | results.emplace_back(implret1, success ? hash1 : ""); | 442 | 450 | } | 443 | | | 444 | | // do not require implementations to give the same output if | 445 | | // the input is not valid. | 446 | 150 | if (!inputisvalid) { | 447 | 210 | for (auto& e : results) { | 448 | 210 | e.outputhash.clear(); | 449 | 210 | } | 450 | 70 | } | 451 | | | 452 | 150 | auto neq = [](const auto& a, const auto& b) { return a != b; }; | 453 | 150 | if (std::ranges::adjacent_find(results, neq) != results.end()) { | 454 | 0 | std::cerr << "begin errormessage for do_conversion\n"; | 455 | 0 | std::cerr << "in fuzz case for " << name << " invoked with " << src.size() | 456 | 0 | << " elements:\n"; | 457 | 0 | std::cerr << "input data is valid ? " << inputisvalid << '\n'; | 458 | 0 | for (std::size_t i = 0; i < results.size(); ++i) { | 459 | 0 | std::cerr << "got return " << std::dec << results[i] | 460 | 0 | << " from implementation " << implementations[i]->name() | 461 | 0 | << " using outlen=" << outlength.at(i) << '\n'; | 462 | 0 | } | 463 | 0 | for (std::size_t i = 0; i < results.size(); ++i) { | 464 | 0 | std::cerr << "implementation " << implementations[i]->name() | 465 | 0 | << " out: "; | 466 | 0 | for (const auto e : outputbuffers.at(i)) { | 467 | 0 | std::cerr << +e << ", "; | 468 | 0 | } | 469 | 0 | std::cerr << '\n'; | 470 | 0 | } | 471 | 0 | std::cerr << "end errormessage\n"; | 472 | 0 | ret.implementations_agree = false; | 473 | 150 | } else { | 474 | 150 | ret.implementations_agree = true; | 475 | 150 | } | 476 | 150 | return ret; | 477 | 150 | } |
Conversion<(UtfEncodings)0, (UtfEncodings)2, unsigned long (simdutf::implementation::*)(char16_t const*, unsigned long) noexcept const, simdutf::result (simdutf::implementation::*)(char16_t const*, unsigned long, char*) noexcept const>::do_conversion(std::__1::span<char16_t const, 18446744073709551615ul>, std::__1::vector<unsigned long, std::__1::allocator<unsigned long> > const&, bool) const Line | Count | Source | 382 | 293 | const bool inputisvalid) const { | 383 | 293 | conversion_result ret{}; | 384 | | | 385 | 293 | const auto implementations = get_supported_implementations(); | 386 | | | 387 | 293 | std::vector<result<ConversionResult>> results; | 388 | 293 | results.reserve(implementations.size()); | 389 | | | 390 | | // put the output in a separate allocation to make access violations easier | 391 | | // to catch | 392 | 293 | std::vector<std::vector<ToType>> outputbuffers; | 393 | 293 | outputbuffers.reserve(implementations.size()); | 394 | 1.17k | for (std::size_t i = 0; i < implementations.size(); ++i) { | 395 | 879 | auto impl = implementations[i]; | 396 | 879 | const ToType canary1{42}; | 397 | 879 | auto& outputbuffer = outputbuffers.emplace_back(outlength.at(i), canary1); | 398 | 879 | const auto implret1 = std::invoke(conversion, impl, src.data(), | 399 | 879 | src.size(), outputbuffer.data()); | 400 | | // was the conversion successful? | 401 | 879 | const auto success = [](const ConversionResult& r) -> bool { | 402 | 879 | if constexpr (std::is_same_v<ConversionResult, std::size_t>) { | 403 | 879 | return r != 0; | 404 | 879 | } else { | 405 | 879 | return r.error == simdutf::error_code::SUCCESS; | 406 | 879 | } | 407 | 879 | }(implret1); | 408 | 879 | const auto hash1 = FNV1A_hash::as_str(outputbuffer); | 409 | 879 | if constexpr (use_canary_in_output) { | 410 | | // optionally convert again, this time with the buffer filled with | 411 | | // a different value. if the output differs, it means some of the buffer | 412 | | // was not written to by the conversion function. | 413 | 879 | const ToType canary2{25}; | 414 | 879 | const auto outputbuffer_first_run = outputbuffer; | 415 | 879 | std::ranges::fill(outputbuffer, canary2); | 416 | 879 | const auto implret2 = std::invoke(conversion, impl, src.data(), | 417 | 879 | src.size(), outputbuffer.data()); | 418 | | | 419 | 879 | if (implret1 != implret2) { | 420 | 0 | std::cerr << "different return value the second time!\n"; | 421 | 0 | std::abort(); | 422 | 0 | } | 423 | 879 | if (inputisvalid && success) { | 424 | | // only care about the output if the input is valid | 425 | 504 | const auto hash2 = FNV1A_hash::as_str(outputbuffer); | 426 | 504 | if (hash1 != hash2) { | 427 | 0 | std::cerr << "different output the second time!\n"; | 428 | 0 | std::cerr << "implementation " << impl->name() << " " << name | 429 | 0 | << '\n'; | 430 | 0 | std::cerr << "input is valid=" << inputisvalid << '\n'; | 431 | 0 | std::cerr << "output length=" << outputbuffer.size() << '\n'; | 432 | 0 | std::cerr << "conversion was a success? " << success << '\n'; | 433 | 0 | for (std::size_t j = 0; j < outputbuffer.size(); ++j) { | 434 | 0 | std::cerr << "output[" << j << "]\t" << +outputbuffer_first_run[j] | 435 | 0 | << '\t' << +outputbuffer[j] << '\n'; | 436 | 0 | } | 437 | 0 | std::abort(); | 438 | 0 | } | 439 | 504 | } | 440 | 879 | } | 441 | 879 | results.emplace_back(implret1, success ? hash1 : ""); | 442 | 879 | } | 443 | | | 444 | | // do not require implementations to give the same output if | 445 | | // the input is not valid. | 446 | 293 | if (!inputisvalid) { | 447 | 375 | for (auto& e : results) { | 448 | 375 | e.outputhash.clear(); | 449 | 375 | } | 450 | 125 | } | 451 | | | 452 | 293 | auto neq = [](const auto& a, const auto& b) { return a != b; }; | 453 | 293 | if (std::ranges::adjacent_find(results, neq) != results.end()) { | 454 | 0 | std::cerr << "begin errormessage for do_conversion\n"; | 455 | 0 | std::cerr << "in fuzz case for " << name << " invoked with " << src.size() | 456 | 0 | << " elements:\n"; | 457 | 0 | std::cerr << "input data is valid ? " << inputisvalid << '\n'; | 458 | 0 | for (std::size_t i = 0; i < results.size(); ++i) { | 459 | 0 | std::cerr << "got return " << std::dec << results[i] | 460 | 0 | << " from implementation " << implementations[i]->name() | 461 | 0 | << " using outlen=" << outlength.at(i) << '\n'; | 462 | 0 | } | 463 | 0 | for (std::size_t i = 0; i < results.size(); ++i) { | 464 | 0 | std::cerr << "implementation " << implementations[i]->name() | 465 | 0 | << " out: "; | 466 | 0 | for (const auto e : outputbuffers.at(i)) { | 467 | 0 | std::cerr << +e << ", "; | 468 | 0 | } | 469 | 0 | std::cerr << '\n'; | 470 | 0 | } | 471 | 0 | std::cerr << "end errormessage\n"; | 472 | 0 | ret.implementations_agree = false; | 473 | 293 | } else { | 474 | 293 | ret.implementations_agree = true; | 475 | 293 | } | 476 | 293 | return ret; | 477 | 293 | } |
Conversion<(UtfEncodings)1, (UtfEncodings)4, unsigned long (simdutf::implementation::*)(unsigned long) noexcept const, simdutf::result (simdutf::implementation::*)(char16_t const*, unsigned long, char*) noexcept const>::do_conversion(std::__1::span<char16_t const, 18446744073709551615ul>, std::__1::vector<unsigned long, std::__1::allocator<unsigned long> > const&, bool) const Line | Count | Source | 382 | 115 | const bool inputisvalid) const { | 383 | 115 | conversion_result ret{}; | 384 | | | 385 | 115 | const auto implementations = get_supported_implementations(); | 386 | | | 387 | 115 | std::vector<result<ConversionResult>> results; | 388 | 115 | results.reserve(implementations.size()); | 389 | | | 390 | | // put the output in a separate allocation to make access violations easier | 391 | | // to catch | 392 | 115 | std::vector<std::vector<ToType>> outputbuffers; | 393 | 115 | outputbuffers.reserve(implementations.size()); | 394 | 460 | for (std::size_t i = 0; i < implementations.size(); ++i) { | 395 | 345 | auto impl = implementations[i]; | 396 | 345 | const ToType canary1{42}; | 397 | 345 | auto& outputbuffer = outputbuffers.emplace_back(outlength.at(i), canary1); | 398 | 345 | const auto implret1 = std::invoke(conversion, impl, src.data(), | 399 | 345 | src.size(), outputbuffer.data()); | 400 | | // was the conversion successful? | 401 | 345 | const auto success = [](const ConversionResult& r) -> bool { | 402 | 345 | if constexpr (std::is_same_v<ConversionResult, std::size_t>) { | 403 | 345 | return r != 0; | 404 | 345 | } else { | 405 | 345 | return r.error == simdutf::error_code::SUCCESS; | 406 | 345 | } | 407 | 345 | }(implret1); | 408 | 345 | const auto hash1 = FNV1A_hash::as_str(outputbuffer); | 409 | 345 | if constexpr (use_canary_in_output) { | 410 | | // optionally convert again, this time with the buffer filled with | 411 | | // a different value. if the output differs, it means some of the buffer | 412 | | // was not written to by the conversion function. | 413 | 345 | const ToType canary2{25}; | 414 | 345 | const auto outputbuffer_first_run = outputbuffer; | 415 | 345 | std::ranges::fill(outputbuffer, canary2); | 416 | 345 | const auto implret2 = std::invoke(conversion, impl, src.data(), | 417 | 345 | src.size(), outputbuffer.data()); | 418 | | | 419 | 345 | if (implret1 != implret2) { | 420 | 0 | std::cerr << "different return value the second time!\n"; | 421 | 0 | std::abort(); | 422 | 0 | } | 423 | 345 | if (inputisvalid && success) { | 424 | | // only care about the output if the input is valid | 425 | 123 | const auto hash2 = FNV1A_hash::as_str(outputbuffer); | 426 | 123 | if (hash1 != hash2) { | 427 | 0 | std::cerr << "different output the second time!\n"; | 428 | 0 | std::cerr << "implementation " << impl->name() << " " << name | 429 | 0 | << '\n'; | 430 | 0 | std::cerr << "input is valid=" << inputisvalid << '\n'; | 431 | 0 | std::cerr << "output length=" << outputbuffer.size() << '\n'; | 432 | 0 | std::cerr << "conversion was a success? " << success << '\n'; | 433 | 0 | for (std::size_t j = 0; j < outputbuffer.size(); ++j) { | 434 | 0 | std::cerr << "output[" << j << "]\t" << +outputbuffer_first_run[j] | 435 | 0 | << '\t' << +outputbuffer[j] << '\n'; | 436 | 0 | } | 437 | 0 | std::abort(); | 438 | 0 | } | 439 | 123 | } | 440 | 345 | } | 441 | 345 | results.emplace_back(implret1, success ? hash1 : ""); | 442 | 345 | } | 443 | | | 444 | | // do not require implementations to give the same output if | 445 | | // the input is not valid. | 446 | 115 | if (!inputisvalid) { | 447 | 63 | for (auto& e : results) { | 448 | 63 | e.outputhash.clear(); | 449 | 63 | } | 450 | 21 | } | 451 | | | 452 | 115 | auto neq = [](const auto& a, const auto& b) { return a != b; }; | 453 | 115 | if (std::ranges::adjacent_find(results, neq) != results.end()) { | 454 | 0 | std::cerr << "begin errormessage for do_conversion\n"; | 455 | 0 | std::cerr << "in fuzz case for " << name << " invoked with " << src.size() | 456 | 0 | << " elements:\n"; | 457 | 0 | std::cerr << "input data is valid ? " << inputisvalid << '\n'; | 458 | 0 | for (std::size_t i = 0; i < results.size(); ++i) { | 459 | 0 | std::cerr << "got return " << std::dec << results[i] | 460 | 0 | << " from implementation " << implementations[i]->name() | 461 | 0 | << " using outlen=" << outlength.at(i) << '\n'; | 462 | 0 | } | 463 | 0 | for (std::size_t i = 0; i < results.size(); ++i) { | 464 | 0 | std::cerr << "implementation " << implementations[i]->name() | 465 | 0 | << " out: "; | 466 | 0 | for (const auto e : outputbuffers.at(i)) { | 467 | 0 | std::cerr << +e << ", "; | 468 | 0 | } | 469 | 0 | std::cerr << '\n'; | 470 | 0 | } | 471 | 0 | std::cerr << "end errormessage\n"; | 472 | 0 | ret.implementations_agree = false; | 473 | 115 | } else { | 474 | 115 | ret.implementations_agree = true; | 475 | 115 | } | 476 | 115 | return ret; | 477 | 115 | } |
Conversion<(UtfEncodings)1, (UtfEncodings)3, unsigned long (simdutf::implementation::*)(char16_t const*, unsigned long) noexcept const, simdutf::result (simdutf::implementation::*)(char16_t const*, unsigned long, char32_t*) noexcept const>::do_conversion(std::__1::span<char16_t const, 18446744073709551615ul>, std::__1::vector<unsigned long, std::__1::allocator<unsigned long> > const&, bool) const Line | Count | Source | 382 | 207 | const bool inputisvalid) const { | 383 | 207 | conversion_result ret{}; | 384 | | | 385 | 207 | const auto implementations = get_supported_implementations(); | 386 | | | 387 | 207 | std::vector<result<ConversionResult>> results; | 388 | 207 | results.reserve(implementations.size()); | 389 | | | 390 | | // put the output in a separate allocation to make access violations easier | 391 | | // to catch | 392 | 207 | std::vector<std::vector<ToType>> outputbuffers; | 393 | 207 | outputbuffers.reserve(implementations.size()); | 394 | 828 | for (std::size_t i = 0; i < implementations.size(); ++i) { | 395 | 621 | auto impl = implementations[i]; | 396 | 621 | const ToType canary1{42}; | 397 | 621 | auto& outputbuffer = outputbuffers.emplace_back(outlength.at(i), canary1); | 398 | 621 | const auto implret1 = std::invoke(conversion, impl, src.data(), | 399 | 621 | src.size(), outputbuffer.data()); | 400 | | // was the conversion successful? | 401 | 621 | const auto success = [](const ConversionResult& r) -> bool { | 402 | 621 | if constexpr (std::is_same_v<ConversionResult, std::size_t>) { | 403 | 621 | return r != 0; | 404 | 621 | } else { | 405 | 621 | return r.error == simdutf::error_code::SUCCESS; | 406 | 621 | } | 407 | 621 | }(implret1); | 408 | 621 | const auto hash1 = FNV1A_hash::as_str(outputbuffer); | 409 | 621 | if constexpr (use_canary_in_output) { | 410 | | // optionally convert again, this time with the buffer filled with | 411 | | // a different value. if the output differs, it means some of the buffer | 412 | | // was not written to by the conversion function. | 413 | 621 | const ToType canary2{25}; | 414 | 621 | const auto outputbuffer_first_run = outputbuffer; | 415 | 621 | std::ranges::fill(outputbuffer, canary2); | 416 | 621 | const auto implret2 = std::invoke(conversion, impl, src.data(), | 417 | 621 | src.size(), outputbuffer.data()); | 418 | | | 419 | 621 | if (implret1 != implret2) { | 420 | 0 | std::cerr << "different return value the second time!\n"; | 421 | 0 | std::abort(); | 422 | 0 | } | 423 | 621 | if (inputisvalid && success) { | 424 | | // only care about the output if the input is valid | 425 | 285 | const auto hash2 = FNV1A_hash::as_str(outputbuffer); | 426 | 285 | if (hash1 != hash2) { | 427 | 0 | std::cerr << "different output the second time!\n"; | 428 | 0 | std::cerr << "implementation " << impl->name() << " " << name | 429 | 0 | << '\n'; | 430 | 0 | std::cerr << "input is valid=" << inputisvalid << '\n'; | 431 | 0 | std::cerr << "output length=" << outputbuffer.size() << '\n'; | 432 | 0 | std::cerr << "conversion was a success? " << success << '\n'; | 433 | 0 | for (std::size_t j = 0; j < outputbuffer.size(); ++j) { | 434 | 0 | std::cerr << "output[" << j << "]\t" << +outputbuffer_first_run[j] | 435 | 0 | << '\t' << +outputbuffer[j] << '\n'; | 436 | 0 | } | 437 | 0 | std::abort(); | 438 | 0 | } | 439 | 285 | } | 440 | 621 | } | 441 | 621 | results.emplace_back(implret1, success ? hash1 : ""); | 442 | 621 | } | 443 | | | 444 | | // do not require implementations to give the same output if | 445 | | // the input is not valid. | 446 | 207 | if (!inputisvalid) { | 447 | 336 | for (auto& e : results) { | 448 | 336 | e.outputhash.clear(); | 449 | 336 | } | 450 | 112 | } | 451 | | | 452 | 207 | auto neq = [](const auto& a, const auto& b) { return a != b; }; | 453 | 207 | if (std::ranges::adjacent_find(results, neq) != results.end()) { | 454 | 0 | std::cerr << "begin errormessage for do_conversion\n"; | 455 | 0 | std::cerr << "in fuzz case for " << name << " invoked with " << src.size() | 456 | 0 | << " elements:\n"; | 457 | 0 | std::cerr << "input data is valid ? " << inputisvalid << '\n'; | 458 | 0 | for (std::size_t i = 0; i < results.size(); ++i) { | 459 | 0 | std::cerr << "got return " << std::dec << results[i] | 460 | 0 | << " from implementation " << implementations[i]->name() | 461 | 0 | << " using outlen=" << outlength.at(i) << '\n'; | 462 | 0 | } | 463 | 0 | for (std::size_t i = 0; i < results.size(); ++i) { | 464 | 0 | std::cerr << "implementation " << implementations[i]->name() | 465 | 0 | << " out: "; | 466 | 0 | for (const auto e : outputbuffers.at(i)) { | 467 | 0 | std::cerr << +e << ", "; | 468 | 0 | } | 469 | 0 | std::cerr << '\n'; | 470 | 0 | } | 471 | 0 | std::cerr << "end errormessage\n"; | 472 | 0 | ret.implementations_agree = false; | 473 | 207 | } else { | 474 | 207 | ret.implementations_agree = true; | 475 | 207 | } | 476 | 207 | return ret; | 477 | 207 | } |
Conversion<(UtfEncodings)1, (UtfEncodings)2, unsigned long (simdutf::implementation::*)(char16_t const*, unsigned long) noexcept const, simdutf::result (simdutf::implementation::*)(char16_t const*, unsigned long, char*) noexcept const>::do_conversion(std::__1::span<char16_t const, 18446744073709551615ul>, std::__1::vector<unsigned long, std::__1::allocator<unsigned long> > const&, bool) const Line | Count | Source | 382 | 315 | const bool inputisvalid) const { | 383 | 315 | conversion_result ret{}; | 384 | | | 385 | 315 | const auto implementations = get_supported_implementations(); | 386 | | | 387 | 315 | std::vector<result<ConversionResult>> results; | 388 | 315 | results.reserve(implementations.size()); | 389 | | | 390 | | // put the output in a separate allocation to make access violations easier | 391 | | // to catch | 392 | 315 | std::vector<std::vector<ToType>> outputbuffers; | 393 | 315 | outputbuffers.reserve(implementations.size()); | 394 | 1.26k | for (std::size_t i = 0; i < implementations.size(); ++i) { | 395 | 945 | auto impl = implementations[i]; | 396 | 945 | const ToType canary1{42}; | 397 | 945 | auto& outputbuffer = outputbuffers.emplace_back(outlength.at(i), canary1); | 398 | 945 | const auto implret1 = std::invoke(conversion, impl, src.data(), | 399 | 945 | src.size(), outputbuffer.data()); | 400 | | // was the conversion successful? | 401 | 945 | const auto success = [](const ConversionResult& r) -> bool { | 402 | 945 | if constexpr (std::is_same_v<ConversionResult, std::size_t>) { | 403 | 945 | return r != 0; | 404 | 945 | } else { | 405 | 945 | return r.error == simdutf::error_code::SUCCESS; | 406 | 945 | } | 407 | 945 | }(implret1); | 408 | 945 | const auto hash1 = FNV1A_hash::as_str(outputbuffer); | 409 | 945 | if constexpr (use_canary_in_output) { | 410 | | // optionally convert again, this time with the buffer filled with | 411 | | // a different value. if the output differs, it means some of the buffer | 412 | | // was not written to by the conversion function. | 413 | 945 | const ToType canary2{25}; | 414 | 945 | const auto outputbuffer_first_run = outputbuffer; | 415 | 945 | std::ranges::fill(outputbuffer, canary2); | 416 | 945 | const auto implret2 = std::invoke(conversion, impl, src.data(), | 417 | 945 | src.size(), outputbuffer.data()); | 418 | | | 419 | 945 | if (implret1 != implret2) { | 420 | 0 | std::cerr << "different return value the second time!\n"; | 421 | 0 | std::abort(); | 422 | 0 | } | 423 | 945 | if (inputisvalid && success) { | 424 | | // only care about the output if the input is valid | 425 | 621 | const auto hash2 = FNV1A_hash::as_str(outputbuffer); | 426 | 621 | if (hash1 != hash2) { | 427 | 0 | std::cerr << "different output the second time!\n"; | 428 | 0 | std::cerr << "implementation " << impl->name() << " " << name | 429 | 0 | << '\n'; | 430 | 0 | std::cerr << "input is valid=" << inputisvalid << '\n'; | 431 | 0 | std::cerr << "output length=" << outputbuffer.size() << '\n'; | 432 | 0 | std::cerr << "conversion was a success? " << success << '\n'; | 433 | 0 | for (std::size_t j = 0; j < outputbuffer.size(); ++j) { | 434 | 0 | std::cerr << "output[" << j << "]\t" << +outputbuffer_first_run[j] | 435 | 0 | << '\t' << +outputbuffer[j] << '\n'; | 436 | 0 | } | 437 | 0 | std::abort(); | 438 | 0 | } | 439 | 621 | } | 440 | 945 | } | 441 | 945 | results.emplace_back(implret1, success ? hash1 : ""); | 442 | 945 | } | 443 | | | 444 | | // do not require implementations to give the same output if | 445 | | // the input is not valid. | 446 | 315 | if (!inputisvalid) { | 447 | 324 | for (auto& e : results) { | 448 | 324 | e.outputhash.clear(); | 449 | 324 | } | 450 | 108 | } | 451 | | | 452 | 315 | auto neq = [](const auto& a, const auto& b) { return a != b; }; | 453 | 315 | if (std::ranges::adjacent_find(results, neq) != results.end()) { | 454 | 0 | std::cerr << "begin errormessage for do_conversion\n"; | 455 | 0 | std::cerr << "in fuzz case for " << name << " invoked with " << src.size() | 456 | 0 | << " elements:\n"; | 457 | 0 | std::cerr << "input data is valid ? " << inputisvalid << '\n'; | 458 | 0 | for (std::size_t i = 0; i < results.size(); ++i) { | 459 | 0 | std::cerr << "got return " << std::dec << results[i] | 460 | 0 | << " from implementation " << implementations[i]->name() | 461 | 0 | << " using outlen=" << outlength.at(i) << '\n'; | 462 | 0 | } | 463 | 0 | for (std::size_t i = 0; i < results.size(); ++i) { | 464 | 0 | std::cerr << "implementation " << implementations[i]->name() | 465 | 0 | << " out: "; | 466 | 0 | for (const auto e : outputbuffers.at(i)) { | 467 | 0 | std::cerr << +e << ", "; | 468 | 0 | } | 469 | 0 | std::cerr << '\n'; | 470 | 0 | } | 471 | 0 | std::cerr << "end errormessage\n"; | 472 | 0 | ret.implementations_agree = false; | 473 | 315 | } else { | 474 | 315 | ret.implementations_agree = true; | 475 | 315 | } | 476 | 315 | return ret; | 477 | 315 | } |
Conversion<(UtfEncodings)3, (UtfEncodings)4, unsigned long (simdutf::implementation::*)(unsigned long) noexcept const, simdutf::result (simdutf::implementation::*)(char32_t const*, unsigned long, char*) noexcept const>::do_conversion(std::__1::span<char32_t const, 18446744073709551615ul>, std::__1::vector<unsigned long, std::__1::allocator<unsigned long> > const&, bool) const Line | Count | Source | 382 | 210 | const bool inputisvalid) const { | 383 | 210 | conversion_result ret{}; | 384 | | | 385 | 210 | const auto implementations = get_supported_implementations(); | 386 | | | 387 | 210 | std::vector<result<ConversionResult>> results; | 388 | 210 | results.reserve(implementations.size()); | 389 | | | 390 | | // put the output in a separate allocation to make access violations easier | 391 | | // to catch | 392 | 210 | std::vector<std::vector<ToType>> outputbuffers; | 393 | 210 | outputbuffers.reserve(implementations.size()); | 394 | 840 | for (std::size_t i = 0; i < implementations.size(); ++i) { | 395 | 630 | auto impl = implementations[i]; | 396 | 630 | const ToType canary1{42}; | 397 | 630 | auto& outputbuffer = outputbuffers.emplace_back(outlength.at(i), canary1); | 398 | 630 | const auto implret1 = std::invoke(conversion, impl, src.data(), | 399 | 630 | src.size(), outputbuffer.data()); | 400 | | // was the conversion successful? | 401 | 630 | const auto success = [](const ConversionResult& r) -> bool { | 402 | 630 | if constexpr (std::is_same_v<ConversionResult, std::size_t>) { | 403 | 630 | return r != 0; | 404 | 630 | } else { | 405 | 630 | return r.error == simdutf::error_code::SUCCESS; | 406 | 630 | } | 407 | 630 | }(implret1); | 408 | 630 | const auto hash1 = FNV1A_hash::as_str(outputbuffer); | 409 | 630 | if constexpr (use_canary_in_output) { | 410 | | // optionally convert again, this time with the buffer filled with | 411 | | // a different value. if the output differs, it means some of the buffer | 412 | | // was not written to by the conversion function. | 413 | 630 | const ToType canary2{25}; | 414 | 630 | const auto outputbuffer_first_run = outputbuffer; | 415 | 630 | std::ranges::fill(outputbuffer, canary2); | 416 | 630 | const auto implret2 = std::invoke(conversion, impl, src.data(), | 417 | 630 | src.size(), outputbuffer.data()); | 418 | | | 419 | 630 | if (implret1 != implret2) { | 420 | 0 | std::cerr << "different return value the second time!\n"; | 421 | 0 | std::abort(); | 422 | 0 | } | 423 | 630 | if (inputisvalid && success) { | 424 | | // only care about the output if the input is valid | 425 | 75 | const auto hash2 = FNV1A_hash::as_str(outputbuffer); | 426 | 75 | if (hash1 != hash2) { | 427 | 0 | std::cerr << "different output the second time!\n"; | 428 | 0 | std::cerr << "implementation " << impl->name() << " " << name | 429 | 0 | << '\n'; | 430 | 0 | std::cerr << "input is valid=" << inputisvalid << '\n'; | 431 | 0 | std::cerr << "output length=" << outputbuffer.size() << '\n'; | 432 | 0 | std::cerr << "conversion was a success? " << success << '\n'; | 433 | 0 | for (std::size_t j = 0; j < outputbuffer.size(); ++j) { | 434 | 0 | std::cerr << "output[" << j << "]\t" << +outputbuffer_first_run[j] | 435 | 0 | << '\t' << +outputbuffer[j] << '\n'; | 436 | 0 | } | 437 | 0 | std::abort(); | 438 | 0 | } | 439 | 75 | } | 440 | 630 | } | 441 | 630 | results.emplace_back(implret1, success ? hash1 : ""); | 442 | 630 | } | 443 | | | 444 | | // do not require implementations to give the same output if | 445 | | // the input is not valid. | 446 | 210 | if (!inputisvalid) { | 447 | 528 | for (auto& e : results) { | 448 | 528 | e.outputhash.clear(); | 449 | 528 | } | 450 | 176 | } | 451 | | | 452 | 210 | auto neq = [](const auto& a, const auto& b) { return a != b; }; | 453 | 210 | if (std::ranges::adjacent_find(results, neq) != results.end()) { | 454 | 0 | std::cerr << "begin errormessage for do_conversion\n"; | 455 | 0 | std::cerr << "in fuzz case for " << name << " invoked with " << src.size() | 456 | 0 | << " elements:\n"; | 457 | 0 | std::cerr << "input data is valid ? " << inputisvalid << '\n'; | 458 | 0 | for (std::size_t i = 0; i < results.size(); ++i) { | 459 | 0 | std::cerr << "got return " << std::dec << results[i] | 460 | 0 | << " from implementation " << implementations[i]->name() | 461 | 0 | << " using outlen=" << outlength.at(i) << '\n'; | 462 | 0 | } | 463 | 0 | for (std::size_t i = 0; i < results.size(); ++i) { | 464 | 0 | std::cerr << "implementation " << implementations[i]->name() | 465 | 0 | << " out: "; | 466 | 0 | for (const auto e : outputbuffers.at(i)) { | 467 | 0 | std::cerr << +e << ", "; | 468 | 0 | } | 469 | 0 | std::cerr << '\n'; | 470 | 0 | } | 471 | 0 | std::cerr << "end errormessage\n"; | 472 | 0 | ret.implementations_agree = false; | 473 | 210 | } else { | 474 | 210 | ret.implementations_agree = true; | 475 | 210 | } | 476 | 210 | return ret; | 477 | 210 | } |
Conversion<(UtfEncodings)3, (UtfEncodings)0, unsigned long (simdutf::implementation::*)(char32_t const*, unsigned long) noexcept const, simdutf::result (simdutf::implementation::*)(char32_t const*, unsigned long, char16_t*) noexcept const>::do_conversion(std::__1::span<char32_t const, 18446744073709551615ul>, std::__1::vector<unsigned long, std::__1::allocator<unsigned long> > const&, bool) const Line | Count | Source | 382 | 303 | const bool inputisvalid) const { | 383 | 303 | conversion_result ret{}; | 384 | | | 385 | 303 | const auto implementations = get_supported_implementations(); | 386 | | | 387 | 303 | std::vector<result<ConversionResult>> results; | 388 | 303 | results.reserve(implementations.size()); | 389 | | | 390 | | // put the output in a separate allocation to make access violations easier | 391 | | // to catch | 392 | 303 | std::vector<std::vector<ToType>> outputbuffers; | 393 | 303 | outputbuffers.reserve(implementations.size()); | 394 | 1.21k | for (std::size_t i = 0; i < implementations.size(); ++i) { | 395 | 909 | auto impl = implementations[i]; | 396 | 909 | const ToType canary1{42}; | 397 | 909 | auto& outputbuffer = outputbuffers.emplace_back(outlength.at(i), canary1); | 398 | 909 | const auto implret1 = std::invoke(conversion, impl, src.data(), | 399 | 909 | src.size(), outputbuffer.data()); | 400 | | // was the conversion successful? | 401 | 909 | const auto success = [](const ConversionResult& r) -> bool { | 402 | 909 | if constexpr (std::is_same_v<ConversionResult, std::size_t>) { | 403 | 909 | return r != 0; | 404 | 909 | } else { | 405 | 909 | return r.error == simdutf::error_code::SUCCESS; | 406 | 909 | } | 407 | 909 | }(implret1); | 408 | 909 | const auto hash1 = FNV1A_hash::as_str(outputbuffer); | 409 | 909 | if constexpr (use_canary_in_output) { | 410 | | // optionally convert again, this time with the buffer filled with | 411 | | // a different value. if the output differs, it means some of the buffer | 412 | | // was not written to by the conversion function. | 413 | 909 | const ToType canary2{25}; | 414 | 909 | const auto outputbuffer_first_run = outputbuffer; | 415 | 909 | std::ranges::fill(outputbuffer, canary2); | 416 | 909 | const auto implret2 = std::invoke(conversion, impl, src.data(), | 417 | 909 | src.size(), outputbuffer.data()); | 418 | | | 419 | 909 | if (implret1 != implret2) { | 420 | 0 | std::cerr << "different return value the second time!\n"; | 421 | 0 | std::abort(); | 422 | 0 | } | 423 | 909 | if (inputisvalid && success) { | 424 | | // only care about the output if the input is valid | 425 | 258 | const auto hash2 = FNV1A_hash::as_str(outputbuffer); | 426 | 258 | if (hash1 != hash2) { | 427 | 0 | std::cerr << "different output the second time!\n"; | 428 | 0 | std::cerr << "implementation " << impl->name() << " " << name | 429 | 0 | << '\n'; | 430 | 0 | std::cerr << "input is valid=" << inputisvalid << '\n'; | 431 | 0 | std::cerr << "output length=" << outputbuffer.size() << '\n'; | 432 | 0 | std::cerr << "conversion was a success? " << success << '\n'; | 433 | 0 | for (std::size_t j = 0; j < outputbuffer.size(); ++j) { | 434 | 0 | std::cerr << "output[" << j << "]\t" << +outputbuffer_first_run[j] | 435 | 0 | << '\t' << +outputbuffer[j] << '\n'; | 436 | 0 | } | 437 | 0 | std::abort(); | 438 | 0 | } | 439 | 258 | } | 440 | 909 | } | 441 | 909 | results.emplace_back(implret1, success ? hash1 : ""); | 442 | 909 | } | 443 | | | 444 | | // do not require implementations to give the same output if | 445 | | // the input is not valid. | 446 | 303 | if (!inputisvalid) { | 447 | 651 | for (auto& e : results) { | 448 | 651 | e.outputhash.clear(); | 449 | 651 | } | 450 | 217 | } | 451 | | | 452 | 303 | auto neq = [](const auto& a, const auto& b) { return a != b; }; | 453 | 303 | if (std::ranges::adjacent_find(results, neq) != results.end()) { | 454 | 0 | std::cerr << "begin errormessage for do_conversion\n"; | 455 | 0 | std::cerr << "in fuzz case for " << name << " invoked with " << src.size() | 456 | 0 | << " elements:\n"; | 457 | 0 | std::cerr << "input data is valid ? " << inputisvalid << '\n'; | 458 | 0 | for (std::size_t i = 0; i < results.size(); ++i) { | 459 | 0 | std::cerr << "got return " << std::dec << results[i] | 460 | 0 | << " from implementation " << implementations[i]->name() | 461 | 0 | << " using outlen=" << outlength.at(i) << '\n'; | 462 | 0 | } | 463 | 0 | for (std::size_t i = 0; i < results.size(); ++i) { | 464 | 0 | std::cerr << "implementation " << implementations[i]->name() | 465 | 0 | << " out: "; | 466 | 0 | for (const auto e : outputbuffers.at(i)) { | 467 | 0 | std::cerr << +e << ", "; | 468 | 0 | } | 469 | 0 | std::cerr << '\n'; | 470 | 0 | } | 471 | 0 | std::cerr << "end errormessage\n"; | 472 | 0 | ret.implementations_agree = false; | 473 | 303 | } else { | 474 | 303 | ret.implementations_agree = true; | 475 | 303 | } | 476 | 303 | return ret; | 477 | 303 | } |
Conversion<(UtfEncodings)3, (UtfEncodings)1, unsigned long (simdutf::implementation::*)(char32_t const*, unsigned long) noexcept const, simdutf::result (simdutf::implementation::*)(char32_t const*, unsigned long, char16_t*) noexcept const>::do_conversion(std::__1::span<char32_t const, 18446744073709551615ul>, std::__1::vector<unsigned long, std::__1::allocator<unsigned long> > const&, bool) const Line | Count | Source | 382 | 358 | const bool inputisvalid) const { | 383 | 358 | conversion_result ret{}; | 384 | | | 385 | 358 | const auto implementations = get_supported_implementations(); | 386 | | | 387 | 358 | std::vector<result<ConversionResult>> results; | 388 | 358 | results.reserve(implementations.size()); | 389 | | | 390 | | // put the output in a separate allocation to make access violations easier | 391 | | // to catch | 392 | 358 | std::vector<std::vector<ToType>> outputbuffers; | 393 | 358 | outputbuffers.reserve(implementations.size()); | 394 | 1.43k | for (std::size_t i = 0; i < implementations.size(); ++i) { | 395 | 1.07k | auto impl = implementations[i]; | 396 | 1.07k | const ToType canary1{42}; | 397 | 1.07k | auto& outputbuffer = outputbuffers.emplace_back(outlength.at(i), canary1); | 398 | 1.07k | const auto implret1 = std::invoke(conversion, impl, src.data(), | 399 | 1.07k | src.size(), outputbuffer.data()); | 400 | | // was the conversion successful? | 401 | 1.07k | const auto success = [](const ConversionResult& r) -> bool { | 402 | 1.07k | if constexpr (std::is_same_v<ConversionResult, std::size_t>) { | 403 | 1.07k | return r != 0; | 404 | 1.07k | } else { | 405 | 1.07k | return r.error == simdutf::error_code::SUCCESS; | 406 | 1.07k | } | 407 | 1.07k | }(implret1); | 408 | 1.07k | const auto hash1 = FNV1A_hash::as_str(outputbuffer); | 409 | 1.07k | if constexpr (use_canary_in_output) { | 410 | | // optionally convert again, this time with the buffer filled with | 411 | | // a different value. if the output differs, it means some of the buffer | 412 | | // was not written to by the conversion function. | 413 | 1.07k | const ToType canary2{25}; | 414 | 1.07k | const auto outputbuffer_first_run = outputbuffer; | 415 | 1.07k | std::ranges::fill(outputbuffer, canary2); | 416 | 1.07k | const auto implret2 = std::invoke(conversion, impl, src.data(), | 417 | 1.07k | src.size(), outputbuffer.data()); | 418 | | | 419 | 1.07k | if (implret1 != implret2) { | 420 | 0 | std::cerr << "different return value the second time!\n"; | 421 | 0 | std::abort(); | 422 | 0 | } | 423 | 1.07k | if (inputisvalid && success) { | 424 | | // only care about the output if the input is valid | 425 | 279 | const auto hash2 = FNV1A_hash::as_str(outputbuffer); | 426 | 279 | if (hash1 != hash2) { | 427 | 0 | std::cerr << "different output the second time!\n"; | 428 | 0 | std::cerr << "implementation " << impl->name() << " " << name | 429 | 0 | << '\n'; | 430 | 0 | std::cerr << "input is valid=" << inputisvalid << '\n'; | 431 | 0 | std::cerr << "output length=" << outputbuffer.size() << '\n'; | 432 | 0 | std::cerr << "conversion was a success? " << success << '\n'; | 433 | 0 | for (std::size_t j = 0; j < outputbuffer.size(); ++j) { | 434 | 0 | std::cerr << "output[" << j << "]\t" << +outputbuffer_first_run[j] | 435 | 0 | << '\t' << +outputbuffer[j] << '\n'; | 436 | 0 | } | 437 | 0 | std::abort(); | 438 | 0 | } | 439 | 279 | } | 440 | 1.07k | } | 441 | 1.07k | results.emplace_back(implret1, success ? hash1 : ""); | 442 | 1.07k | } | 443 | | | 444 | | // do not require implementations to give the same output if | 445 | | // the input is not valid. | 446 | 358 | if (!inputisvalid) { | 447 | 795 | for (auto& e : results) { | 448 | 795 | e.outputhash.clear(); | 449 | 795 | } | 450 | 265 | } | 451 | | | 452 | 358 | auto neq = [](const auto& a, const auto& b) { return a != b; }; | 453 | 358 | if (std::ranges::adjacent_find(results, neq) != results.end()) { | 454 | 0 | std::cerr << "begin errormessage for do_conversion\n"; | 455 | 0 | std::cerr << "in fuzz case for " << name << " invoked with " << src.size() | 456 | 0 | << " elements:\n"; | 457 | 0 | std::cerr << "input data is valid ? " << inputisvalid << '\n'; | 458 | 0 | for (std::size_t i = 0; i < results.size(); ++i) { | 459 | 0 | std::cerr << "got return " << std::dec << results[i] | 460 | 0 | << " from implementation " << implementations[i]->name() | 461 | 0 | << " using outlen=" << outlength.at(i) << '\n'; | 462 | 0 | } | 463 | 0 | for (std::size_t i = 0; i < results.size(); ++i) { | 464 | 0 | std::cerr << "implementation " << implementations[i]->name() | 465 | 0 | << " out: "; | 466 | 0 | for (const auto e : outputbuffers.at(i)) { | 467 | 0 | std::cerr << +e << ", "; | 468 | 0 | } | 469 | 0 | std::cerr << '\n'; | 470 | 0 | } | 471 | 0 | std::cerr << "end errormessage\n"; | 472 | 0 | ret.implementations_agree = false; | 473 | 358 | } else { | 474 | 358 | ret.implementations_agree = true; | 475 | 358 | } | 476 | 358 | return ret; | 477 | 358 | } |
Conversion<(UtfEncodings)3, (UtfEncodings)2, unsigned long (simdutf::implementation::*)(char32_t const*, unsigned long) noexcept const, simdutf::result (simdutf::implementation::*)(char32_t const*, unsigned long, char*) noexcept const>::do_conversion(std::__1::span<char32_t const, 18446744073709551615ul>, std::__1::vector<unsigned long, std::__1::allocator<unsigned long> > const&, bool) const Line | Count | Source | 382 | 415 | const bool inputisvalid) const { | 383 | 415 | conversion_result ret{}; | 384 | | | 385 | 415 | const auto implementations = get_supported_implementations(); | 386 | | | 387 | 415 | std::vector<result<ConversionResult>> results; | 388 | 415 | results.reserve(implementations.size()); | 389 | | | 390 | | // put the output in a separate allocation to make access violations easier | 391 | | // to catch | 392 | 415 | std::vector<std::vector<ToType>> outputbuffers; | 393 | 415 | outputbuffers.reserve(implementations.size()); | 394 | 1.66k | for (std::size_t i = 0; i < implementations.size(); ++i) { | 395 | 1.24k | auto impl = implementations[i]; | 396 | 1.24k | const ToType canary1{42}; | 397 | 1.24k | auto& outputbuffer = outputbuffers.emplace_back(outlength.at(i), canary1); | 398 | 1.24k | const auto implret1 = std::invoke(conversion, impl, src.data(), | 399 | 1.24k | src.size(), outputbuffer.data()); | 400 | | // was the conversion successful? | 401 | 1.24k | const auto success = [](const ConversionResult& r) -> bool { | 402 | 1.24k | if constexpr (std::is_same_v<ConversionResult, std::size_t>) { | 403 | 1.24k | return r != 0; | 404 | 1.24k | } else { | 405 | 1.24k | return r.error == simdutf::error_code::SUCCESS; | 406 | 1.24k | } | 407 | 1.24k | }(implret1); | 408 | 1.24k | const auto hash1 = FNV1A_hash::as_str(outputbuffer); | 409 | 1.24k | if constexpr (use_canary_in_output) { | 410 | | // optionally convert again, this time with the buffer filled with | 411 | | // a different value. if the output differs, it means some of the buffer | 412 | | // was not written to by the conversion function. | 413 | 1.24k | const ToType canary2{25}; | 414 | 1.24k | const auto outputbuffer_first_run = outputbuffer; | 415 | 1.24k | std::ranges::fill(outputbuffer, canary2); | 416 | 1.24k | const auto implret2 = std::invoke(conversion, impl, src.data(), | 417 | 1.24k | src.size(), outputbuffer.data()); | 418 | | | 419 | 1.24k | if (implret1 != implret2) { | 420 | 0 | std::cerr << "different return value the second time!\n"; | 421 | 0 | std::abort(); | 422 | 0 | } | 423 | 1.24k | if (inputisvalid && success) { | 424 | | // only care about the output if the input is valid | 425 | 297 | const auto hash2 = FNV1A_hash::as_str(outputbuffer); | 426 | 297 | if (hash1 != hash2) { | 427 | 0 | std::cerr << "different output the second time!\n"; | 428 | 0 | std::cerr << "implementation " << impl->name() << " " << name | 429 | 0 | << '\n'; | 430 | 0 | std::cerr << "input is valid=" << inputisvalid << '\n'; | 431 | 0 | std::cerr << "output length=" << outputbuffer.size() << '\n'; | 432 | 0 | std::cerr << "conversion was a success? " << success << '\n'; | 433 | 0 | for (std::size_t j = 0; j < outputbuffer.size(); ++j) { | 434 | 0 | std::cerr << "output[" << j << "]\t" << +outputbuffer_first_run[j] | 435 | 0 | << '\t' << +outputbuffer[j] << '\n'; | 436 | 0 | } | 437 | 0 | std::abort(); | 438 | 0 | } | 439 | 297 | } | 440 | 1.24k | } | 441 | 1.24k | results.emplace_back(implret1, success ? hash1 : ""); | 442 | 1.24k | } | 443 | | | 444 | | // do not require implementations to give the same output if | 445 | | // the input is not valid. | 446 | 415 | if (!inputisvalid) { | 447 | 948 | for (auto& e : results) { | 448 | 948 | e.outputhash.clear(); | 449 | 948 | } | 450 | 316 | } | 451 | | | 452 | 415 | auto neq = [](const auto& a, const auto& b) { return a != b; }; | 453 | 415 | if (std::ranges::adjacent_find(results, neq) != results.end()) { | 454 | 0 | std::cerr << "begin errormessage for do_conversion\n"; | 455 | 0 | std::cerr << "in fuzz case for " << name << " invoked with " << src.size() | 456 | 0 | << " elements:\n"; | 457 | 0 | std::cerr << "input data is valid ? " << inputisvalid << '\n'; | 458 | 0 | for (std::size_t i = 0; i < results.size(); ++i) { | 459 | 0 | std::cerr << "got return " << std::dec << results[i] | 460 | 0 | << " from implementation " << implementations[i]->name() | 461 | 0 | << " using outlen=" << outlength.at(i) << '\n'; | 462 | 0 | } | 463 | 0 | for (std::size_t i = 0; i < results.size(); ++i) { | 464 | 0 | std::cerr << "implementation " << implementations[i]->name() | 465 | 0 | << " out: "; | 466 | 0 | for (const auto e : outputbuffers.at(i)) { | 467 | 0 | std::cerr << +e << ", "; | 468 | 0 | } | 469 | 0 | std::cerr << '\n'; | 470 | 0 | } | 471 | 0 | std::cerr << "end errormessage\n"; | 472 | 0 | ret.implementations_agree = false; | 473 | 415 | } else { | 474 | 415 | ret.implementations_agree = true; | 475 | 415 | } | 476 | 415 | return ret; | 477 | 415 | } |
Conversion<(UtfEncodings)2, (UtfEncodings)4, unsigned long (simdutf::implementation::*)(char const*, unsigned long) noexcept const, simdutf::result (simdutf::implementation::*)(char const*, unsigned long, char*) noexcept const>::do_conversion(std::__1::span<char const, 18446744073709551615ul>, std::__1::vector<unsigned long, std::__1::allocator<unsigned long> > const&, bool) const Line | Count | Source | 382 | 258 | const bool inputisvalid) const { | 383 | 258 | conversion_result ret{}; | 384 | | | 385 | 258 | const auto implementations = get_supported_implementations(); | 386 | | | 387 | 258 | std::vector<result<ConversionResult>> results; | 388 | 258 | results.reserve(implementations.size()); | 389 | | | 390 | | // put the output in a separate allocation to make access violations easier | 391 | | // to catch | 392 | 258 | std::vector<std::vector<ToType>> outputbuffers; | 393 | 258 | outputbuffers.reserve(implementations.size()); | 394 | 1.03k | for (std::size_t i = 0; i < implementations.size(); ++i) { | 395 | 774 | auto impl = implementations[i]; | 396 | 774 | const ToType canary1{42}; | 397 | 774 | auto& outputbuffer = outputbuffers.emplace_back(outlength.at(i), canary1); | 398 | 774 | const auto implret1 = std::invoke(conversion, impl, src.data(), | 399 | 774 | src.size(), outputbuffer.data()); | 400 | | // was the conversion successful? | 401 | 774 | const auto success = [](const ConversionResult& r) -> bool { | 402 | 774 | if constexpr (std::is_same_v<ConversionResult, std::size_t>) { | 403 | 774 | return r != 0; | 404 | 774 | } else { | 405 | 774 | return r.error == simdutf::error_code::SUCCESS; | 406 | 774 | } | 407 | 774 | }(implret1); | 408 | 774 | const auto hash1 = FNV1A_hash::as_str(outputbuffer); | 409 | 774 | if constexpr (use_canary_in_output) { | 410 | | // optionally convert again, this time with the buffer filled with | 411 | | // a different value. if the output differs, it means some of the buffer | 412 | | // was not written to by the conversion function. | 413 | 774 | const ToType canary2{25}; | 414 | 774 | const auto outputbuffer_first_run = outputbuffer; | 415 | 774 | std::ranges::fill(outputbuffer, canary2); | 416 | 774 | const auto implret2 = std::invoke(conversion, impl, src.data(), | 417 | 774 | src.size(), outputbuffer.data()); | 418 | | | 419 | 774 | if (implret1 != implret2) { | 420 | 0 | std::cerr << "different return value the second time!\n"; | 421 | 0 | std::abort(); | 422 | 0 | } | 423 | 774 | if (inputisvalid && success) { | 424 | | // only care about the output if the input is valid | 425 | 345 | const auto hash2 = FNV1A_hash::as_str(outputbuffer); | 426 | 345 | if (hash1 != hash2) { | 427 | 0 | std::cerr << "different output the second time!\n"; | 428 | 0 | std::cerr << "implementation " << impl->name() << " " << name | 429 | 0 | << '\n'; | 430 | 0 | std::cerr << "input is valid=" << inputisvalid << '\n'; | 431 | 0 | std::cerr << "output length=" << outputbuffer.size() << '\n'; | 432 | 0 | std::cerr << "conversion was a success? " << success << '\n'; | 433 | 0 | for (std::size_t j = 0; j < outputbuffer.size(); ++j) { | 434 | 0 | std::cerr << "output[" << j << "]\t" << +outputbuffer_first_run[j] | 435 | 0 | << '\t' << +outputbuffer[j] << '\n'; | 436 | 0 | } | 437 | 0 | std::abort(); | 438 | 0 | } | 439 | 345 | } | 440 | 774 | } | 441 | 774 | results.emplace_back(implret1, success ? hash1 : ""); | 442 | 774 | } | 443 | | | 444 | | // do not require implementations to give the same output if | 445 | | // the input is not valid. | 446 | 258 | if (!inputisvalid) { | 447 | 405 | for (auto& e : results) { | 448 | 405 | e.outputhash.clear(); | 449 | 405 | } | 450 | 135 | } | 451 | | | 452 | 258 | auto neq = [](const auto& a, const auto& b) { return a != b; }; | 453 | 258 | if (std::ranges::adjacent_find(results, neq) != results.end()) { | 454 | 0 | std::cerr << "begin errormessage for do_conversion\n"; | 455 | 0 | std::cerr << "in fuzz case for " << name << " invoked with " << src.size() | 456 | 0 | << " elements:\n"; | 457 | 0 | std::cerr << "input data is valid ? " << inputisvalid << '\n'; | 458 | 0 | for (std::size_t i = 0; i < results.size(); ++i) { | 459 | 0 | std::cerr << "got return " << std::dec << results[i] | 460 | 0 | << " from implementation " << implementations[i]->name() | 461 | 0 | << " using outlen=" << outlength.at(i) << '\n'; | 462 | 0 | } | 463 | 0 | for (std::size_t i = 0; i < results.size(); ++i) { | 464 | 0 | std::cerr << "implementation " << implementations[i]->name() | 465 | 0 | << " out: "; | 466 | 0 | for (const auto e : outputbuffers.at(i)) { | 467 | 0 | std::cerr << +e << ", "; | 468 | 0 | } | 469 | 0 | std::cerr << '\n'; | 470 | 0 | } | 471 | 0 | std::cerr << "end errormessage\n"; | 472 | 0 | ret.implementations_agree = false; | 473 | 258 | } else { | 474 | 258 | ret.implementations_agree = true; | 475 | 258 | } | 476 | 258 | return ret; | 477 | 258 | } |
Conversion<(UtfEncodings)2, (UtfEncodings)0, unsigned long (simdutf::implementation::*)(char const*, unsigned long) noexcept const, simdutf::result (simdutf::implementation::*)(char const*, unsigned long, char16_t*) noexcept const>::do_conversion(std::__1::span<char const, 18446744073709551615ul>, std::__1::vector<unsigned long, std::__1::allocator<unsigned long> > const&, bool) const Line | Count | Source | 382 | 351 | const bool inputisvalid) const { | 383 | 351 | conversion_result ret{}; | 384 | | | 385 | 351 | const auto implementations = get_supported_implementations(); | 386 | | | 387 | 351 | std::vector<result<ConversionResult>> results; | 388 | 351 | results.reserve(implementations.size()); | 389 | | | 390 | | // put the output in a separate allocation to make access violations easier | 391 | | // to catch | 392 | 351 | std::vector<std::vector<ToType>> outputbuffers; | 393 | 351 | outputbuffers.reserve(implementations.size()); | 394 | 1.40k | for (std::size_t i = 0; i < implementations.size(); ++i) { | 395 | 1.05k | auto impl = implementations[i]; | 396 | 1.05k | const ToType canary1{42}; | 397 | 1.05k | auto& outputbuffer = outputbuffers.emplace_back(outlength.at(i), canary1); | 398 | 1.05k | const auto implret1 = std::invoke(conversion, impl, src.data(), | 399 | 1.05k | src.size(), outputbuffer.data()); | 400 | | // was the conversion successful? | 401 | 1.05k | const auto success = [](const ConversionResult& r) -> bool { | 402 | 1.05k | if constexpr (std::is_same_v<ConversionResult, std::size_t>) { | 403 | 1.05k | return r != 0; | 404 | 1.05k | } else { | 405 | 1.05k | return r.error == simdutf::error_code::SUCCESS; | 406 | 1.05k | } | 407 | 1.05k | }(implret1); | 408 | 1.05k | const auto hash1 = FNV1A_hash::as_str(outputbuffer); | 409 | 1.05k | if constexpr (use_canary_in_output) { | 410 | | // optionally convert again, this time with the buffer filled with | 411 | | // a different value. if the output differs, it means some of the buffer | 412 | | // was not written to by the conversion function. | 413 | 1.05k | const ToType canary2{25}; | 414 | 1.05k | const auto outputbuffer_first_run = outputbuffer; | 415 | 1.05k | std::ranges::fill(outputbuffer, canary2); | 416 | 1.05k | const auto implret2 = std::invoke(conversion, impl, src.data(), | 417 | 1.05k | src.size(), outputbuffer.data()); | 418 | | | 419 | 1.05k | if (implret1 != implret2) { | 420 | 0 | std::cerr << "different return value the second time!\n"; | 421 | 0 | std::abort(); | 422 | 0 | } | 423 | 1.05k | if (inputisvalid && success) { | 424 | | // only care about the output if the input is valid | 425 | 471 | const auto hash2 = FNV1A_hash::as_str(outputbuffer); | 426 | 471 | if (hash1 != hash2) { | 427 | 0 | std::cerr << "different output the second time!\n"; | 428 | 0 | std::cerr << "implementation " << impl->name() << " " << name | 429 | 0 | << '\n'; | 430 | 0 | std::cerr << "input is valid=" << inputisvalid << '\n'; | 431 | 0 | std::cerr << "output length=" << outputbuffer.size() << '\n'; | 432 | 0 | std::cerr << "conversion was a success? " << success << '\n'; | 433 | 0 | for (std::size_t j = 0; j < outputbuffer.size(); ++j) { | 434 | 0 | std::cerr << "output[" << j << "]\t" << +outputbuffer_first_run[j] | 435 | 0 | << '\t' << +outputbuffer[j] << '\n'; | 436 | 0 | } | 437 | 0 | std::abort(); | 438 | 0 | } | 439 | 471 | } | 440 | 1.05k | } | 441 | 1.05k | results.emplace_back(implret1, success ? hash1 : ""); | 442 | 1.05k | } | 443 | | | 444 | | // do not require implementations to give the same output if | 445 | | // the input is not valid. | 446 | 351 | if (!inputisvalid) { | 447 | 582 | for (auto& e : results) { | 448 | 582 | e.outputhash.clear(); | 449 | 582 | } | 450 | 194 | } | 451 | | | 452 | 351 | auto neq = [](const auto& a, const auto& b) { return a != b; }; | 453 | 351 | if (std::ranges::adjacent_find(results, neq) != results.end()) { | 454 | 0 | std::cerr << "begin errormessage for do_conversion\n"; | 455 | 0 | std::cerr << "in fuzz case for " << name << " invoked with " << src.size() | 456 | 0 | << " elements:\n"; | 457 | 0 | std::cerr << "input data is valid ? " << inputisvalid << '\n'; | 458 | 0 | for (std::size_t i = 0; i < results.size(); ++i) { | 459 | 0 | std::cerr << "got return " << std::dec << results[i] | 460 | 0 | << " from implementation " << implementations[i]->name() | 461 | 0 | << " using outlen=" << outlength.at(i) << '\n'; | 462 | 0 | } | 463 | 0 | for (std::size_t i = 0; i < results.size(); ++i) { | 464 | 0 | std::cerr << "implementation " << implementations[i]->name() | 465 | 0 | << " out: "; | 466 | 0 | for (const auto e : outputbuffers.at(i)) { | 467 | 0 | std::cerr << +e << ", "; | 468 | 0 | } | 469 | 0 | std::cerr << '\n'; | 470 | 0 | } | 471 | 0 | std::cerr << "end errormessage\n"; | 472 | 0 | ret.implementations_agree = false; | 473 | 351 | } else { | 474 | 351 | ret.implementations_agree = true; | 475 | 351 | } | 476 | 351 | return ret; | 477 | 351 | } |
Conversion<(UtfEncodings)2, (UtfEncodings)1, unsigned long (simdutf::implementation::*)(char const*, unsigned long) noexcept const, simdutf::result (simdutf::implementation::*)(char const*, unsigned long, char16_t*) noexcept const>::do_conversion(std::__1::span<char const, 18446744073709551615ul>, std::__1::vector<unsigned long, std::__1::allocator<unsigned long> > const&, bool) const Line | Count | Source | 382 | 287 | const bool inputisvalid) const { | 383 | 287 | conversion_result ret{}; | 384 | | | 385 | 287 | const auto implementations = get_supported_implementations(); | 386 | | | 387 | 287 | std::vector<result<ConversionResult>> results; | 388 | 287 | results.reserve(implementations.size()); | 389 | | | 390 | | // put the output in a separate allocation to make access violations easier | 391 | | // to catch | 392 | 287 | std::vector<std::vector<ToType>> outputbuffers; | 393 | 287 | outputbuffers.reserve(implementations.size()); | 394 | 1.14k | for (std::size_t i = 0; i < implementations.size(); ++i) { | 395 | 861 | auto impl = implementations[i]; | 396 | 861 | const ToType canary1{42}; | 397 | 861 | auto& outputbuffer = outputbuffers.emplace_back(outlength.at(i), canary1); | 398 | 861 | const auto implret1 = std::invoke(conversion, impl, src.data(), | 399 | 861 | src.size(), outputbuffer.data()); | 400 | | // was the conversion successful? | 401 | 861 | const auto success = [](const ConversionResult& r) -> bool { | 402 | 861 | if constexpr (std::is_same_v<ConversionResult, std::size_t>) { | 403 | 861 | return r != 0; | 404 | 861 | } else { | 405 | 861 | return r.error == simdutf::error_code::SUCCESS; | 406 | 861 | } | 407 | 861 | }(implret1); | 408 | 861 | const auto hash1 = FNV1A_hash::as_str(outputbuffer); | 409 | 861 | if constexpr (use_canary_in_output) { | 410 | | // optionally convert again, this time with the buffer filled with | 411 | | // a different value. if the output differs, it means some of the buffer | 412 | | // was not written to by the conversion function. | 413 | 861 | const ToType canary2{25}; | 414 | 861 | const auto outputbuffer_first_run = outputbuffer; | 415 | 861 | std::ranges::fill(outputbuffer, canary2); | 416 | 861 | const auto implret2 = std::invoke(conversion, impl, src.data(), | 417 | 861 | src.size(), outputbuffer.data()); | 418 | | | 419 | 861 | if (implret1 != implret2) { | 420 | 0 | std::cerr << "different return value the second time!\n"; | 421 | 0 | std::abort(); | 422 | 0 | } | 423 | 861 | if (inputisvalid && success) { | 424 | | // only care about the output if the input is valid | 425 | 369 | const auto hash2 = FNV1A_hash::as_str(outputbuffer); | 426 | 369 | if (hash1 != hash2) { | 427 | 0 | std::cerr << "different output the second time!\n"; | 428 | 0 | std::cerr << "implementation " << impl->name() << " " << name | 429 | 0 | << '\n'; | 430 | 0 | std::cerr << "input is valid=" << inputisvalid << '\n'; | 431 | 0 | std::cerr << "output length=" << outputbuffer.size() << '\n'; | 432 | 0 | std::cerr << "conversion was a success? " << success << '\n'; | 433 | 0 | for (std::size_t j = 0; j < outputbuffer.size(); ++j) { | 434 | 0 | std::cerr << "output[" << j << "]\t" << +outputbuffer_first_run[j] | 435 | 0 | << '\t' << +outputbuffer[j] << '\n'; | 436 | 0 | } | 437 | 0 | std::abort(); | 438 | 0 | } | 439 | 369 | } | 440 | 861 | } | 441 | 861 | results.emplace_back(implret1, success ? hash1 : ""); | 442 | 861 | } | 443 | | | 444 | | // do not require implementations to give the same output if | 445 | | // the input is not valid. | 446 | 287 | if (!inputisvalid) { | 447 | 492 | for (auto& e : results) { | 448 | 492 | e.outputhash.clear(); | 449 | 492 | } | 450 | 164 | } | 451 | | | 452 | 287 | auto neq = [](const auto& a, const auto& b) { return a != b; }; | 453 | 287 | if (std::ranges::adjacent_find(results, neq) != results.end()) { | 454 | 0 | std::cerr << "begin errormessage for do_conversion\n"; | 455 | 0 | std::cerr << "in fuzz case for " << name << " invoked with " << src.size() | 456 | 0 | << " elements:\n"; | 457 | 0 | std::cerr << "input data is valid ? " << inputisvalid << '\n'; | 458 | 0 | for (std::size_t i = 0; i < results.size(); ++i) { | 459 | 0 | std::cerr << "got return " << std::dec << results[i] | 460 | 0 | << " from implementation " << implementations[i]->name() | 461 | 0 | << " using outlen=" << outlength.at(i) << '\n'; | 462 | 0 | } | 463 | 0 | for (std::size_t i = 0; i < results.size(); ++i) { | 464 | 0 | std::cerr << "implementation " << implementations[i]->name() | 465 | 0 | << " out: "; | 466 | 0 | for (const auto e : outputbuffers.at(i)) { | 467 | 0 | std::cerr << +e << ", "; | 468 | 0 | } | 469 | 0 | std::cerr << '\n'; | 470 | 0 | } | 471 | 0 | std::cerr << "end errormessage\n"; | 472 | 0 | ret.implementations_agree = false; | 473 | 287 | } else { | 474 | 287 | ret.implementations_agree = true; | 475 | 287 | } | 476 | 287 | return ret; | 477 | 287 | } |
Conversion<(UtfEncodings)2, (UtfEncodings)3, unsigned long (simdutf::implementation::*)(char const*, unsigned long) noexcept const, simdutf::result (simdutf::implementation::*)(char const*, unsigned long, char32_t*) noexcept const>::do_conversion(std::__1::span<char const, 18446744073709551615ul>, std::__1::vector<unsigned long, std::__1::allocator<unsigned long> > const&, bool) const Line | Count | Source | 382 | 369 | const bool inputisvalid) const { | 383 | 369 | conversion_result ret{}; | 384 | | | 385 | 369 | const auto implementations = get_supported_implementations(); | 386 | | | 387 | 369 | std::vector<result<ConversionResult>> results; | 388 | 369 | results.reserve(implementations.size()); | 389 | | | 390 | | // put the output in a separate allocation to make access violations easier | 391 | | // to catch | 392 | 369 | std::vector<std::vector<ToType>> outputbuffers; | 393 | 369 | outputbuffers.reserve(implementations.size()); | 394 | 1.47k | for (std::size_t i = 0; i < implementations.size(); ++i) { | 395 | 1.10k | auto impl = implementations[i]; | 396 | 1.10k | const ToType canary1{42}; | 397 | 1.10k | auto& outputbuffer = outputbuffers.emplace_back(outlength.at(i), canary1); | 398 | 1.10k | const auto implret1 = std::invoke(conversion, impl, src.data(), | 399 | 1.10k | src.size(), outputbuffer.data()); | 400 | | // was the conversion successful? | 401 | 1.10k | const auto success = [](const ConversionResult& r) -> bool { | 402 | 1.10k | if constexpr (std::is_same_v<ConversionResult, std::size_t>) { | 403 | 1.10k | return r != 0; | 404 | 1.10k | } else { | 405 | 1.10k | return r.error == simdutf::error_code::SUCCESS; | 406 | 1.10k | } | 407 | 1.10k | }(implret1); | 408 | 1.10k | const auto hash1 = FNV1A_hash::as_str(outputbuffer); | 409 | 1.10k | if constexpr (use_canary_in_output) { | 410 | | // optionally convert again, this time with the buffer filled with | 411 | | // a different value. if the output differs, it means some of the buffer | 412 | | // was not written to by the conversion function. | 413 | 1.10k | const ToType canary2{25}; | 414 | 1.10k | const auto outputbuffer_first_run = outputbuffer; | 415 | 1.10k | std::ranges::fill(outputbuffer, canary2); | 416 | 1.10k | const auto implret2 = std::invoke(conversion, impl, src.data(), | 417 | 1.10k | src.size(), outputbuffer.data()); | 418 | | | 419 | 1.10k | if (implret1 != implret2) { | 420 | 0 | std::cerr << "different return value the second time!\n"; | 421 | 0 | std::abort(); | 422 | 0 | } | 423 | 1.10k | if (inputisvalid && success) { | 424 | | // only care about the output if the input is valid | 425 | 510 | const auto hash2 = FNV1A_hash::as_str(outputbuffer); | 426 | 510 | if (hash1 != hash2) { | 427 | 0 | std::cerr << "different output the second time!\n"; | 428 | 0 | std::cerr << "implementation " << impl->name() << " " << name | 429 | 0 | << '\n'; | 430 | 0 | std::cerr << "input is valid=" << inputisvalid << '\n'; | 431 | 0 | std::cerr << "output length=" << outputbuffer.size() << '\n'; | 432 | 0 | std::cerr << "conversion was a success? " << success << '\n'; | 433 | 0 | for (std::size_t j = 0; j < outputbuffer.size(); ++j) { | 434 | 0 | std::cerr << "output[" << j << "]\t" << +outputbuffer_first_run[j] | 435 | 0 | << '\t' << +outputbuffer[j] << '\n'; | 436 | 0 | } | 437 | 0 | std::abort(); | 438 | 0 | } | 439 | 510 | } | 440 | 1.10k | } | 441 | 1.10k | results.emplace_back(implret1, success ? hash1 : ""); | 442 | 1.10k | } | 443 | | | 444 | | // do not require implementations to give the same output if | 445 | | // the input is not valid. | 446 | 369 | if (!inputisvalid) { | 447 | 597 | for (auto& e : results) { | 448 | 597 | e.outputhash.clear(); | 449 | 597 | } | 450 | 199 | } | 451 | | | 452 | 369 | auto neq = [](const auto& a, const auto& b) { return a != b; }; | 453 | 369 | if (std::ranges::adjacent_find(results, neq) != results.end()) { | 454 | 0 | std::cerr << "begin errormessage for do_conversion\n"; | 455 | 0 | std::cerr << "in fuzz case for " << name << " invoked with " << src.size() | 456 | 0 | << " elements:\n"; | 457 | 0 | std::cerr << "input data is valid ? " << inputisvalid << '\n'; | 458 | 0 | for (std::size_t i = 0; i < results.size(); ++i) { | 459 | 0 | std::cerr << "got return " << std::dec << results[i] | 460 | 0 | << " from implementation " << implementations[i]->name() | 461 | 0 | << " using outlen=" << outlength.at(i) << '\n'; | 462 | 0 | } | 463 | 0 | for (std::size_t i = 0; i < results.size(); ++i) { | 464 | 0 | std::cerr << "implementation " << implementations[i]->name() | 465 | 0 | << " out: "; | 466 | 0 | for (const auto e : outputbuffers.at(i)) { | 467 | 0 | std::cerr << +e << ", "; | 468 | 0 | } | 469 | 0 | std::cerr << '\n'; | 470 | 0 | } | 471 | 0 | std::cerr << "end errormessage\n"; | 472 | 0 | ret.implementations_agree = false; | 473 | 369 | } else { | 474 | 369 | ret.implementations_agree = true; | 475 | 369 | } | 476 | 369 | return ret; | 477 | 369 | } |
Conversion<(UtfEncodings)4, (UtfEncodings)3, unsigned long (simdutf::implementation::*)(unsigned long) noexcept const, unsigned long (simdutf::implementation::*)(char const*, unsigned long, char32_t*) noexcept const>::do_conversion(std::__1::span<char const, 18446744073709551615ul>, std::__1::vector<unsigned long, std::__1::allocator<unsigned long> > const&, bool) const Line | Count | Source | 382 | 45 | const bool inputisvalid) const { | 383 | 45 | conversion_result ret{}; | 384 | | | 385 | 45 | const auto implementations = get_supported_implementations(); | 386 | | | 387 | 45 | std::vector<result<ConversionResult>> results; | 388 | 45 | results.reserve(implementations.size()); | 389 | | | 390 | | // put the output in a separate allocation to make access violations easier | 391 | | // to catch | 392 | 45 | std::vector<std::vector<ToType>> outputbuffers; | 393 | 45 | outputbuffers.reserve(implementations.size()); | 394 | 180 | for (std::size_t i = 0; i < implementations.size(); ++i) { | 395 | 135 | auto impl = implementations[i]; | 396 | 135 | const ToType canary1{42}; | 397 | 135 | auto& outputbuffer = outputbuffers.emplace_back(outlength.at(i), canary1); | 398 | 135 | const auto implret1 = std::invoke(conversion, impl, src.data(), | 399 | 135 | src.size(), outputbuffer.data()); | 400 | | // was the conversion successful? | 401 | 135 | const auto success = [](const ConversionResult& r) -> bool { | 402 | 135 | if constexpr (std::is_same_v<ConversionResult, std::size_t>) { | 403 | 135 | return r != 0; | 404 | 135 | } else { | 405 | 135 | return r.error == simdutf::error_code::SUCCESS; | 406 | 135 | } | 407 | 135 | }(implret1); | 408 | 135 | const auto hash1 = FNV1A_hash::as_str(outputbuffer); | 409 | 135 | if constexpr (use_canary_in_output) { | 410 | | // optionally convert again, this time with the buffer filled with | 411 | | // a different value. if the output differs, it means some of the buffer | 412 | | // was not written to by the conversion function. | 413 | 135 | const ToType canary2{25}; | 414 | 135 | const auto outputbuffer_first_run = outputbuffer; | 415 | 135 | std::ranges::fill(outputbuffer, canary2); | 416 | 135 | const auto implret2 = std::invoke(conversion, impl, src.data(), | 417 | 135 | src.size(), outputbuffer.data()); | 418 | | | 419 | 135 | if (implret1 != implret2) { | 420 | 0 | std::cerr << "different return value the second time!\n"; | 421 | 0 | std::abort(); | 422 | 0 | } | 423 | 135 | if (inputisvalid && success) { | 424 | | // only care about the output if the input is valid | 425 | 129 | const auto hash2 = FNV1A_hash::as_str(outputbuffer); | 426 | 129 | if (hash1 != hash2) { | 427 | 0 | std::cerr << "different output the second time!\n"; | 428 | 0 | std::cerr << "implementation " << impl->name() << " " << name | 429 | 0 | << '\n'; | 430 | 0 | std::cerr << "input is valid=" << inputisvalid << '\n'; | 431 | 0 | std::cerr << "output length=" << outputbuffer.size() << '\n'; | 432 | 0 | std::cerr << "conversion was a success? " << success << '\n'; | 433 | 0 | for (std::size_t j = 0; j < outputbuffer.size(); ++j) { | 434 | 0 | std::cerr << "output[" << j << "]\t" << +outputbuffer_first_run[j] | 435 | 0 | << '\t' << +outputbuffer[j] << '\n'; | 436 | 0 | } | 437 | 0 | std::abort(); | 438 | 0 | } | 439 | 129 | } | 440 | 135 | } | 441 | 135 | results.emplace_back(implret1, success ? hash1 : ""); | 442 | 135 | } | 443 | | | 444 | | // do not require implementations to give the same output if | 445 | | // the input is not valid. | 446 | 45 | if (!inputisvalid) { | 447 | 0 | for (auto& e : results) { | 448 | 0 | e.outputhash.clear(); | 449 | 0 | } | 450 | 0 | } | 451 | | | 452 | 45 | auto neq = [](const auto& a, const auto& b) { return a != b; }; | 453 | 45 | if (std::ranges::adjacent_find(results, neq) != results.end()) { | 454 | 0 | std::cerr << "begin errormessage for do_conversion\n"; | 455 | 0 | std::cerr << "in fuzz case for " << name << " invoked with " << src.size() | 456 | 0 | << " elements:\n"; | 457 | 0 | std::cerr << "input data is valid ? " << inputisvalid << '\n'; | 458 | 0 | for (std::size_t i = 0; i < results.size(); ++i) { | 459 | 0 | std::cerr << "got return " << std::dec << results[i] | 460 | 0 | << " from implementation " << implementations[i]->name() | 461 | 0 | << " using outlen=" << outlength.at(i) << '\n'; | 462 | 0 | } | 463 | 0 | for (std::size_t i = 0; i < results.size(); ++i) { | 464 | 0 | std::cerr << "implementation " << implementations[i]->name() | 465 | 0 | << " out: "; | 466 | 0 | for (const auto e : outputbuffers.at(i)) { | 467 | 0 | std::cerr << +e << ", "; | 468 | 0 | } | 469 | 0 | std::cerr << '\n'; | 470 | 0 | } | 471 | 0 | std::cerr << "end errormessage\n"; | 472 | 0 | ret.implementations_agree = false; | 473 | 45 | } else { | 474 | 45 | ret.implementations_agree = true; | 475 | 45 | } | 476 | 45 | return ret; | 477 | 45 | } |
Conversion<(UtfEncodings)4, (UtfEncodings)0, unsigned long (simdutf::implementation::*)(unsigned long) noexcept const, unsigned long (simdutf::implementation::*)(char const*, unsigned long, char16_t*) noexcept const>::do_conversion(std::__1::span<char const, 18446744073709551615ul>, std::__1::vector<unsigned long, std::__1::allocator<unsigned long> > const&, bool) const Line | Count | Source | 382 | 40 | const bool inputisvalid) const { | 383 | 40 | conversion_result ret{}; | 384 | | | 385 | 40 | const auto implementations = get_supported_implementations(); | 386 | | | 387 | 40 | std::vector<result<ConversionResult>> results; | 388 | 40 | results.reserve(implementations.size()); | 389 | | | 390 | | // put the output in a separate allocation to make access violations easier | 391 | | // to catch | 392 | 40 | std::vector<std::vector<ToType>> outputbuffers; | 393 | 40 | outputbuffers.reserve(implementations.size()); | 394 | 160 | for (std::size_t i = 0; i < implementations.size(); ++i) { | 395 | 120 | auto impl = implementations[i]; | 396 | 120 | const ToType canary1{42}; | 397 | 120 | auto& outputbuffer = outputbuffers.emplace_back(outlength.at(i), canary1); | 398 | 120 | const auto implret1 = std::invoke(conversion, impl, src.data(), | 399 | 120 | src.size(), outputbuffer.data()); | 400 | | // was the conversion successful? | 401 | 120 | const auto success = [](const ConversionResult& r) -> bool { | 402 | 120 | if constexpr (std::is_same_v<ConversionResult, std::size_t>) { | 403 | 120 | return r != 0; | 404 | 120 | } else { | 405 | 120 | return r.error == simdutf::error_code::SUCCESS; | 406 | 120 | } | 407 | 120 | }(implret1); | 408 | 120 | const auto hash1 = FNV1A_hash::as_str(outputbuffer); | 409 | 120 | if constexpr (use_canary_in_output) { | 410 | | // optionally convert again, this time with the buffer filled with | 411 | | // a different value. if the output differs, it means some of the buffer | 412 | | // was not written to by the conversion function. | 413 | 120 | const ToType canary2{25}; | 414 | 120 | const auto outputbuffer_first_run = outputbuffer; | 415 | 120 | std::ranges::fill(outputbuffer, canary2); | 416 | 120 | const auto implret2 = std::invoke(conversion, impl, src.data(), | 417 | 120 | src.size(), outputbuffer.data()); | 418 | | | 419 | 120 | if (implret1 != implret2) { | 420 | 0 | std::cerr << "different return value the second time!\n"; | 421 | 0 | std::abort(); | 422 | 0 | } | 423 | 120 | if (inputisvalid && success) { | 424 | | // only care about the output if the input is valid | 425 | 114 | const auto hash2 = FNV1A_hash::as_str(outputbuffer); | 426 | 114 | if (hash1 != hash2) { | 427 | 0 | std::cerr << "different output the second time!\n"; | 428 | 0 | std::cerr << "implementation " << impl->name() << " " << name | 429 | 0 | << '\n'; | 430 | 0 | std::cerr << "input is valid=" << inputisvalid << '\n'; | 431 | 0 | std::cerr << "output length=" << outputbuffer.size() << '\n'; | 432 | 0 | std::cerr << "conversion was a success? " << success << '\n'; | 433 | 0 | for (std::size_t j = 0; j < outputbuffer.size(); ++j) { | 434 | 0 | std::cerr << "output[" << j << "]\t" << +outputbuffer_first_run[j] | 435 | 0 | << '\t' << +outputbuffer[j] << '\n'; | 436 | 0 | } | 437 | 0 | std::abort(); | 438 | 0 | } | 439 | 114 | } | 440 | 120 | } | 441 | 120 | results.emplace_back(implret1, success ? hash1 : ""); | 442 | 120 | } | 443 | | | 444 | | // do not require implementations to give the same output if | 445 | | // the input is not valid. | 446 | 40 | if (!inputisvalid) { | 447 | 0 | for (auto& e : results) { | 448 | 0 | e.outputhash.clear(); | 449 | 0 | } | 450 | 0 | } | 451 | | | 452 | 40 | auto neq = [](const auto& a, const auto& b) { return a != b; }; | 453 | 40 | if (std::ranges::adjacent_find(results, neq) != results.end()) { | 454 | 0 | std::cerr << "begin errormessage for do_conversion\n"; | 455 | 0 | std::cerr << "in fuzz case for " << name << " invoked with " << src.size() | 456 | 0 | << " elements:\n"; | 457 | 0 | std::cerr << "input data is valid ? " << inputisvalid << '\n'; | 458 | 0 | for (std::size_t i = 0; i < results.size(); ++i) { | 459 | 0 | std::cerr << "got return " << std::dec << results[i] | 460 | 0 | << " from implementation " << implementations[i]->name() | 461 | 0 | << " using outlen=" << outlength.at(i) << '\n'; | 462 | 0 | } | 463 | 0 | for (std::size_t i = 0; i < results.size(); ++i) { | 464 | 0 | std::cerr << "implementation " << implementations[i]->name() | 465 | 0 | << " out: "; | 466 | 0 | for (const auto e : outputbuffers.at(i)) { | 467 | 0 | std::cerr << +e << ", "; | 468 | 0 | } | 469 | 0 | std::cerr << '\n'; | 470 | 0 | } | 471 | 0 | std::cerr << "end errormessage\n"; | 472 | 0 | ret.implementations_agree = false; | 473 | 40 | } else { | 474 | 40 | ret.implementations_agree = true; | 475 | 40 | } | 476 | 40 | return ret; | 477 | 40 | } |
Conversion<(UtfEncodings)4, (UtfEncodings)1, unsigned long (simdutf::implementation::*)(unsigned long) noexcept const, unsigned long (simdutf::implementation::*)(char const*, unsigned long, char16_t*) noexcept const>::do_conversion(std::__1::span<char const, 18446744073709551615ul>, std::__1::vector<unsigned long, std::__1::allocator<unsigned long> > const&, bool) const Line | Count | Source | 382 | 40 | const bool inputisvalid) const { | 383 | 40 | conversion_result ret{}; | 384 | | | 385 | 40 | const auto implementations = get_supported_implementations(); | 386 | | | 387 | 40 | std::vector<result<ConversionResult>> results; | 388 | 40 | results.reserve(implementations.size()); | 389 | | | 390 | | // put the output in a separate allocation to make access violations easier | 391 | | // to catch | 392 | 40 | std::vector<std::vector<ToType>> outputbuffers; | 393 | 40 | outputbuffers.reserve(implementations.size()); | 394 | 160 | for (std::size_t i = 0; i < implementations.size(); ++i) { | 395 | 120 | auto impl = implementations[i]; | 396 | 120 | const ToType canary1{42}; | 397 | 120 | auto& outputbuffer = outputbuffers.emplace_back(outlength.at(i), canary1); | 398 | 120 | const auto implret1 = std::invoke(conversion, impl, src.data(), | 399 | 120 | src.size(), outputbuffer.data()); | 400 | | // was the conversion successful? | 401 | 120 | const auto success = [](const ConversionResult& r) -> bool { | 402 | 120 | if constexpr (std::is_same_v<ConversionResult, std::size_t>) { | 403 | 120 | return r != 0; | 404 | 120 | } else { | 405 | 120 | return r.error == simdutf::error_code::SUCCESS; | 406 | 120 | } | 407 | 120 | }(implret1); | 408 | 120 | const auto hash1 = FNV1A_hash::as_str(outputbuffer); | 409 | 120 | if constexpr (use_canary_in_output) { | 410 | | // optionally convert again, this time with the buffer filled with | 411 | | // a different value. if the output differs, it means some of the buffer | 412 | | // was not written to by the conversion function. | 413 | 120 | const ToType canary2{25}; | 414 | 120 | const auto outputbuffer_first_run = outputbuffer; | 415 | 120 | std::ranges::fill(outputbuffer, canary2); | 416 | 120 | const auto implret2 = std::invoke(conversion, impl, src.data(), | 417 | 120 | src.size(), outputbuffer.data()); | 418 | | | 419 | 120 | if (implret1 != implret2) { | 420 | 0 | std::cerr << "different return value the second time!\n"; | 421 | 0 | std::abort(); | 422 | 0 | } | 423 | 120 | if (inputisvalid && success) { | 424 | | // only care about the output if the input is valid | 425 | 114 | const auto hash2 = FNV1A_hash::as_str(outputbuffer); | 426 | 114 | if (hash1 != hash2) { | 427 | 0 | std::cerr << "different output the second time!\n"; | 428 | 0 | std::cerr << "implementation " << impl->name() << " " << name | 429 | 0 | << '\n'; | 430 | 0 | std::cerr << "input is valid=" << inputisvalid << '\n'; | 431 | 0 | std::cerr << "output length=" << outputbuffer.size() << '\n'; | 432 | 0 | std::cerr << "conversion was a success? " << success << '\n'; | 433 | 0 | for (std::size_t j = 0; j < outputbuffer.size(); ++j) { | 434 | 0 | std::cerr << "output[" << j << "]\t" << +outputbuffer_first_run[j] | 435 | 0 | << '\t' << +outputbuffer[j] << '\n'; | 436 | 0 | } | 437 | 0 | std::abort(); | 438 | 0 | } | 439 | 114 | } | 440 | 120 | } | 441 | 120 | results.emplace_back(implret1, success ? hash1 : ""); | 442 | 120 | } | 443 | | | 444 | | // do not require implementations to give the same output if | 445 | | // the input is not valid. | 446 | 40 | if (!inputisvalid) { | 447 | 0 | for (auto& e : results) { | 448 | 0 | e.outputhash.clear(); | 449 | 0 | } | 450 | 0 | } | 451 | | | 452 | 40 | auto neq = [](const auto& a, const auto& b) { return a != b; }; | 453 | 40 | if (std::ranges::adjacent_find(results, neq) != results.end()) { | 454 | 0 | std::cerr << "begin errormessage for do_conversion\n"; | 455 | 0 | std::cerr << "in fuzz case for " << name << " invoked with " << src.size() | 456 | 0 | << " elements:\n"; | 457 | 0 | std::cerr << "input data is valid ? " << inputisvalid << '\n'; | 458 | 0 | for (std::size_t i = 0; i < results.size(); ++i) { | 459 | 0 | std::cerr << "got return " << std::dec << results[i] | 460 | 0 | << " from implementation " << implementations[i]->name() | 461 | 0 | << " using outlen=" << outlength.at(i) << '\n'; | 462 | 0 | } | 463 | 0 | for (std::size_t i = 0; i < results.size(); ++i) { | 464 | 0 | std::cerr << "implementation " << implementations[i]->name() | 465 | 0 | << " out: "; | 466 | 0 | for (const auto e : outputbuffers.at(i)) { | 467 | 0 | std::cerr << +e << ", "; | 468 | 0 | } | 469 | 0 | std::cerr << '\n'; | 470 | 0 | } | 471 | 0 | std::cerr << "end errormessage\n"; | 472 | 0 | ret.implementations_agree = false; | 473 | 40 | } else { | 474 | 40 | ret.implementations_agree = true; | 475 | 40 | } | 476 | 40 | return ret; | 477 | 40 | } |
Conversion<(UtfEncodings)4, (UtfEncodings)2, unsigned long (simdutf::implementation::*)(char const*, unsigned long) noexcept const, unsigned long (simdutf::implementation::*)(char const*, unsigned long, char*) noexcept const>::do_conversion(std::__1::span<char const, 18446744073709551615ul>, std::__1::vector<unsigned long, std::__1::allocator<unsigned long> > const&, bool) const Line | Count | Source | 382 | 269 | const bool inputisvalid) const { | 383 | 269 | conversion_result ret{}; | 384 | | | 385 | 269 | const auto implementations = get_supported_implementations(); | 386 | | | 387 | 269 | std::vector<result<ConversionResult>> results; | 388 | 269 | results.reserve(implementations.size()); | 389 | | | 390 | | // put the output in a separate allocation to make access violations easier | 391 | | // to catch | 392 | 269 | std::vector<std::vector<ToType>> outputbuffers; | 393 | 269 | outputbuffers.reserve(implementations.size()); | 394 | 1.07k | for (std::size_t i = 0; i < implementations.size(); ++i) { | 395 | 807 | auto impl = implementations[i]; | 396 | 807 | const ToType canary1{42}; | 397 | 807 | auto& outputbuffer = outputbuffers.emplace_back(outlength.at(i), canary1); | 398 | 807 | const auto implret1 = std::invoke(conversion, impl, src.data(), | 399 | 807 | src.size(), outputbuffer.data()); | 400 | | // was the conversion successful? | 401 | 807 | const auto success = [](const ConversionResult& r) -> bool { | 402 | 807 | if constexpr (std::is_same_v<ConversionResult, std::size_t>) { | 403 | 807 | return r != 0; | 404 | 807 | } else { | 405 | 807 | return r.error == simdutf::error_code::SUCCESS; | 406 | 807 | } | 407 | 807 | }(implret1); | 408 | 807 | const auto hash1 = FNV1A_hash::as_str(outputbuffer); | 409 | 807 | if constexpr (use_canary_in_output) { | 410 | | // optionally convert again, this time with the buffer filled with | 411 | | // a different value. if the output differs, it means some of the buffer | 412 | | // was not written to by the conversion function. | 413 | 807 | const ToType canary2{25}; | 414 | 807 | const auto outputbuffer_first_run = outputbuffer; | 415 | 807 | std::ranges::fill(outputbuffer, canary2); | 416 | 807 | const auto implret2 = std::invoke(conversion, impl, src.data(), | 417 | 807 | src.size(), outputbuffer.data()); | 418 | | | 419 | 807 | if (implret1 != implret2) { | 420 | 0 | std::cerr << "different return value the second time!\n"; | 421 | 0 | std::abort(); | 422 | 0 | } | 423 | 807 | if (inputisvalid && success) { | 424 | | // only care about the output if the input is valid | 425 | 801 | const auto hash2 = FNV1A_hash::as_str(outputbuffer); | 426 | 801 | if (hash1 != hash2) { | 427 | 0 | std::cerr << "different output the second time!\n"; | 428 | 0 | std::cerr << "implementation " << impl->name() << " " << name | 429 | 0 | << '\n'; | 430 | 0 | std::cerr << "input is valid=" << inputisvalid << '\n'; | 431 | 0 | std::cerr << "output length=" << outputbuffer.size() << '\n'; | 432 | 0 | std::cerr << "conversion was a success? " << success << '\n'; | 433 | 0 | for (std::size_t j = 0; j < outputbuffer.size(); ++j) { | 434 | 0 | std::cerr << "output[" << j << "]\t" << +outputbuffer_first_run[j] | 435 | 0 | << '\t' << +outputbuffer[j] << '\n'; | 436 | 0 | } | 437 | 0 | std::abort(); | 438 | 0 | } | 439 | 801 | } | 440 | 807 | } | 441 | 807 | results.emplace_back(implret1, success ? hash1 : ""); | 442 | 807 | } | 443 | | | 444 | | // do not require implementations to give the same output if | 445 | | // the input is not valid. | 446 | 269 | if (!inputisvalid) { | 447 | 0 | for (auto& e : results) { | 448 | 0 | e.outputhash.clear(); | 449 | 0 | } | 450 | 0 | } | 451 | | | 452 | 269 | auto neq = [](const auto& a, const auto& b) { return a != b; }; | 453 | 269 | if (std::ranges::adjacent_find(results, neq) != results.end()) { | 454 | 0 | std::cerr << "begin errormessage for do_conversion\n"; | 455 | 0 | std::cerr << "in fuzz case for " << name << " invoked with " << src.size() | 456 | 0 | << " elements:\n"; | 457 | 0 | std::cerr << "input data is valid ? " << inputisvalid << '\n'; | 458 | 0 | for (std::size_t i = 0; i < results.size(); ++i) { | 459 | 0 | std::cerr << "got return " << std::dec << results[i] | 460 | 0 | << " from implementation " << implementations[i]->name() | 461 | 0 | << " using outlen=" << outlength.at(i) << '\n'; | 462 | 0 | } | 463 | 0 | for (std::size_t i = 0; i < results.size(); ++i) { | 464 | 0 | std::cerr << "implementation " << implementations[i]->name() | 465 | 0 | << " out: "; | 466 | 0 | for (const auto e : outputbuffers.at(i)) { | 467 | 0 | std::cerr << +e << ", "; | 468 | 0 | } | 469 | 0 | std::cerr << '\n'; | 470 | 0 | } | 471 | 0 | std::cerr << "end errormessage\n"; | 472 | 0 | ret.implementations_agree = false; | 473 | 269 | } else { | 474 | 269 | ret.implementations_agree = true; | 475 | 269 | } | 476 | 269 | return ret; | 477 | 269 | } |
|
478 | | |
479 | 0 | void dump_testcase(FromSpan typedspan, std::ostream& os) const { |
480 | 0 | const auto testhash = FNV1A_hash::as_str(name, typedspan); |
481 | |
|
482 | 0 | os << "// begin testcase\n"; |
483 | 0 | os << "TEST(issue_" << name << "_" << testhash << ") {\n"; |
484 | 0 | os << " alignas(" << sizeof(FromType) << ") const unsigned char data[]={"; |
485 | 0 | const auto first = reinterpret_cast<const unsigned char*>(typedspan.data()); |
486 | 0 | const auto last = first + typedspan.size_bytes(); |
487 | 0 | for (auto it = first; it != last; ++it) { |
488 | 0 | os << "0x" << std::hex << std::setfill('0') << std::setw(2) << (+*it) |
489 | 0 | << (it + 1 == last ? "};\n" : ", "); |
490 | 0 | } |
491 | 0 | os << " constexpr std::size_t data_len_bytes=sizeof(data);\n"; |
492 | 0 | os << " constexpr std::size_t data_len=data_len_bytes/sizeof(" |
493 | 0 | << nameoftype(FromType{}) << ");\n"; |
494 | 0 | if constexpr (From != UtfEncodings::LATIN1) { |
495 | 0 | os << "const auto validation1=implementation." |
496 | 0 | << ValidationFunctionTrait<From>::ValidationWithErrorsName |
497 | 0 | << "((const " << nameoftype(FromType{}) << "*) data,\n data_len);\n"; |
498 | 0 | os << " ASSERT_EQUAL(validation1.count, 1234);\n"; |
499 | 0 | os << " ASSERT_EQUAL(validation1.error, " |
500 | 0 | "simdutf::error_code::SUCCESS);\n"; |
501 | 0 | os << '\n'; |
502 | 0 | os << "const bool validation2=implementation." |
503 | 0 | << ValidationFunctionTrait<From>::ValidationName << "((const " |
504 | 0 | << nameoftype(FromType{}) << "*) data,\n data_len);\n"; |
505 | 0 | os << " " |
506 | 0 | "ASSERT_EQUAL(validation1.error==simdutf::error_code::SUCCESS," |
507 | 0 | "validation2);\n"; |
508 | 0 | os << '\n'; |
509 | 0 | os << " if(validation1.error!= simdutf::error_code::SUCCESS) {return;}\n"; |
510 | 0 | } |
511 | |
|
512 | 0 | if (std::is_invocable_v<LengthFunction, const simdutf::implementation*, |
513 | 0 | const FromType*, std::size_t>) { |
514 | 0 | os << "const auto outlen=implementation." << lengthcalcname << "((const " |
515 | 0 | << nameoftype(FromType{}) << "*) data,\n data_len);\n"; |
516 | 0 | } else if (std::is_invocable_v<LengthFunction, |
517 | 0 | const simdutf::implementation*, |
518 | 0 | std::size_t>) { |
519 | 0 | os << "const auto outlen=implementation." << lengthcalcname |
520 | 0 | << "(data_len);\n"; |
521 | 0 | } else { |
522 | | // programming error |
523 | 0 | std::abort(); |
524 | 0 | } |
525 | 0 | os << "ASSERT_EQUAL(outlen, 1234);\n"; |
526 | 0 | os << "std::vector<" << nameoftype(ToType{}) << "> output(outlen);\n"; |
527 | 0 | os << "const auto r = implementation." << name << "((const " |
528 | 0 | << nameoftype(FromType{}) << "*) data\n, data_len\n, output.data());\n"; |
529 | |
|
530 | 0 | if constexpr (std::is_same_v<ConversionResult, simdutf::result>) { |
531 | 0 | os << " ASSERT_EQUAL(r.error,simdutf::error_code::SUCCESS);\n"; |
532 | 0 | os << " ASSERT_EQUAL(r.count,1234);\n"; |
533 | 0 | } else { |
534 | 0 | os << " ASSERT_EQUAL(r, 1234);\n"; |
535 | 0 | } |
536 | | |
537 | | // dump the output data |
538 | 0 | os << "const std::vector<" << nameoftype(ToType{}) << "> expected_out{};\n"; |
539 | 0 | os << " ASSERT_TRUE(output.size()==expected_out.size());\n"; |
540 | 0 | os << " for(std::size_t i=0; i<output.size(); ++i) { " |
541 | 0 | "ASSERT_EQUAL(+output.at(i),+expected_out.at(i));};\n"; |
542 | |
|
543 | 0 | os << "}\n"; |
544 | 0 | os << "// end testcase\n"; |
545 | 0 | } Unexecuted instantiation: Conversion<(UtfEncodings)0, (UtfEncodings)3, unsigned long (simdutf::implementation::*)(char16_t const*, unsigned long) noexcept const, unsigned long (simdutf::implementation::*)(char16_t const*, unsigned long, char32_t*) noexcept const>::dump_testcase(std::__1::span<char16_t const, 18446744073709551615ul>, std::__1::basic_ostream<char, std::__1::char_traits<char> >&) const Unexecuted instantiation: Conversion<(UtfEncodings)0, (UtfEncodings)2, unsigned long (simdutf::implementation::*)(char16_t const*, unsigned long) noexcept const, unsigned long (simdutf::implementation::*)(char16_t const*, unsigned long, char*) noexcept const>::dump_testcase(std::__1::span<char16_t const, 18446744073709551615ul>, std::__1::basic_ostream<char, std::__1::char_traits<char> >&) const Unexecuted instantiation: Conversion<(UtfEncodings)1, (UtfEncodings)3, unsigned long (simdutf::implementation::*)(char16_t const*, unsigned long) noexcept const, unsigned long (simdutf::implementation::*)(char16_t const*, unsigned long, char32_t*) noexcept const>::dump_testcase(std::__1::span<char16_t const, 18446744073709551615ul>, std::__1::basic_ostream<char, std::__1::char_traits<char> >&) const Unexecuted instantiation: Conversion<(UtfEncodings)1, (UtfEncodings)2, unsigned long (simdutf::implementation::*)(char16_t const*, unsigned long) noexcept const, unsigned long (simdutf::implementation::*)(char16_t const*, unsigned long, char*) noexcept const>::dump_testcase(std::__1::span<char16_t const, 18446744073709551615ul>, std::__1::basic_ostream<char, std::__1::char_traits<char> >&) const Unexecuted instantiation: Conversion<(UtfEncodings)3, (UtfEncodings)0, unsigned long (simdutf::implementation::*)(char32_t const*, unsigned long) noexcept const, unsigned long (simdutf::implementation::*)(char32_t const*, unsigned long, char16_t*) noexcept const>::dump_testcase(std::__1::span<char32_t const, 18446744073709551615ul>, std::__1::basic_ostream<char, std::__1::char_traits<char> >&) const Unexecuted instantiation: Conversion<(UtfEncodings)3, (UtfEncodings)1, unsigned long (simdutf::implementation::*)(char32_t const*, unsigned long) noexcept const, unsigned long (simdutf::implementation::*)(char32_t const*, unsigned long, char16_t*) noexcept const>::dump_testcase(std::__1::span<char32_t const, 18446744073709551615ul>, std::__1::basic_ostream<char, std::__1::char_traits<char> >&) const Unexecuted instantiation: Conversion<(UtfEncodings)3, (UtfEncodings)2, unsigned long (simdutf::implementation::*)(char32_t const*, unsigned long) noexcept const, unsigned long (simdutf::implementation::*)(char32_t const*, unsigned long, char*) noexcept const>::dump_testcase(std::__1::span<char32_t const, 18446744073709551615ul>, std::__1::basic_ostream<char, std::__1::char_traits<char> >&) const Unexecuted instantiation: Conversion<(UtfEncodings)2, (UtfEncodings)0, unsigned long (simdutf::implementation::*)(char const*, unsigned long) noexcept const, unsigned long (simdutf::implementation::*)(char const*, unsigned long, char16_t*) noexcept const>::dump_testcase(std::__1::span<char const, 18446744073709551615ul>, std::__1::basic_ostream<char, std::__1::char_traits<char> >&) const Unexecuted instantiation: Conversion<(UtfEncodings)2, (UtfEncodings)1, unsigned long (simdutf::implementation::*)(char const*, unsigned long) noexcept const, unsigned long (simdutf::implementation::*)(char const*, unsigned long, char16_t*) noexcept const>::dump_testcase(std::__1::span<char const, 18446744073709551615ul>, std::__1::basic_ostream<char, std::__1::char_traits<char> >&) const Unexecuted instantiation: Conversion<(UtfEncodings)2, (UtfEncodings)3, unsigned long (simdutf::implementation::*)(char const*, unsigned long) noexcept const, unsigned long (simdutf::implementation::*)(char const*, unsigned long, char32_t*) noexcept const>::dump_testcase(std::__1::span<char const, 18446744073709551615ul>, std::__1::basic_ostream<char, std::__1::char_traits<char> >&) const Unexecuted instantiation: Conversion<(UtfEncodings)0, (UtfEncodings)4, unsigned long (simdutf::implementation::*)(unsigned long) noexcept const, unsigned long (simdutf::implementation::*)(char16_t const*, unsigned long, char*) noexcept const>::dump_testcase(std::__1::span<char16_t const, 18446744073709551615ul>, std::__1::basic_ostream<char, std::__1::char_traits<char> >&) const Unexecuted instantiation: Conversion<(UtfEncodings)1, (UtfEncodings)4, unsigned long (simdutf::implementation::*)(unsigned long) noexcept const, unsigned long (simdutf::implementation::*)(char16_t const*, unsigned long, char*) noexcept const>::dump_testcase(std::__1::span<char16_t const, 18446744073709551615ul>, std::__1::basic_ostream<char, std::__1::char_traits<char> >&) const Unexecuted instantiation: Conversion<(UtfEncodings)3, (UtfEncodings)4, unsigned long (simdutf::implementation::*)(unsigned long) noexcept const, unsigned long (simdutf::implementation::*)(char32_t const*, unsigned long, char*) noexcept const>::dump_testcase(std::__1::span<char32_t const, 18446744073709551615ul>, std::__1::basic_ostream<char, std::__1::char_traits<char> >&) const Unexecuted instantiation: Conversion<(UtfEncodings)2, (UtfEncodings)4, unsigned long (simdutf::implementation::*)(char const*, unsigned long) noexcept const, unsigned long (simdutf::implementation::*)(char const*, unsigned long, char*) noexcept const>::dump_testcase(std::__1::span<char const, 18446744073709551615ul>, std::__1::basic_ostream<char, std::__1::char_traits<char> >&) const Unexecuted instantiation: Conversion<(UtfEncodings)0, (UtfEncodings)4, unsigned long (simdutf::implementation::*)(unsigned long) noexcept const, simdutf::result (simdutf::implementation::*)(char16_t const*, unsigned long, char*) noexcept const>::dump_testcase(std::__1::span<char16_t const, 18446744073709551615ul>, std::__1::basic_ostream<char, std::__1::char_traits<char> >&) const Unexecuted instantiation: Conversion<(UtfEncodings)0, (UtfEncodings)3, unsigned long (simdutf::implementation::*)(char16_t const*, unsigned long) noexcept const, simdutf::result (simdutf::implementation::*)(char16_t const*, unsigned long, char32_t*) noexcept const>::dump_testcase(std::__1::span<char16_t const, 18446744073709551615ul>, std::__1::basic_ostream<char, std::__1::char_traits<char> >&) const Unexecuted instantiation: Conversion<(UtfEncodings)0, (UtfEncodings)2, unsigned long (simdutf::implementation::*)(char16_t const*, unsigned long) noexcept const, simdutf::result (simdutf::implementation::*)(char16_t const*, unsigned long, char*) noexcept const>::dump_testcase(std::__1::span<char16_t const, 18446744073709551615ul>, std::__1::basic_ostream<char, std::__1::char_traits<char> >&) const Unexecuted instantiation: Conversion<(UtfEncodings)1, (UtfEncodings)4, unsigned long (simdutf::implementation::*)(unsigned long) noexcept const, simdutf::result (simdutf::implementation::*)(char16_t const*, unsigned long, char*) noexcept const>::dump_testcase(std::__1::span<char16_t const, 18446744073709551615ul>, std::__1::basic_ostream<char, std::__1::char_traits<char> >&) const Unexecuted instantiation: Conversion<(UtfEncodings)1, (UtfEncodings)3, unsigned long (simdutf::implementation::*)(char16_t const*, unsigned long) noexcept const, simdutf::result (simdutf::implementation::*)(char16_t const*, unsigned long, char32_t*) noexcept const>::dump_testcase(std::__1::span<char16_t const, 18446744073709551615ul>, std::__1::basic_ostream<char, std::__1::char_traits<char> >&) const Unexecuted instantiation: Conversion<(UtfEncodings)1, (UtfEncodings)2, unsigned long (simdutf::implementation::*)(char16_t const*, unsigned long) noexcept const, simdutf::result (simdutf::implementation::*)(char16_t const*, unsigned long, char*) noexcept const>::dump_testcase(std::__1::span<char16_t const, 18446744073709551615ul>, std::__1::basic_ostream<char, std::__1::char_traits<char> >&) const Unexecuted instantiation: Conversion<(UtfEncodings)3, (UtfEncodings)4, unsigned long (simdutf::implementation::*)(unsigned long) noexcept const, simdutf::result (simdutf::implementation::*)(char32_t const*, unsigned long, char*) noexcept const>::dump_testcase(std::__1::span<char32_t const, 18446744073709551615ul>, std::__1::basic_ostream<char, std::__1::char_traits<char> >&) const Unexecuted instantiation: Conversion<(UtfEncodings)3, (UtfEncodings)0, unsigned long (simdutf::implementation::*)(char32_t const*, unsigned long) noexcept const, simdutf::result (simdutf::implementation::*)(char32_t const*, unsigned long, char16_t*) noexcept const>::dump_testcase(std::__1::span<char32_t const, 18446744073709551615ul>, std::__1::basic_ostream<char, std::__1::char_traits<char> >&) const Unexecuted instantiation: Conversion<(UtfEncodings)3, (UtfEncodings)1, unsigned long (simdutf::implementation::*)(char32_t const*, unsigned long) noexcept const, simdutf::result (simdutf::implementation::*)(char32_t const*, unsigned long, char16_t*) noexcept const>::dump_testcase(std::__1::span<char32_t const, 18446744073709551615ul>, std::__1::basic_ostream<char, std::__1::char_traits<char> >&) const Unexecuted instantiation: Conversion<(UtfEncodings)3, (UtfEncodings)2, unsigned long (simdutf::implementation::*)(char32_t const*, unsigned long) noexcept const, simdutf::result (simdutf::implementation::*)(char32_t const*, unsigned long, char*) noexcept const>::dump_testcase(std::__1::span<char32_t const, 18446744073709551615ul>, std::__1::basic_ostream<char, std::__1::char_traits<char> >&) const Unexecuted instantiation: Conversion<(UtfEncodings)2, (UtfEncodings)4, unsigned long (simdutf::implementation::*)(char const*, unsigned long) noexcept const, simdutf::result (simdutf::implementation::*)(char const*, unsigned long, char*) noexcept const>::dump_testcase(std::__1::span<char const, 18446744073709551615ul>, std::__1::basic_ostream<char, std::__1::char_traits<char> >&) const Unexecuted instantiation: Conversion<(UtfEncodings)2, (UtfEncodings)0, unsigned long (simdutf::implementation::*)(char const*, unsigned long) noexcept const, simdutf::result (simdutf::implementation::*)(char const*, unsigned long, char16_t*) noexcept const>::dump_testcase(std::__1::span<char const, 18446744073709551615ul>, std::__1::basic_ostream<char, std::__1::char_traits<char> >&) const Unexecuted instantiation: Conversion<(UtfEncodings)2, (UtfEncodings)1, unsigned long (simdutf::implementation::*)(char const*, unsigned long) noexcept const, simdutf::result (simdutf::implementation::*)(char const*, unsigned long, char16_t*) noexcept const>::dump_testcase(std::__1::span<char const, 18446744073709551615ul>, std::__1::basic_ostream<char, std::__1::char_traits<char> >&) const Unexecuted instantiation: Conversion<(UtfEncodings)2, (UtfEncodings)3, unsigned long (simdutf::implementation::*)(char const*, unsigned long) noexcept const, simdutf::result (simdutf::implementation::*)(char const*, unsigned long, char32_t*) noexcept const>::dump_testcase(std::__1::span<char const, 18446744073709551615ul>, std::__1::basic_ostream<char, std::__1::char_traits<char> >&) const Unexecuted instantiation: Conversion<(UtfEncodings)4, (UtfEncodings)3, unsigned long (simdutf::implementation::*)(unsigned long) noexcept const, unsigned long (simdutf::implementation::*)(char const*, unsigned long, char32_t*) noexcept const>::dump_testcase(std::__1::span<char const, 18446744073709551615ul>, std::__1::basic_ostream<char, std::__1::char_traits<char> >&) const Unexecuted instantiation: Conversion<(UtfEncodings)4, (UtfEncodings)0, unsigned long (simdutf::implementation::*)(unsigned long) noexcept const, unsigned long (simdutf::implementation::*)(char const*, unsigned long, char16_t*) noexcept const>::dump_testcase(std::__1::span<char const, 18446744073709551615ul>, std::__1::basic_ostream<char, std::__1::char_traits<char> >&) const Unexecuted instantiation: Conversion<(UtfEncodings)4, (UtfEncodings)1, unsigned long (simdutf::implementation::*)(unsigned long) noexcept const, unsigned long (simdutf::implementation::*)(char const*, unsigned long, char16_t*) noexcept const>::dump_testcase(std::__1::span<char const, 18446744073709551615ul>, std::__1::basic_ostream<char, std::__1::char_traits<char> >&) const Unexecuted instantiation: Conversion<(UtfEncodings)4, (UtfEncodings)2, unsigned long (simdutf::implementation::*)(char const*, unsigned long) noexcept const, unsigned long (simdutf::implementation::*)(char const*, unsigned long, char*) noexcept const>::dump_testcase(std::__1::span<char const, 18446744073709551615ul>, std::__1::basic_ostream<char, std::__1::char_traits<char> >&) const |
546 | | }; |
547 | | |
548 | 1 | const auto populate_functions() { |
549 | 1 | using I = simdutf::implementation; |
550 | 1 | using FuzzSignature = void (*)(std::span<const char>); |
551 | | |
552 | 1 | #define ADD(lenfunc, conversionfunc) \ |
553 | 42 | FuzzSignature { \ |
554 | 8.57k | +[](std::span<const char> chardata) { \ |
555 | 8.57k | const auto c = \ |
556 | 8.57k | Conversion<ENCODING_FROM_CONVERSION_NAME(&I::conversionfunc), \ |
557 | 8.57k | ENCODING_TO_CONVERSION_NAME(&I::conversionfunc), \ |
558 | 8.57k | decltype(&I::lenfunc), decltype(&I::conversionfunc)>{ \ |
559 | 8.57k | &I::lenfunc, &I::conversionfunc, \ |
560 | 8.57k | std::string{NAMEOF(&I::lenfunc)}, \ |
561 | 8.57k | std::string{NAMEOF(&I::conversionfunc)}}; \ |
562 | 8.57k | c.fuzz(chardata); \ |
563 | 8.57k | } \ conversion.cpp:populate_functions()::$_0::operator()(std::__1::span<char const, 18446744073709551615ul>) const Line | Count | Source | 554 | 88 | +[](std::span<const char> chardata) { \ | 555 | 88 | const auto c = \ | 556 | 88 | Conversion<ENCODING_FROM_CONVERSION_NAME(&I::conversionfunc), \ | 557 | 88 | ENCODING_TO_CONVERSION_NAME(&I::conversionfunc), \ | 558 | 88 | decltype(&I::lenfunc), decltype(&I::conversionfunc)>{ \ | 559 | 88 | &I::lenfunc, &I::conversionfunc, \ | 560 | 88 | std::string{NAMEOF(&I::lenfunc)}, \ | 561 | 88 | std::string{NAMEOF(&I::conversionfunc)}}; \ | 562 | 88 | c.fuzz(chardata); \ | 563 | 88 | } \ |
conversion.cpp:populate_functions()::$_1::operator()(std::__1::span<char const, 18446744073709551615ul>) const Line | Count | Source | 554 | 240 | +[](std::span<const char> chardata) { \ | 555 | 240 | const auto c = \ | 556 | 240 | Conversion<ENCODING_FROM_CONVERSION_NAME(&I::conversionfunc), \ | 557 | 240 | ENCODING_TO_CONVERSION_NAME(&I::conversionfunc), \ | 558 | 240 | decltype(&I::lenfunc), decltype(&I::conversionfunc)>{ \ | 559 | 240 | &I::lenfunc, &I::conversionfunc, \ | 560 | 240 | std::string{NAMEOF(&I::lenfunc)}, \ | 561 | 240 | std::string{NAMEOF(&I::conversionfunc)}}; \ | 562 | 240 | c.fuzz(chardata); \ | 563 | 240 | } \ |
conversion.cpp:populate_functions()::$_2::operator()(std::__1::span<char const, 18446744073709551615ul>) const Line | Count | Source | 554 | 61 | +[](std::span<const char> chardata) { \ | 555 | 61 | const auto c = \ | 556 | 61 | Conversion<ENCODING_FROM_CONVERSION_NAME(&I::conversionfunc), \ | 557 | 61 | ENCODING_TO_CONVERSION_NAME(&I::conversionfunc), \ | 558 | 61 | decltype(&I::lenfunc), decltype(&I::conversionfunc)>{ \ | 559 | 61 | &I::lenfunc, &I::conversionfunc, \ | 560 | 61 | std::string{NAMEOF(&I::lenfunc)}, \ | 561 | 61 | std::string{NAMEOF(&I::conversionfunc)}}; \ | 562 | 61 | c.fuzz(chardata); \ | 563 | 61 | } \ |
conversion.cpp:populate_functions()::$_3::operator()(std::__1::span<char const, 18446744073709551615ul>) const Line | Count | Source | 554 | 219 | +[](std::span<const char> chardata) { \ | 555 | 219 | const auto c = \ | 556 | 219 | Conversion<ENCODING_FROM_CONVERSION_NAME(&I::conversionfunc), \ | 557 | 219 | ENCODING_TO_CONVERSION_NAME(&I::conversionfunc), \ | 558 | 219 | decltype(&I::lenfunc), decltype(&I::conversionfunc)>{ \ | 559 | 219 | &I::lenfunc, &I::conversionfunc, \ | 560 | 219 | std::string{NAMEOF(&I::lenfunc)}, \ | 561 | 219 | std::string{NAMEOF(&I::conversionfunc)}}; \ | 562 | 219 | c.fuzz(chardata); \ | 563 | 219 | } \ |
conversion.cpp:populate_functions()::$_4::operator()(std::__1::span<char const, 18446744073709551615ul>) const Line | Count | Source | 554 | 47 | +[](std::span<const char> chardata) { \ | 555 | 47 | const auto c = \ | 556 | 47 | Conversion<ENCODING_FROM_CONVERSION_NAME(&I::conversionfunc), \ | 557 | 47 | ENCODING_TO_CONVERSION_NAME(&I::conversionfunc), \ | 558 | 47 | decltype(&I::lenfunc), decltype(&I::conversionfunc)>{ \ | 559 | 47 | &I::lenfunc, &I::conversionfunc, \ | 560 | 47 | std::string{NAMEOF(&I::lenfunc)}, \ | 561 | 47 | std::string{NAMEOF(&I::conversionfunc)}}; \ | 562 | 47 | c.fuzz(chardata); \ | 563 | 47 | } \ |
conversion.cpp:populate_functions()::$_5::operator()(std::__1::span<char const, 18446744073709551615ul>) const Line | Count | Source | 554 | 150 | +[](std::span<const char> chardata) { \ | 555 | 150 | const auto c = \ | 556 | 150 | Conversion<ENCODING_FROM_CONVERSION_NAME(&I::conversionfunc), \ | 557 | 150 | ENCODING_TO_CONVERSION_NAME(&I::conversionfunc), \ | 558 | 150 | decltype(&I::lenfunc), decltype(&I::conversionfunc)>{ \ | 559 | 150 | &I::lenfunc, &I::conversionfunc, \ | 560 | 150 | std::string{NAMEOF(&I::lenfunc)}, \ | 561 | 150 | std::string{NAMEOF(&I::conversionfunc)}}; \ | 562 | 150 | c.fuzz(chardata); \ | 563 | 150 | } \ |
conversion.cpp:populate_functions()::$_6::operator()(std::__1::span<char const, 18446744073709551615ul>) const Line | Count | Source | 554 | 102 | +[](std::span<const char> chardata) { \ | 555 | 102 | const auto c = \ | 556 | 102 | Conversion<ENCODING_FROM_CONVERSION_NAME(&I::conversionfunc), \ | 557 | 102 | ENCODING_TO_CONVERSION_NAME(&I::conversionfunc), \ | 558 | 102 | decltype(&I::lenfunc), decltype(&I::conversionfunc)>{ \ | 559 | 102 | &I::lenfunc, &I::conversionfunc, \ | 560 | 102 | std::string{NAMEOF(&I::lenfunc)}, \ | 561 | 102 | std::string{NAMEOF(&I::conversionfunc)}}; \ | 562 | 102 | c.fuzz(chardata); \ | 563 | 102 | } \ |
conversion.cpp:populate_functions()::$_7::operator()(std::__1::span<char const, 18446744073709551615ul>) const Line | Count | Source | 554 | 228 | +[](std::span<const char> chardata) { \ | 555 | 228 | const auto c = \ | 556 | 228 | Conversion<ENCODING_FROM_CONVERSION_NAME(&I::conversionfunc), \ | 557 | 228 | ENCODING_TO_CONVERSION_NAME(&I::conversionfunc), \ | 558 | 228 | decltype(&I::lenfunc), decltype(&I::conversionfunc)>{ \ | 559 | 228 | &I::lenfunc, &I::conversionfunc, \ | 560 | 228 | std::string{NAMEOF(&I::lenfunc)}, \ | 561 | 228 | std::string{NAMEOF(&I::conversionfunc)}}; \ | 562 | 228 | c.fuzz(chardata); \ | 563 | 228 | } \ |
conversion.cpp:populate_functions()::$_8::operator()(std::__1::span<char const, 18446744073709551615ul>) const Line | Count | Source | 554 | 197 | +[](std::span<const char> chardata) { \ | 555 | 197 | const auto c = \ | 556 | 197 | Conversion<ENCODING_FROM_CONVERSION_NAME(&I::conversionfunc), \ | 557 | 197 | ENCODING_TO_CONVERSION_NAME(&I::conversionfunc), \ | 558 | 197 | decltype(&I::lenfunc), decltype(&I::conversionfunc)>{ \ | 559 | 197 | &I::lenfunc, &I::conversionfunc, \ | 560 | 197 | std::string{NAMEOF(&I::lenfunc)}, \ | 561 | 197 | std::string{NAMEOF(&I::conversionfunc)}}; \ | 562 | 197 | c.fuzz(chardata); \ | 563 | 197 | } \ |
conversion.cpp:populate_functions()::$_9::operator()(std::__1::span<char const, 18446744073709551615ul>) const Line | Count | Source | 554 | 208 | +[](std::span<const char> chardata) { \ | 555 | 208 | const auto c = \ | 556 | 208 | Conversion<ENCODING_FROM_CONVERSION_NAME(&I::conversionfunc), \ | 557 | 208 | ENCODING_TO_CONVERSION_NAME(&I::conversionfunc), \ | 558 | 208 | decltype(&I::lenfunc), decltype(&I::conversionfunc)>{ \ | 559 | 208 | &I::lenfunc, &I::conversionfunc, \ | 560 | 208 | std::string{NAMEOF(&I::lenfunc)}, \ | 561 | 208 | std::string{NAMEOF(&I::conversionfunc)}}; \ | 562 | 208 | c.fuzz(chardata); \ | 563 | 208 | } \ |
conversion.cpp:populate_functions()::$_10::operator()(std::__1::span<char const, 18446744073709551615ul>) const Line | Count | Source | 554 | 63 | +[](std::span<const char> chardata) { \ | 555 | 63 | const auto c = \ | 556 | 63 | Conversion<ENCODING_FROM_CONVERSION_NAME(&I::conversionfunc), \ | 557 | 63 | ENCODING_TO_CONVERSION_NAME(&I::conversionfunc), \ | 558 | 63 | decltype(&I::lenfunc), decltype(&I::conversionfunc)>{ \ | 559 | 63 | &I::lenfunc, &I::conversionfunc, \ | 560 | 63 | std::string{NAMEOF(&I::lenfunc)}, \ | 561 | 63 | std::string{NAMEOF(&I::conversionfunc)}}; \ | 562 | 63 | c.fuzz(chardata); \ | 563 | 63 | } \ |
conversion.cpp:populate_functions()::$_11::operator()(std::__1::span<char const, 18446744073709551615ul>) const Line | Count | Source | 554 | 113 | +[](std::span<const char> chardata) { \ | 555 | 113 | const auto c = \ | 556 | 113 | Conversion<ENCODING_FROM_CONVERSION_NAME(&I::conversionfunc), \ | 557 | 113 | ENCODING_TO_CONVERSION_NAME(&I::conversionfunc), \ | 558 | 113 | decltype(&I::lenfunc), decltype(&I::conversionfunc)>{ \ | 559 | 113 | &I::lenfunc, &I::conversionfunc, \ | 560 | 113 | std::string{NAMEOF(&I::lenfunc)}, \ | 561 | 113 | std::string{NAMEOF(&I::conversionfunc)}}; \ | 562 | 113 | c.fuzz(chardata); \ | 563 | 113 | } \ |
conversion.cpp:populate_functions()::$_12::operator()(std::__1::span<char const, 18446744073709551615ul>) const Line | Count | Source | 554 | 163 | +[](std::span<const char> chardata) { \ | 555 | 163 | const auto c = \ | 556 | 163 | Conversion<ENCODING_FROM_CONVERSION_NAME(&I::conversionfunc), \ | 557 | 163 | ENCODING_TO_CONVERSION_NAME(&I::conversionfunc), \ | 558 | 163 | decltype(&I::lenfunc), decltype(&I::conversionfunc)>{ \ | 559 | 163 | &I::lenfunc, &I::conversionfunc, \ | 560 | 163 | std::string{NAMEOF(&I::lenfunc)}, \ | 561 | 163 | std::string{NAMEOF(&I::conversionfunc)}}; \ | 562 | 163 | c.fuzz(chardata); \ | 563 | 163 | } \ |
conversion.cpp:populate_functions()::$_13::operator()(std::__1::span<char const, 18446744073709551615ul>) const Line | Count | Source | 554 | 62 | +[](std::span<const char> chardata) { \ | 555 | 62 | const auto c = \ | 556 | 62 | Conversion<ENCODING_FROM_CONVERSION_NAME(&I::conversionfunc), \ | 557 | 62 | ENCODING_TO_CONVERSION_NAME(&I::conversionfunc), \ | 558 | 62 | decltype(&I::lenfunc), decltype(&I::conversionfunc)>{ \ | 559 | 62 | &I::lenfunc, &I::conversionfunc, \ | 560 | 62 | std::string{NAMEOF(&I::lenfunc)}, \ | 561 | 62 | std::string{NAMEOF(&I::conversionfunc)}}; \ | 562 | 62 | c.fuzz(chardata); \ | 563 | 62 | } \ |
conversion.cpp:populate_functions()::$_14::operator()(std::__1::span<char const, 18446744073709551615ul>) const Line | Count | Source | 554 | 136 | +[](std::span<const char> chardata) { \ | 555 | 136 | const auto c = \ | 556 | 136 | Conversion<ENCODING_FROM_CONVERSION_NAME(&I::conversionfunc), \ | 557 | 136 | ENCODING_TO_CONVERSION_NAME(&I::conversionfunc), \ | 558 | 136 | decltype(&I::lenfunc), decltype(&I::conversionfunc)>{ \ | 559 | 136 | &I::lenfunc, &I::conversionfunc, \ | 560 | 136 | std::string{NAMEOF(&I::lenfunc)}, \ | 561 | 136 | std::string{NAMEOF(&I::conversionfunc)}}; \ | 562 | 136 | c.fuzz(chardata); \ | 563 | 136 | } \ |
conversion.cpp:populate_functions()::$_15::operator()(std::__1::span<char const, 18446744073709551615ul>) const Line | Count | Source | 554 | 193 | +[](std::span<const char> chardata) { \ | 555 | 193 | const auto c = \ | 556 | 193 | Conversion<ENCODING_FROM_CONVERSION_NAME(&I::conversionfunc), \ | 557 | 193 | ENCODING_TO_CONVERSION_NAME(&I::conversionfunc), \ | 558 | 193 | decltype(&I::lenfunc), decltype(&I::conversionfunc)>{ \ | 559 | 193 | &I::lenfunc, &I::conversionfunc, \ | 560 | 193 | std::string{NAMEOF(&I::lenfunc)}, \ | 561 | 193 | std::string{NAMEOF(&I::conversionfunc)}}; \ | 562 | 193 | c.fuzz(chardata); \ | 563 | 193 | } \ |
conversion.cpp:populate_functions()::$_16::operator()(std::__1::span<char const, 18446744073709551615ul>) const Line | Count | Source | 554 | 94 | +[](std::span<const char> chardata) { \ | 555 | 94 | const auto c = \ | 556 | 94 | Conversion<ENCODING_FROM_CONVERSION_NAME(&I::conversionfunc), \ | 557 | 94 | ENCODING_TO_CONVERSION_NAME(&I::conversionfunc), \ | 558 | 94 | decltype(&I::lenfunc), decltype(&I::conversionfunc)>{ \ | 559 | 94 | &I::lenfunc, &I::conversionfunc, \ | 560 | 94 | std::string{NAMEOF(&I::lenfunc)}, \ | 561 | 94 | std::string{NAMEOF(&I::conversionfunc)}}; \ | 562 | 94 | c.fuzz(chardata); \ | 563 | 94 | } \ |
conversion.cpp:populate_functions()::$_17::operator()(std::__1::span<char const, 18446744073709551615ul>) const Line | Count | Source | 554 | 221 | +[](std::span<const char> chardata) { \ | 555 | 221 | const auto c = \ | 556 | 221 | Conversion<ENCODING_FROM_CONVERSION_NAME(&I::conversionfunc), \ | 557 | 221 | ENCODING_TO_CONVERSION_NAME(&I::conversionfunc), \ | 558 | 221 | decltype(&I::lenfunc), decltype(&I::conversionfunc)>{ \ | 559 | 221 | &I::lenfunc, &I::conversionfunc, \ | 560 | 221 | std::string{NAMEOF(&I::lenfunc)}, \ | 561 | 221 | std::string{NAMEOF(&I::conversionfunc)}}; \ | 562 | 221 | c.fuzz(chardata); \ | 563 | 221 | } \ |
conversion.cpp:populate_functions()::$_18::operator()(std::__1::span<char const, 18446744073709551615ul>) const Line | Count | Source | 554 | 216 | +[](std::span<const char> chardata) { \ | 555 | 216 | const auto c = \ | 556 | 216 | Conversion<ENCODING_FROM_CONVERSION_NAME(&I::conversionfunc), \ | 557 | 216 | ENCODING_TO_CONVERSION_NAME(&I::conversionfunc), \ | 558 | 216 | decltype(&I::lenfunc), decltype(&I::conversionfunc)>{ \ | 559 | 216 | &I::lenfunc, &I::conversionfunc, \ | 560 | 216 | std::string{NAMEOF(&I::lenfunc)}, \ | 561 | 216 | std::string{NAMEOF(&I::conversionfunc)}}; \ | 562 | 216 | c.fuzz(chardata); \ | 563 | 216 | } \ |
conversion.cpp:populate_functions()::$_19::operator()(std::__1::span<char const, 18446744073709551615ul>) const Line | Count | Source | 554 | 302 | +[](std::span<const char> chardata) { \ | 555 | 302 | const auto c = \ | 556 | 302 | Conversion<ENCODING_FROM_CONVERSION_NAME(&I::conversionfunc), \ | 557 | 302 | ENCODING_TO_CONVERSION_NAME(&I::conversionfunc), \ | 558 | 302 | decltype(&I::lenfunc), decltype(&I::conversionfunc)>{ \ | 559 | 302 | &I::lenfunc, &I::conversionfunc, \ | 560 | 302 | std::string{NAMEOF(&I::lenfunc)}, \ | 561 | 302 | std::string{NAMEOF(&I::conversionfunc)}}; \ | 562 | 302 | c.fuzz(chardata); \ | 563 | 302 | } \ |
conversion.cpp:populate_functions()::$_20::operator()(std::__1::span<char const, 18446744073709551615ul>) const Line | Count | Source | 554 | 281 | +[](std::span<const char> chardata) { \ | 555 | 281 | const auto c = \ | 556 | 281 | Conversion<ENCODING_FROM_CONVERSION_NAME(&I::conversionfunc), \ | 557 | 281 | ENCODING_TO_CONVERSION_NAME(&I::conversionfunc), \ | 558 | 281 | decltype(&I::lenfunc), decltype(&I::conversionfunc)>{ \ | 559 | 281 | &I::lenfunc, &I::conversionfunc, \ | 560 | 281 | std::string{NAMEOF(&I::lenfunc)}, \ | 561 | 281 | std::string{NAMEOF(&I::conversionfunc)}}; \ | 562 | 281 | c.fuzz(chardata); \ | 563 | 281 | } \ |
conversion.cpp:populate_functions()::$_21::operator()(std::__1::span<char const, 18446744073709551615ul>) const Line | Count | Source | 554 | 356 | +[](std::span<const char> chardata) { \ | 555 | 356 | const auto c = \ | 556 | 356 | Conversion<ENCODING_FROM_CONVERSION_NAME(&I::conversionfunc), \ | 557 | 356 | ENCODING_TO_CONVERSION_NAME(&I::conversionfunc), \ | 558 | 356 | decltype(&I::lenfunc), decltype(&I::conversionfunc)>{ \ | 559 | 356 | &I::lenfunc, &I::conversionfunc, \ | 560 | 356 | std::string{NAMEOF(&I::lenfunc)}, \ | 561 | 356 | std::string{NAMEOF(&I::conversionfunc)}}; \ | 562 | 356 | c.fuzz(chardata); \ | 563 | 356 | } \ |
conversion.cpp:populate_functions()::$_22::operator()(std::__1::span<char const, 18446744073709551615ul>) const Line | Count | Source | 554 | 330 | +[](std::span<const char> chardata) { \ | 555 | 330 | const auto c = \ | 556 | 330 | Conversion<ENCODING_FROM_CONVERSION_NAME(&I::conversionfunc), \ | 557 | 330 | ENCODING_TO_CONVERSION_NAME(&I::conversionfunc), \ | 558 | 330 | decltype(&I::lenfunc), decltype(&I::conversionfunc)>{ \ | 559 | 330 | &I::lenfunc, &I::conversionfunc, \ | 560 | 330 | std::string{NAMEOF(&I::lenfunc)}, \ | 561 | 330 | std::string{NAMEOF(&I::conversionfunc)}}; \ | 562 | 330 | c.fuzz(chardata); \ | 563 | 330 | } \ |
conversion.cpp:populate_functions()::$_23::operator()(std::__1::span<char const, 18446744073709551615ul>) const Line | Count | Source | 554 | 356 | +[](std::span<const char> chardata) { \ | 555 | 356 | const auto c = \ | 556 | 356 | Conversion<ENCODING_FROM_CONVERSION_NAME(&I::conversionfunc), \ | 557 | 356 | ENCODING_TO_CONVERSION_NAME(&I::conversionfunc), \ | 558 | 356 | decltype(&I::lenfunc), decltype(&I::conversionfunc)>{ \ | 559 | 356 | &I::lenfunc, &I::conversionfunc, \ | 560 | 356 | std::string{NAMEOF(&I::lenfunc)}, \ | 561 | 356 | std::string{NAMEOF(&I::conversionfunc)}}; \ | 562 | 356 | c.fuzz(chardata); \ | 563 | 356 | } \ |
conversion.cpp:populate_functions()::$_24::operator()(std::__1::span<char const, 18446744073709551615ul>) const Line | Count | Source | 554 | 126 | +[](std::span<const char> chardata) { \ | 555 | 126 | const auto c = \ | 556 | 126 | Conversion<ENCODING_FROM_CONVERSION_NAME(&I::conversionfunc), \ | 557 | 126 | ENCODING_TO_CONVERSION_NAME(&I::conversionfunc), \ | 558 | 126 | decltype(&I::lenfunc), decltype(&I::conversionfunc)>{ \ | 559 | 126 | &I::lenfunc, &I::conversionfunc, \ | 560 | 126 | std::string{NAMEOF(&I::lenfunc)}, \ | 561 | 126 | std::string{NAMEOF(&I::conversionfunc)}}; \ | 562 | 126 | c.fuzz(chardata); \ | 563 | 126 | } \ |
conversion.cpp:populate_functions()::$_25::operator()(std::__1::span<char const, 18446744073709551615ul>) const Line | Count | Source | 554 | 150 | +[](std::span<const char> chardata) { \ | 555 | 150 | const auto c = \ | 556 | 150 | Conversion<ENCODING_FROM_CONVERSION_NAME(&I::conversionfunc), \ | 557 | 150 | ENCODING_TO_CONVERSION_NAME(&I::conversionfunc), \ | 558 | 150 | decltype(&I::lenfunc), decltype(&I::conversionfunc)>{ \ | 559 | 150 | &I::lenfunc, &I::conversionfunc, \ | 560 | 150 | std::string{NAMEOF(&I::lenfunc)}, \ | 561 | 150 | std::string{NAMEOF(&I::conversionfunc)}}; \ | 562 | 150 | c.fuzz(chardata); \ | 563 | 150 | } \ |
conversion.cpp:populate_functions()::$_26::operator()(std::__1::span<char const, 18446744073709551615ul>) const Line | Count | Source | 554 | 293 | +[](std::span<const char> chardata) { \ | 555 | 293 | const auto c = \ | 556 | 293 | Conversion<ENCODING_FROM_CONVERSION_NAME(&I::conversionfunc), \ | 557 | 293 | ENCODING_TO_CONVERSION_NAME(&I::conversionfunc), \ | 558 | 293 | decltype(&I::lenfunc), decltype(&I::conversionfunc)>{ \ | 559 | 293 | &I::lenfunc, &I::conversionfunc, \ | 560 | 293 | std::string{NAMEOF(&I::lenfunc)}, \ | 561 | 293 | std::string{NAMEOF(&I::conversionfunc)}}; \ | 562 | 293 | c.fuzz(chardata); \ | 563 | 293 | } \ |
conversion.cpp:populate_functions()::$_27::operator()(std::__1::span<char const, 18446744073709551615ul>) const Line | Count | Source | 554 | 115 | +[](std::span<const char> chardata) { \ | 555 | 115 | const auto c = \ | 556 | 115 | Conversion<ENCODING_FROM_CONVERSION_NAME(&I::conversionfunc), \ | 557 | 115 | ENCODING_TO_CONVERSION_NAME(&I::conversionfunc), \ | 558 | 115 | decltype(&I::lenfunc), decltype(&I::conversionfunc)>{ \ | 559 | 115 | &I::lenfunc, &I::conversionfunc, \ | 560 | 115 | std::string{NAMEOF(&I::lenfunc)}, \ | 561 | 115 | std::string{NAMEOF(&I::conversionfunc)}}; \ | 562 | 115 | c.fuzz(chardata); \ | 563 | 115 | } \ |
conversion.cpp:populate_functions()::$_28::operator()(std::__1::span<char const, 18446744073709551615ul>) const Line | Count | Source | 554 | 207 | +[](std::span<const char> chardata) { \ | 555 | 207 | const auto c = \ | 556 | 207 | Conversion<ENCODING_FROM_CONVERSION_NAME(&I::conversionfunc), \ | 557 | 207 | ENCODING_TO_CONVERSION_NAME(&I::conversionfunc), \ | 558 | 207 | decltype(&I::lenfunc), decltype(&I::conversionfunc)>{ \ | 559 | 207 | &I::lenfunc, &I::conversionfunc, \ | 560 | 207 | std::string{NAMEOF(&I::lenfunc)}, \ | 561 | 207 | std::string{NAMEOF(&I::conversionfunc)}}; \ | 562 | 207 | c.fuzz(chardata); \ | 563 | 207 | } \ |
conversion.cpp:populate_functions()::$_29::operator()(std::__1::span<char const, 18446744073709551615ul>) const Line | Count | Source | 554 | 315 | +[](std::span<const char> chardata) { \ | 555 | 315 | const auto c = \ | 556 | 315 | Conversion<ENCODING_FROM_CONVERSION_NAME(&I::conversionfunc), \ | 557 | 315 | ENCODING_TO_CONVERSION_NAME(&I::conversionfunc), \ | 558 | 315 | decltype(&I::lenfunc), decltype(&I::conversionfunc)>{ \ | 559 | 315 | &I::lenfunc, &I::conversionfunc, \ | 560 | 315 | std::string{NAMEOF(&I::lenfunc)}, \ | 561 | 315 | std::string{NAMEOF(&I::conversionfunc)}}; \ | 562 | 315 | c.fuzz(chardata); \ | 563 | 315 | } \ |
conversion.cpp:populate_functions()::$_30::operator()(std::__1::span<char const, 18446744073709551615ul>) const Line | Count | Source | 554 | 210 | +[](std::span<const char> chardata) { \ | 555 | 210 | const auto c = \ | 556 | 210 | Conversion<ENCODING_FROM_CONVERSION_NAME(&I::conversionfunc), \ | 557 | 210 | ENCODING_TO_CONVERSION_NAME(&I::conversionfunc), \ | 558 | 210 | decltype(&I::lenfunc), decltype(&I::conversionfunc)>{ \ | 559 | 210 | &I::lenfunc, &I::conversionfunc, \ | 560 | 210 | std::string{NAMEOF(&I::lenfunc)}, \ | 561 | 210 | std::string{NAMEOF(&I::conversionfunc)}}; \ | 562 | 210 | c.fuzz(chardata); \ | 563 | 210 | } \ |
conversion.cpp:populate_functions()::$_31::operator()(std::__1::span<char const, 18446744073709551615ul>) const Line | Count | Source | 554 | 303 | +[](std::span<const char> chardata) { \ | 555 | 303 | const auto c = \ | 556 | 303 | Conversion<ENCODING_FROM_CONVERSION_NAME(&I::conversionfunc), \ | 557 | 303 | ENCODING_TO_CONVERSION_NAME(&I::conversionfunc), \ | 558 | 303 | decltype(&I::lenfunc), decltype(&I::conversionfunc)>{ \ | 559 | 303 | &I::lenfunc, &I::conversionfunc, \ | 560 | 303 | std::string{NAMEOF(&I::lenfunc)}, \ | 561 | 303 | std::string{NAMEOF(&I::conversionfunc)}}; \ | 562 | 303 | c.fuzz(chardata); \ | 563 | 303 | } \ |
conversion.cpp:populate_functions()::$_32::operator()(std::__1::span<char const, 18446744073709551615ul>) const Line | Count | Source | 554 | 358 | +[](std::span<const char> chardata) { \ | 555 | 358 | const auto c = \ | 556 | 358 | Conversion<ENCODING_FROM_CONVERSION_NAME(&I::conversionfunc), \ | 557 | 358 | ENCODING_TO_CONVERSION_NAME(&I::conversionfunc), \ | 558 | 358 | decltype(&I::lenfunc), decltype(&I::conversionfunc)>{ \ | 559 | 358 | &I::lenfunc, &I::conversionfunc, \ | 560 | 358 | std::string{NAMEOF(&I::lenfunc)}, \ | 561 | 358 | std::string{NAMEOF(&I::conversionfunc)}}; \ | 562 | 358 | c.fuzz(chardata); \ | 563 | 358 | } \ |
conversion.cpp:populate_functions()::$_33::operator()(std::__1::span<char const, 18446744073709551615ul>) const Line | Count | Source | 554 | 415 | +[](std::span<const char> chardata) { \ | 555 | 415 | const auto c = \ | 556 | 415 | Conversion<ENCODING_FROM_CONVERSION_NAME(&I::conversionfunc), \ | 557 | 415 | ENCODING_TO_CONVERSION_NAME(&I::conversionfunc), \ | 558 | 415 | decltype(&I::lenfunc), decltype(&I::conversionfunc)>{ \ | 559 | 415 | &I::lenfunc, &I::conversionfunc, \ | 560 | 415 | std::string{NAMEOF(&I::lenfunc)}, \ | 561 | 415 | std::string{NAMEOF(&I::conversionfunc)}}; \ | 562 | 415 | c.fuzz(chardata); \ | 563 | 415 | } \ |
conversion.cpp:populate_functions()::$_34::operator()(std::__1::span<char const, 18446744073709551615ul>) const Line | Count | Source | 554 | 258 | +[](std::span<const char> chardata) { \ | 555 | 258 | const auto c = \ | 556 | 258 | Conversion<ENCODING_FROM_CONVERSION_NAME(&I::conversionfunc), \ | 557 | 258 | ENCODING_TO_CONVERSION_NAME(&I::conversionfunc), \ | 558 | 258 | decltype(&I::lenfunc), decltype(&I::conversionfunc)>{ \ | 559 | 258 | &I::lenfunc, &I::conversionfunc, \ | 560 | 258 | std::string{NAMEOF(&I::lenfunc)}, \ | 561 | 258 | std::string{NAMEOF(&I::conversionfunc)}}; \ | 562 | 258 | c.fuzz(chardata); \ | 563 | 258 | } \ |
conversion.cpp:populate_functions()::$_35::operator()(std::__1::span<char const, 18446744073709551615ul>) const Line | Count | Source | 554 | 351 | +[](std::span<const char> chardata) { \ | 555 | 351 | const auto c = \ | 556 | 351 | Conversion<ENCODING_FROM_CONVERSION_NAME(&I::conversionfunc), \ | 557 | 351 | ENCODING_TO_CONVERSION_NAME(&I::conversionfunc), \ | 558 | 351 | decltype(&I::lenfunc), decltype(&I::conversionfunc)>{ \ | 559 | 351 | &I::lenfunc, &I::conversionfunc, \ | 560 | 351 | std::string{NAMEOF(&I::lenfunc)}, \ | 561 | 351 | std::string{NAMEOF(&I::conversionfunc)}}; \ | 562 | 351 | c.fuzz(chardata); \ | 563 | 351 | } \ |
conversion.cpp:populate_functions()::$_36::operator()(std::__1::span<char const, 18446744073709551615ul>) const Line | Count | Source | 554 | 287 | +[](std::span<const char> chardata) { \ | 555 | 287 | const auto c = \ | 556 | 287 | Conversion<ENCODING_FROM_CONVERSION_NAME(&I::conversionfunc), \ | 557 | 287 | ENCODING_TO_CONVERSION_NAME(&I::conversionfunc), \ | 558 | 287 | decltype(&I::lenfunc), decltype(&I::conversionfunc)>{ \ | 559 | 287 | &I::lenfunc, &I::conversionfunc, \ | 560 | 287 | std::string{NAMEOF(&I::lenfunc)}, \ | 561 | 287 | std::string{NAMEOF(&I::conversionfunc)}}; \ | 562 | 287 | c.fuzz(chardata); \ | 563 | 287 | } \ |
conversion.cpp:populate_functions()::$_37::operator()(std::__1::span<char const, 18446744073709551615ul>) const Line | Count | Source | 554 | 369 | +[](std::span<const char> chardata) { \ | 555 | 369 | const auto c = \ | 556 | 369 | Conversion<ENCODING_FROM_CONVERSION_NAME(&I::conversionfunc), \ | 557 | 369 | ENCODING_TO_CONVERSION_NAME(&I::conversionfunc), \ | 558 | 369 | decltype(&I::lenfunc), decltype(&I::conversionfunc)>{ \ | 559 | 369 | &I::lenfunc, &I::conversionfunc, \ | 560 | 369 | std::string{NAMEOF(&I::lenfunc)}, \ | 561 | 369 | std::string{NAMEOF(&I::conversionfunc)}}; \ | 562 | 369 | c.fuzz(chardata); \ | 563 | 369 | } \ |
conversion.cpp:populate_functions()::$_38::operator()(std::__1::span<char const, 18446744073709551615ul>) const Line | Count | Source | 554 | 45 | +[](std::span<const char> chardata) { \ | 555 | 45 | const auto c = \ | 556 | 45 | Conversion<ENCODING_FROM_CONVERSION_NAME(&I::conversionfunc), \ | 557 | 45 | ENCODING_TO_CONVERSION_NAME(&I::conversionfunc), \ | 558 | 45 | decltype(&I::lenfunc), decltype(&I::conversionfunc)>{ \ | 559 | 45 | &I::lenfunc, &I::conversionfunc, \ | 560 | 45 | std::string{NAMEOF(&I::lenfunc)}, \ | 561 | 45 | std::string{NAMEOF(&I::conversionfunc)}}; \ | 562 | 45 | c.fuzz(chardata); \ | 563 | 45 | } \ |
conversion.cpp:populate_functions()::$_39::operator()(std::__1::span<char const, 18446744073709551615ul>) const Line | Count | Source | 554 | 40 | +[](std::span<const char> chardata) { \ | 555 | 40 | const auto c = \ | 556 | 40 | Conversion<ENCODING_FROM_CONVERSION_NAME(&I::conversionfunc), \ | 557 | 40 | ENCODING_TO_CONVERSION_NAME(&I::conversionfunc), \ | 558 | 40 | decltype(&I::lenfunc), decltype(&I::conversionfunc)>{ \ | 559 | 40 | &I::lenfunc, &I::conversionfunc, \ | 560 | 40 | std::string{NAMEOF(&I::lenfunc)}, \ | 561 | 40 | std::string{NAMEOF(&I::conversionfunc)}}; \ | 562 | 40 | c.fuzz(chardata); \ | 563 | 40 | } \ |
conversion.cpp:populate_functions()::$_40::operator()(std::__1::span<char const, 18446744073709551615ul>) const Line | Count | Source | 554 | 40 | +[](std::span<const char> chardata) { \ | 555 | 40 | const auto c = \ | 556 | 40 | Conversion<ENCODING_FROM_CONVERSION_NAME(&I::conversionfunc), \ | 557 | 40 | ENCODING_TO_CONVERSION_NAME(&I::conversionfunc), \ | 558 | 40 | decltype(&I::lenfunc), decltype(&I::conversionfunc)>{ \ | 559 | 40 | &I::lenfunc, &I::conversionfunc, \ | 560 | 40 | std::string{NAMEOF(&I::lenfunc)}, \ | 561 | 40 | std::string{NAMEOF(&I::conversionfunc)}}; \ | 562 | 40 | c.fuzz(chardata); \ | 563 | 40 | } \ |
conversion.cpp:populate_functions()::$_41::operator()(std::__1::span<char const, 18446744073709551615ul>) const Line | Count | Source | 554 | 269 | +[](std::span<const char> chardata) { \ | 555 | 269 | const auto c = \ | 556 | 269 | Conversion<ENCODING_FROM_CONVERSION_NAME(&I::conversionfunc), \ | 557 | 269 | ENCODING_TO_CONVERSION_NAME(&I::conversionfunc), \ | 558 | 269 | decltype(&I::lenfunc), decltype(&I::conversionfunc)>{ \ | 559 | 269 | &I::lenfunc, &I::conversionfunc, \ | 560 | 269 | std::string{NAMEOF(&I::lenfunc)}, \ | 561 | 269 | std::string{NAMEOF(&I::conversionfunc)}}; \ | 562 | 269 | c.fuzz(chardata); \ | 563 | 269 | } \ |
|
564 | 42 | } |
565 | | |
566 | 1 | return std::array{ |
567 | | // all these cases require valid input for invoking the convert function |
568 | | |
569 | | // see #493 |
570 | | // IGNORE(latin1_length_from_utf16, convert_valid_utf16be_to_latin1), |
571 | 1 | ADD(utf32_length_from_utf16be, convert_valid_utf16be_to_utf32), |
572 | 1 | ADD(utf8_length_from_utf16be, convert_valid_utf16be_to_utf8), |
573 | | |
574 | | // see #493 |
575 | | // IGNORE(latin1_length_from_utf16, convert_valid_utf16le_to_latin1), |
576 | 1 | ADD(utf32_length_from_utf16le, convert_valid_utf16le_to_utf32), |
577 | 1 | ADD(utf8_length_from_utf16le, convert_valid_utf16le_to_utf8), |
578 | | |
579 | | // see #493 |
580 | | // IGNORE(latin1_length_from_utf32, convert_valid_utf32_to_latin1), |
581 | 1 | ADD(utf16_length_from_utf32, convert_valid_utf32_to_utf16be), |
582 | 1 | ADD(utf16_length_from_utf32, convert_valid_utf32_to_utf16le), |
583 | 1 | ADD(utf8_length_from_utf32, convert_valid_utf32_to_utf8), |
584 | | |
585 | | // see #493 |
586 | | // IGNORE(latin1_length_from_utf8, convert_valid_utf8_to_latin1), |
587 | 1 | ADD(utf16_length_from_utf8, convert_valid_utf8_to_utf16be), |
588 | 1 | ADD(utf16_length_from_utf8, convert_valid_utf8_to_utf16le), |
589 | 1 | ADD(utf32_length_from_utf8, convert_valid_utf8_to_utf32), |
590 | | |
591 | | // all these cases operate on arbitrary data |
592 | 1 | ADD(latin1_length_from_utf16, convert_utf16be_to_latin1), |
593 | 1 | ADD(utf32_length_from_utf16be, convert_utf16be_to_utf32), |
594 | 1 | ADD(utf8_length_from_utf16be, convert_utf16be_to_utf8), |
595 | | |
596 | 1 | ADD(latin1_length_from_utf16, convert_utf16le_to_latin1), |
597 | 1 | ADD(utf32_length_from_utf16le, convert_utf16le_to_utf32), |
598 | 1 | ADD(utf8_length_from_utf16le, convert_utf16le_to_utf8), |
599 | | |
600 | 1 | ADD(latin1_length_from_utf32, convert_utf32_to_latin1), |
601 | 1 | ADD(utf16_length_from_utf32, convert_utf32_to_utf16be), |
602 | 1 | ADD(utf16_length_from_utf32, convert_utf32_to_utf16le), |
603 | 1 | ADD(utf8_length_from_utf32, convert_utf32_to_utf8), |
604 | | |
605 | 1 | ADD(latin1_length_from_utf8, convert_utf8_to_latin1), |
606 | 1 | ADD(utf16_length_from_utf8, convert_utf8_to_utf16be), |
607 | 1 | ADD(utf16_length_from_utf8, convert_utf8_to_utf16le), |
608 | 1 | ADD(utf32_length_from_utf8, convert_utf8_to_utf32), |
609 | | |
610 | | // all these cases operate on arbitrary data and use the _with_errors |
611 | | // variant |
612 | 1 | ADD(latin1_length_from_utf16, convert_utf16be_to_latin1_with_errors), |
613 | 1 | ADD(utf32_length_from_utf16be, convert_utf16be_to_utf32_with_errors), |
614 | 1 | ADD(utf8_length_from_utf16be, convert_utf16be_to_utf8_with_errors), |
615 | | |
616 | 1 | ADD(latin1_length_from_utf16, convert_utf16le_to_latin1_with_errors), |
617 | 1 | ADD(utf32_length_from_utf16le, convert_utf16le_to_utf32_with_errors), |
618 | 1 | ADD(utf8_length_from_utf16le, convert_utf16le_to_utf8_with_errors), |
619 | | |
620 | 1 | ADD(latin1_length_from_utf32, convert_utf32_to_latin1_with_errors), |
621 | 1 | ADD(utf16_length_from_utf32, convert_utf32_to_utf16be_with_errors), |
622 | 1 | ADD(utf16_length_from_utf32, convert_utf32_to_utf16le_with_errors), |
623 | 1 | ADD(utf8_length_from_utf32, convert_utf32_to_utf8_with_errors), |
624 | | |
625 | 1 | ADD(latin1_length_from_utf8, convert_utf8_to_latin1_with_errors), |
626 | 1 | ADD(utf16_length_from_utf8, convert_utf8_to_utf16be_with_errors), |
627 | 1 | ADD(utf16_length_from_utf8, convert_utf8_to_utf16le_with_errors), |
628 | 1 | ADD(utf32_length_from_utf8, convert_utf8_to_utf32_with_errors), |
629 | | |
630 | | // these are a bit special since all input is valid |
631 | 1 | ADD(utf32_length_from_latin1, convert_latin1_to_utf32), |
632 | 1 | ADD(utf16_length_from_latin1, convert_latin1_to_utf16be), |
633 | 1 | ADD(utf16_length_from_latin1, convert_latin1_to_utf16le), |
634 | 1 | ADD(utf8_length_from_latin1, convert_latin1_to_utf8)}; |
635 | | |
636 | 1 | #undef ADD |
637 | 1 | } |
638 | | |
639 | 8.58k | extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { |
640 | 8.58k | static const auto fptrs = populate_functions(); |
641 | 8.58k | constexpr std::size_t Ncases = fptrs.size(); |
642 | | |
643 | | // pick one of the function pointers, based on the fuzz data |
644 | | // the first byte is which action to take. step forward |
645 | | // several bytes so the input is aligned. |
646 | 8.58k | if (size < 4) { |
647 | 3 | return 0; |
648 | 3 | } |
649 | | |
650 | 8.57k | constexpr auto actionmask = std::bit_ceil(Ncases) - 1; |
651 | 8.57k | const auto action = data[0] & actionmask; |
652 | 8.57k | data += 4; |
653 | 8.57k | size -= 4; |
654 | | |
655 | 8.57k | if (action >= Ncases) { |
656 | 1 | return 0; |
657 | 1 | } |
658 | | |
659 | 8.57k | if constexpr (use_separate_allocation) { |
660 | | // this is better at exercising null input and catch buffer underflows |
661 | 8.57k | const std::vector<char> separate{data, data + size}; |
662 | 8.57k | fptrs[action](std::span(separate)); |
663 | | } else { |
664 | | std::span<const char> chardata{(const char*)data, size}; |
665 | | fptrs[action](chardata); |
666 | | } |
667 | | |
668 | 8.57k | return 0; |
669 | 8.57k | } |