diff options
author | Fredrik Meringdal <fmeringdal@hotmail.com> | 2020-10-15 21:37:05 +0200 |
---|---|---|
committer | Fredrik Meringdal <fmeringdal@hotmail.com> | 2020-10-15 21:37:05 +0200 |
commit | 669c070bc736fc6904169319f20743f628642a2c (patch) | |
tree | 9cdace6c1907fff6dcf8fd0d372dc0f08d534caa /tests/rrule.rs | |
parent | 3575783180b9faa54e6973f2dadaa4a8bd5a66eb (diff) | |
download | rust_rrule-669c070bc736fc6904169319f20743f628642a2c.zip |
yearly works
Diffstat (limited to 'tests/rrule.rs')
-rw-r--r-- | tests/rrule.rs | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/tests/rrule.rs b/tests/rrule.rs index 4f96320..6330073 100644 --- a/tests/rrule.rs +++ b/tests/rrule.rs @@ -21,7 +21,7 @@ mod test { Utc.ymd(year, month, day).and_hms(hour, minute, second) } - fn test_recurring(msg: &str, options: &mut ParsedOptions, expected_dates: &Vec<DateTime<Utc>>) { + fn test_recurring(options: &mut ParsedOptions, expected_dates: &Vec<DateTime<Utc>>) { let iter_args = IterArgs { inc: true, before: Utc::now(), @@ -38,19 +38,20 @@ mod test { "Expected number of returned dates to be equal to the expected" ); + println!("Acutal: {:?}", res); for (actual, exptected) in res.iter().zip(expected_dates) { - assert_eq!(actual, exptected, "{}", msg); + assert_eq!(actual, exptected); } } #[test] fn int_works() { - let mut options = ParsedOptions::new(Frequenzy::WEEKLY, 5, &ymd_hms(2012, 1, 1, 10, 30, 0)) + let mut options = ParsedOptions::new(Frequenzy::WEEKLY, &ymd_hms(2012, 1, 1, 10, 30, 0)) + .interval(5) .count(3) .byweekday(vec![0, 4]) .bymonth(vec![6]); test_recurring( - "should work", &mut options, &vec![ ymd_hms(2012, 6, 18, 10, 30, 0), @@ -59,4 +60,18 @@ mod test { ], ); } + + #[test] + fn yearly() { + let mut options = + ParsedOptions::new(Frequenzy::YEARLY, &ymd_hms(1997, 9, 2, 9, 0, 0)).count(3); + test_recurring( + &mut options, + &vec![ + ymd_hms(1997, 9, 2, 9, 0, 0), + ymd_hms(1998, 9, 2, 9, 0, 0), + ymd_hms(1999, 9, 2, 9, 0, 0), + ], + ); + } } |