Skip to content

Commit 89c7935

Browse files
committed
Added proptest to workspace dependencies
1 parent 7ef9bec commit 89c7935

3 files changed

Lines changed: 15 additions & 0 deletions

File tree

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ license = "Apache-2.0" # TODO(template) update license if needed
1414
publish = false
1515

1616
[workspace.dependencies]
17+
proptest = "1"
1718

1819
[workspace.lints.rust]
1920
missing_docs = "deny"

template_crate/Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ license.workspace = true
1414
# code break after upgrades
1515
thiserror = { version = "1.0", default-features = false }
1616

17+
[dev-dependencies]
18+
proptest = { workspace = true }
19+
1720
# TODO(template)
1821
# don't forget to put this at every crate
1922
# to inherit workspace's lints

template_crate/src/lib.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ pub fn sub_small_integers(a: u8, b: u8) -> Result<u8, ParameterError> {
4646
#[cfg(test)]
4747
mod tests {
4848
use super::*;
49+
use proptest::proptest;
4950

5051
#[test]
5152
fn addition_of_bounded() {
@@ -67,4 +68,14 @@ mod tests {
6768
add_small_integers(UPPER_BOUND - 1, UPPER_BOUND - 1)
6869
);
6970
}
71+
72+
proptest! {
73+
#[test]
74+
fn addition_proptest(a in 0_u8..20, b in 0_u8..20) {
75+
assert_eq!(
76+
Ok(a + b),
77+
add_small_integers(a, b)
78+
);
79+
}
80+
}
7081
}

0 commit comments

Comments
 (0)