-
Notifications
You must be signed in to change notification settings - Fork 63
Hash and Multihash arbitrary #51
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
This is incomplete as long as multiformats/rust-multihash#51 is not merged
Note that the tests that I have added in this crate using the arbitrary are in the files themselves. The tests directory is for integration tests that use the crate externally, so there is not an easy way to enable the test feature for them, except maybe doing it on a file by file basis as outlined here: rust-lang/cargo#2911 (comment) |
de95467
to
41266ec
Compare
@@ -25,3 +25,12 @@ sha1 = "0.5" | |||
sha2 = { version = "0.7", default-features = false } | |||
tiny-keccak = "1.4" | |||
unsigned-varint = "0.3" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need the dependencies twice, once for our own tests, and once for the test feature that other crates can use from their dev-dependencies.
41266ec
to
e57e035
Compare
Both for internal purposes and for use by other crates
e57e035
to
f73a232
Compare
@vmx brought this up to date. WDYT? I would love the entire multiformats crate hierarchy to have arbs so that more complex crates such as rust-ipfs or rust-libp2p can use them to write property based tests / fuzz tests. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know much about arbitraries, but that sounds good to me.
Implements #48
This is a request for discussion about if this way of providing arbitraries both for internal use and for use from other crates is a good way to go.
If somebody has a simpler way to achieve this I am eager to hear about it...
I verified that the dependencies are not in the output unless you build with the feature flag enabled. See https://github.com/rklaehn/rust-feature-experiment
This is based on #47 , so should be reviewed once that is merged.