Skip to content

Commit 7540d77

Browse files
committed
Remove quicktest dependency, replace usages with proptest.
1 parent cbe36f1 commit 7540d77

File tree

3 files changed

+12
-31
lines changed

3 files changed

+12
-31
lines changed

Cargo.lock

+1-22
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

talpid-core/Cargo.toml

+1-2
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,5 @@ features = [
9494
tonic-build = { workspace = true, default-features = false, features = ["transport", "prost"] }
9595

9696
[dev-dependencies]
97-
quickcheck = { version = "1.0", default-features = false }
98-
quickcheck_macros = "1.0"
97+
proptest = "1.4"
9998
tokio = { workspace = true, features = [ "test-util" ] }

talpid-core/src/future_retry.rs

+10-7
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,7 @@ fn apply_jitter(duration: Duration, jitter: f64) -> Duration {
153153
#[cfg(test)]
154154
mod test {
155155
use super::*;
156+
use proptest::prelude::*;
156157

157158
#[test]
158159
fn test_constant_interval() {
@@ -220,13 +221,15 @@ mod test {
220221
assert_eq!(apply_jitter(second, 1.0), second);
221222
}
222223

223-
#[quickcheck_macros::quickcheck]
224-
fn test_jitter(millis: u64, jitter: u64) {
225-
let max_num = 2u64.checked_pow(f64::MANTISSA_DIGITS).unwrap();
226-
let jitter = (jitter % max_num) as f64 / (max_num as f64);
227-
let unjittered_duration = Duration::from_millis(millis);
228-
let jittered_duration = apply_jitter(unjittered_duration, jitter);
229-
assert!(jittered_duration <= unjittered_duration);
224+
proptest! {
225+
#[test]
226+
fn test_jitter(millis: u64, jitter: u64) {
227+
let max_num = 2u64.checked_pow(f64::MANTISSA_DIGITS).unwrap();
228+
let jitter = (jitter % max_num) as f64 / (max_num as f64);
229+
let unjittered_duration = Duration::from_millis(millis);
230+
let jittered_duration = apply_jitter(unjittered_duration, jitter);
231+
prop_assert!(jittered_duration <= unjittered_duration);
232+
}
230233
}
231234

232235
// NOTE: The test is disabled because the clock does not advance.

0 commit comments

Comments
 (0)