diff --git a/talpid-core/src/future_retry.rs b/talpid-core/src/future_retry.rs index 478e5b7e1c90..25dafdf766ea 100644 --- a/talpid-core/src/future_retry.rs +++ b/talpid-core/src/future_retry.rs @@ -152,6 +152,22 @@ fn apply_jitter(duration: Duration, jitter: f64) -> Duration { mod test { use super::*; + #[test] + fn test_constant_interval() { + let mut ivl = ConstantInterval::new(Duration::from_secs(2), Some(3)); + + assert_eq!(ivl.next(), Some(Duration::from_secs(2))); + assert_eq!(ivl.next(), Some(Duration::from_secs(2))); + assert_eq!(ivl.next(), Some(Duration::from_secs(2))); + assert_eq!(ivl.next(), None); + } + + #[test] + fn test_constant_interval_no_max() { + let mut ivl = ConstantInterval::new(Duration::from_secs(2), None); + assert_eq!(ivl.next(), Some(Duration::from_secs(2))); + } + #[test] fn test_exponential_backoff() { let mut backoff = ExponentialBackoff::new(Duration::from_secs(2), 3);