Skip to content

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

Merged
merged 2 commits into from
Mar 2, 2020

Conversation

rklaehn
Copy link
Collaborator

@rklaehn rklaehn commented Feb 20, 2020

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.

rklaehn added a commit to Actyx/rust-cid that referenced this pull request Feb 20, 2020
This is incomplete as long as multiformats/rust-multihash#51 is not merged
@rklaehn
Copy link
Collaborator Author

rklaehn commented Feb 20, 2020

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)

@rklaehn rklaehn force-pushed the actyx/multihash-arbitrary branch from de95467 to 41266ec Compare February 21, 2020 12:41
@@ -25,3 +25,12 @@ sha1 = "0.5"
sha2 = { version = "0.7", default-features = false }
tiny-keccak = "1.4"
unsigned-varint = "0.3"
Copy link
Collaborator Author

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.

@rklaehn rklaehn force-pushed the actyx/multihash-arbitrary branch from 41266ec to e57e035 Compare February 21, 2020 13:13
Both for internal purposes and for use by other crates
@rklaehn rklaehn force-pushed the actyx/multihash-arbitrary branch from e57e035 to f73a232 Compare March 2, 2020 12:35
@rklaehn
Copy link
Collaborator Author

rklaehn commented Mar 2, 2020

@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.

Copy link
Member

@vmx vmx left a 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.

@vmx vmx requested a review from dignifiedquire March 2, 2020 12:49
@vmx vmx merged commit aff3b7f into multiformats:master Mar 2, 2020
@rklaehn rklaehn deleted the actyx/multihash-arbitrary branch March 2, 2020 14:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants