diff options
| -rw-r--r-- | talpid-core/src/future_retry.rs | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/talpid-core/src/future_retry.rs b/talpid-core/src/future_retry.rs index f7b68a3f2d..197042e353 100644 --- a/talpid-core/src/future_retry.rs +++ b/talpid-core/src/future_retry.rs @@ -155,6 +155,22 @@ 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); |
