| 1 | use crate::tests::common; |
| 2 | use crate::RRuleSet; |
| 3 | |
| 4 | /// Monthly on the 31st of the month |
| 5 | #[test] |
| 6 | fn monthly_on_31th() { |
| 7 | let dates = "DTSTART;TZID=America/New_York:19970902T090000\n\ |
| 8 | RRULE:FREQ=MONTHLY;COUNT=10;BYMONTHDAY=31" |
| 9 | .parse::<RRuleSet>() |
| 10 | .unwrap() |
| 11 | .all(u16::MAX) |
| 12 | .dates; |
| 13 | // TODO: Is this the correct behavior? |
| 14 | common::check_occurrences( |
| 15 | &dates, |
| 16 | &[ |
| 17 | "1997-10-31T09:00:00-05:00", |
| 18 | "1997-12-31T09:00:00-05:00", |
| 19 | "1998-01-31T09:00:00-05:00", |
| 20 | "1998-03-31T09:00:00-05:00", |
| 21 | "1998-05-31T09:00:00-04:00", |
| 22 | "1998-07-31T09:00:00-04:00", |
| 23 | "1998-08-31T09:00:00-04:00", |
| 24 | "1998-10-31T09:00:00-05:00", |
| 25 | "1998-12-31T09:00:00-05:00", |
| 26 | "1999-01-31T09:00:00-05:00", |
| 27 | ], |
| 28 | ); |
| 29 | } |
| 30 | |
| 31 | /// Monthly on the 31th-to-last of the month |
| 32 | #[test] |
| 33 | fn monthly_on_31th_to_last() { |
| 34 | let dates = "DTSTART;TZID=America/New_York:19970902T090000\n\ |
| 35 | RRULE:FREQ=MONTHLY;COUNT=10;BYMONTHDAY=-31" |
| 36 | .parse::<RRuleSet>() |
| 37 | .unwrap() |
| 38 | .all(u16::MAX) |
| 39 | .dates; |
| 40 | // TODO: Is this the correct behavior? |
| 41 | common::check_occurrences( |
| 42 | &dates, |
| 43 | &[ |
| 44 | "1997-10-01T09:00:00-04:00", |
| 45 | "1997-12-01T09:00:00-05:00", |
| 46 | "1998-01-01T09:00:00-05:00", |
| 47 | "1998-03-01T09:00:00-05:00", |
| 48 | "1998-05-01T09:00:00-04:00", |
| 49 | "1998-07-01T09:00:00-04:00", |
| 50 | "1998-08-01T09:00:00-04:00", |
| 51 | "1998-10-01T09:00:00-04:00", |
| 52 | "1998-12-01T09:00:00-05:00", |
| 53 | "1999-01-01T09:00:00-05:00", |
| 54 | ], |
| 55 | ); |
| 56 | } |