-
Notifications
You must be signed in to change notification settings - Fork 146
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #131 from darosior/descriptor_publickey
DescriptorPublicKey, second pass
- Loading branch information
Showing
3 changed files
with
489 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
extern crate miniscript; | ||
|
||
use miniscript::descriptor::DescriptorPublicKey; | ||
use std::str::FromStr; | ||
|
||
fn do_test(data: &[u8]) { | ||
let data_str = String::from_utf8_lossy(data); | ||
if let Ok(dpk) = DescriptorPublicKey::from_str(&data_str) { | ||
let output = dpk.to_string(); | ||
assert_eq!(data_str.to_lowercase(), output.to_lowercase()); | ||
} | ||
} | ||
|
||
#[cfg(feature = "afl")] | ||
extern crate afl; | ||
#[cfg(feature = "afl")] | ||
fn main() { | ||
afl::read_stdio_bytes(|data| { | ||
do_test(&data); | ||
}); | ||
} | ||
|
||
#[cfg(feature = "honggfuzz")] | ||
#[macro_use] | ||
extern crate honggfuzz; | ||
#[cfg(feature = "honggfuzz")] | ||
fn main() { | ||
loop { | ||
fuzz!(|data| { | ||
do_test(data); | ||
}); | ||
} | ||
} |
Oops, something went wrong.