Skip to content

Commit

Permalink
enable proptest with arbitrary feature (#323)
Browse files Browse the repository at this point in the history
  • Loading branch information
joshieDo authored Jan 9, 2023
1 parent 2be3798 commit 81942d6
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 11 deletions.
4 changes: 2 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 10 additions & 2 deletions crates/interpreter/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,13 @@ sha3 = { version = "0.10", default-features = false, features = [] }
# optional
serde = { version = "1.0", features = ["derive", "rc"], optional = true }
arbitrary = { version = "1.2", features = ["derive"], optional = true }
proptest = { version = "1.0", optional = true }
proptest-derive = { version = "0.3", optional = true }

[dev-dependencies]
arbitrary = { version = "1.2", features = ["derive"] }
proptest = { version = "1.0" }
proptest-derive = "0.2.0"
proptest-derive = "0.3"
ruint = { version = "1.7.0", features = [
"primitive-types",
"rlp",
Expand Down Expand Up @@ -68,4 +70,10 @@ serde = [
"ruint/serde",
"bytes/serde",
]
arbitrary = ["dep:arbitrary", "ruint/arbitrary", "ruint/proptest"]
arbitrary = [
"ruint/arbitrary",
"ruint/proptest",
"dep:arbitrary",
"dep:proptest",
"dep:proptest-derive"
]
11 changes: 4 additions & 7 deletions crates/interpreter/src/bits.rs
Original file line number Diff line number Diff line change
@@ -1,24 +1,21 @@
use derive_more::{AsRef, Deref};
use fixed_hash::{construct_fixed_hash, impl_fixed_hash_conversions};

#[cfg(test)]
use proptest_derive::Arbitrary as PropTestArbitrary;

#[cfg(any(test, feature = "arbitrary"))]
use arbitrary::Arbitrary;
#[cfg(any(test, feature = "arbitrary"))]
use proptest_derive::Arbitrary as PropTestArbitrary;

construct_fixed_hash! {
/// revm 256 bits type.
#[cfg_attr(test, derive(PropTestArbitrary))]
#[cfg_attr(any(test, feature = "arbitrary"), derive(Arbitrary))]
#[cfg_attr(any(test, feature = "arbitrary"), derive(Arbitrary, PropTestArbitrary))]
#[derive(AsRef,Deref)]
pub struct B256(32);
}

construct_fixed_hash! {
/// revm 160 bits type.
#[cfg_attr(test, derive(PropTestArbitrary))]
#[cfg_attr(any(test, feature = "arbitrary"), derive(Arbitrary))]
#[cfg_attr(any(test, feature = "arbitrary"), derive(Arbitrary, PropTestArbitrary))]
#[derive(AsRef,Deref)]
pub struct B160(20);
}
Expand Down

0 comments on commit 81942d6

Please sign in to comment.