mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-05-02 01:40:12 +02:00
Merge bitcoin/bitcoin#22621: make ParseOutputType return a std::optional<OutputType>
32fa49a184make ParseOutputType return a std::optional<OutputType> (fanquake) Pull request description: Similar to #22220. Skipped using `auto` here for the same reasons outlined in that PR. ACKs for top commit: jnewbery: utACK32fa49a184jonatack: Code review ACK32fa49a184and debian clang 13 debug build is clean / unit tests locally are green MarcoFalke: review ACK32fa49a184🍢 Tree-SHA512: 7752193117669b800889226185d49d164395697853828f8acb568f07651789bc5b2cddc45555957450353886e46b9a1e13c77a5e730a14c6ee621fabc8dc3d10
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -66,8 +66,7 @@ FUZZ_TARGET(string)
|
||||
(void)ParseNonRFCJSONValue(random_string_1);
|
||||
} catch (const std::runtime_error&) {
|
||||
}
|
||||
OutputType output_type;
|
||||
(void)ParseOutputType(random_string_1, output_type);
|
||||
(void)ParseOutputType(random_string_1);
|
||||
(void)RemovePrefix(random_string_1, random_string_2);
|
||||
(void)ResolveErrMsg(random_string_1, random_string_2);
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user