aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAntoine Poinsot <darosior@protonmail.com>2023-05-16 19:55:10 +0200
committerAntoine Poinsot <darosior@protonmail.com>2023-07-21 10:40:13 +0200
commitd60229ede54e05724d444eaba02a9ed72f5ada02 (patch)
tree0de92d6e696d2179e3da2febb93b2f6ec40533e6
parentd23fda05842ba4539b225bbab01b94df0060f697 (diff)
fuzz: make the parsed descriptor testing into a function
We'll be reusing it in the new target.
-rw-r--r--src/test/fuzz/descriptor_parse.cpp14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/test/fuzz/descriptor_parse.cpp b/src/test/fuzz/descriptor_parse.cpp
index 579942c3b5..0e4ef1522f 100644
--- a/src/test/fuzz/descriptor_parse.cpp
+++ b/src/test/fuzz/descriptor_parse.cpp
@@ -8,6 +8,14 @@
#include <test/fuzz/fuzz.h>
#include <util/chaintype.h>
+/** Test a successfully parsed descriptor. */
+static void TestDescriptor(const Descriptor& desc)
+{
+ (void)desc.ToString();
+ (void)desc.IsRange();
+ (void)desc.IsSolvable();
+}
+
void initialize_descriptor_parse()
{
ECC_Start();
@@ -21,10 +29,6 @@ FUZZ_TARGET(descriptor_parse, .init = initialize_descriptor_parse)
std::string error;
for (const bool require_checksum : {true, false}) {
const auto desc = Parse(descriptor, signing_provider, error, require_checksum);
- if (desc) {
- (void)desc->ToString();
- (void)desc->IsRange();
- (void)desc->IsSolvable();
- }
+ if (desc) TestDescriptor(*desc);
}
}