From 68d423f4738202e608909aa18be4f14863466ef8 Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Sun, 19 Nov 2017 13:23:33 +0100 Subject: Add more tests for UntilIter --- src/iter.rs | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) 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::>(); + + 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::>(); + + assert_eq!(v.len(), 48 - 1); // -1 because we do not start to iterate with 0, but 1 + } + } -- cgit v1.2.3