diff options
author | fanquake <fanquake@gmail.com> | 2021-08-04 13:38:36 +0800 |
---|---|---|
committer | fanquake <fanquake@gmail.com> | 2021-08-04 19:20:32 +0800 |
commit | 32fa49a18497a9b8c72e36a72ae96e7b23930223 (patch) | |
tree | 5cb3394183c123b5e0db66a7694c6afa99a8565e /src/test/fuzz/kitchen_sink.cpp | |
parent | 3308c61091b6b7cb22569f3abadea6d001295c90 (diff) |
make ParseOutputType return a std::optional<OutputType>
Diffstat (limited to 'src/test/fuzz/kitchen_sink.cpp')
-rw-r--r-- | src/test/fuzz/kitchen_sink.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/test/fuzz/kitchen_sink.cpp b/src/test/fuzz/kitchen_sink.cpp index 908e9a1c83..82f3a306c5 100644 --- a/src/test/fuzz/kitchen_sink.cpp +++ b/src/test/fuzz/kitchen_sink.cpp @@ -13,6 +13,7 @@ #include <array> #include <cstdint> +#include <optional> #include <vector> namespace { @@ -46,11 +47,10 @@ FUZZ_TARGET(kitchen_sink) const OutputType output_type = fuzzed_data_provider.PickValueInArray(OUTPUT_TYPES); const std::string& output_type_string = FormatOutputType(output_type); - OutputType output_type_parsed; - const bool parsed = ParseOutputType(output_type_string, output_type_parsed); + const std::optional<OutputType> parsed = ParseOutputType(output_type_string); assert(parsed); - assert(output_type == output_type_parsed); - (void)ParseOutputType(fuzzed_data_provider.ConsumeRandomLengthString(64), output_type_parsed); + assert(output_type == parsed.value()); + (void)ParseOutputType(fuzzed_data_provider.ConsumeRandomLengthString(64)); const std::vector<uint8_t> bytes = ConsumeRandomLengthByteVector(fuzzed_data_provider); const std::vector<bool> bits = BytesToBits(bytes); |