diff options
-rw-r--r-- | tests/rrule.rs | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/tests/rrule.rs b/tests/rrule.rs index 512e217..ca171db 100644 --- a/tests/rrule.rs +++ b/tests/rrule.rs @@ -2,7 +2,6 @@ extern crate chrono; extern crate rust_ical; use chrono::prelude::*; -use chrono::*; use rust_ical::iter::*; use rust_ical::yearinfo::*; @@ -10,12 +9,7 @@ use rust_ical::yearinfo::*; mod test { use super::*; - fn test_recurring(msg: &str, options: &ParsedOptions, expected_dates: &DateTime<Utc>) { - assert_eq!(2, 2, "{}", msg); - } - - #[test] - fn int_works() { + fn test_recurring(msg: &str, options: &mut ParsedOptions, expected_dates: &Vec<DateTime<Utc>>) { let iter_args = IterArgs { inc: true, before: Utc::now(), @@ -24,6 +18,14 @@ mod test { _value: Some(vec![]), }; let mut iter_res = IterResult::new(QueryMethodTypes::ALL, iter_args); + let res = iter(&mut iter_res, options); + for (actual, exptected) in res.iter().zip(expected_dates) { + assert_eq!(actual, exptected, "{}", msg); + } + } + + #[test] + fn int_works() { let mut options = ParsedOptions { freq: Frequenzy::DAILY, dtstart: Utc.ymd(2012, 1, 1).and_hms(10, 30, 0), @@ -52,7 +54,7 @@ mod test { tzid: None, interval: 5, wkst: 0, - count: Some(5), + count: Some(3), bysecond: vec![0], byminute: vec![30], byhour: vec![10], @@ -65,8 +67,10 @@ mod test { bynweekday: vec![], bynmonthday: vec![], }; - let res = iter(&mut iter_res, &mut options); - assert!(false); - println!("Res: {:?}", res); + test_recurring( + "should work", + &mut options_2, + &vec![Utc.ymd(2020, 0, 0).and_hms(0, 0, 0)], + ); } } |