mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-02-23 07:15:29 +01:00
fuzz: make the parsed descriptor testing into a function
We'll be reusing it in the new target.
This commit is contained in:
parent
d23fda0584
commit
d60229ede5
1 changed files with 9 additions and 5 deletions
|
@ -8,6 +8,14 @@
|
||||||
#include <test/fuzz/fuzz.h>
|
#include <test/fuzz/fuzz.h>
|
||||||
#include <util/chaintype.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()
|
void initialize_descriptor_parse()
|
||||||
{
|
{
|
||||||
ECC_Start();
|
ECC_Start();
|
||||||
|
@ -21,10 +29,6 @@ FUZZ_TARGET(descriptor_parse, .init = initialize_descriptor_parse)
|
||||||
std::string error;
|
std::string error;
|
||||||
for (const bool require_checksum : {true, false}) {
|
for (const bool require_checksum : {true, false}) {
|
||||||
const auto desc = Parse(descriptor, signing_provider, error, require_checksum);
|
const auto desc = Parse(descriptor, signing_provider, error, require_checksum);
|
||||||
if (desc) {
|
if (desc) TestDescriptor(*desc);
|
||||||
(void)desc->ToString();
|
|
||||||
(void)desc->IsRange();
|
|
||||||
(void)desc->IsSolvable();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue