diff options
-rw-r--r-- | src/iter.rs | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/src/iter.rs b/src/iter.rs index 05669c2..b253f9f 100644 --- a/src/iter.rs +++ b/src/iter.rs @@ -580,5 +580,41 @@ mod test_until { assert!(v.is_empty()); } + #[test] + fn test_until_1() { + let end = (TimeType::today() + TimeType::days(2)) + .calculate() + .unwrap() + .get_moment() + .unwrap() + .clone(); + + let v = TimeType::today() + .daily(1) + .unwrap() + .until(end) + .collect::<Vec<_>>(); + + assert_eq!(v.len(), 1); + } + + #[test] + fn test_until_2() { + let end = (TimeType::today() + TimeType::days(2)) + .calculate() + .unwrap() + .get_moment() + .unwrap() + .clone(); + + let v = TimeType::today() + .hourly(1) + .unwrap() + .until(end) + .collect::<Vec<_>>(); + + assert_eq!(v.len(), 48 - 1); // -1 because we do not start to iterate with 0, but 1 + } + } |