Debian Codegraph @

src/tests/rfc_tests.rs

raw symbols SCIP
1 //! This file contains examples from:
2 //! <https://icalendar.org/iCalendar-RFC-5545/3-8-5-3-recurrence-rule.html>
3
4 use craterust-analyzer cargo rrule 0.14.0 crate/::testsrust-analyzer cargo rrule 0.14.0 tests/::commonrust-analyzer cargo rrule 0.14.0 tests/common/;
5 use craterust-analyzer cargo rrule 0.14.0 crate/::RRuleSetrust-analyzer cargo rrule 0.14.0 core/rruleset/RRuleSet#;
6
7 // ------------------------------------------ Daily ---------------------------------------------
8
9 /// Daily for 10 occurrences
10 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
11 fn daily_10_occurrencesrust-analyzer cargo rrule 0.14.0 tests/rfc_tests/daily_10_occurrences().() {
12 let dates = "DTSTART;TZID=America/New_York:19970902T090000\n\
13 RRULE:FREQ=DAILY;COUNT=10"
14 .parserust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]parse().::<RRuleSetrust-analyzer cargo rrule 0.14.0 core/rruleset/RRuleSet#>()
15 .unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().()
16 .allrust-analyzer cargo rrule 0.14.0 core/rruleset/impl#[RRuleSet]all().(u16::MAXrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[u16]MAX.)
17 .datesrust-analyzer cargo rrule 0.14.0 core/rruleset/RRuleResult#dates.;
18 commonrust-analyzer cargo rrule 0.14.0 tests/common/::check_occurrencesrust-analyzer cargo rrule 0.14.0 tests/common/check_occurrences().(
19 &dates,
20 &[
21 "1997-09-02T09:00:00-04:00",
22 "1997-09-03T09:00:00-04:00",
23 "1997-09-04T09:00:00-04:00",
24 "1997-09-05T09:00:00-04:00",
25 "1997-09-06T09:00:00-04:00",
26 "1997-09-07T09:00:00-04:00",
27 "1997-09-08T09:00:00-04:00",
28 "1997-09-09T09:00:00-04:00",
29 "1997-09-10T09:00:00-04:00",
30 "1997-09-11T09:00:00-04:00",
31 ],
32 );
33 }
34
35 /// Daily until November 03, 1997
36 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
37 fn daily_until_novemberrust-analyzer cargo rrule 0.14.0 tests/rfc_tests/daily_until_november().() {
38 // This has been changes to make it shorter, so it is not too long.
39 // From september-november
40 let dates = "DTSTART;TZID=America/New_York:19970920T090000\n\
41 RRULE:FREQ=DAILY;UNTIL=19971103T000000Z"
42 .parserust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]parse().::<RRuleSetrust-analyzer cargo rrule 0.14.0 core/rruleset/RRuleSet#>()
43 .unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().()
44 .allrust-analyzer cargo rrule 0.14.0 core/rruleset/impl#[RRuleSet]all().(u16::MAXrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[u16]MAX.)
45 .datesrust-analyzer cargo rrule 0.14.0 core/rruleset/RRuleResult#dates.;
46 commonrust-analyzer cargo rrule 0.14.0 tests/common/::check_occurrencesrust-analyzer cargo rrule 0.14.0 tests/common/check_occurrences().(
47 &dates,
48 &[
49 // September
50 "1997-09-20T09:00:00-04:00",
51 "1997-09-21T09:00:00-04:00",
52 "1997-09-22T09:00:00-04:00",
53 "1997-09-23T09:00:00-04:00",
54 "1997-09-24T09:00:00-04:00",
55 "1997-09-25T09:00:00-04:00",
56 "1997-09-26T09:00:00-04:00",
57 "1997-09-27T09:00:00-04:00",
58 "1997-09-28T09:00:00-04:00",
59 "1997-09-29T09:00:00-04:00",
60 "1997-09-30T09:00:00-04:00",
61 // October
62 "1997-10-01T09:00:00-04:00",
63 "1997-10-02T09:00:00-04:00",
64 "1997-10-03T09:00:00-04:00",
65 "1997-10-04T09:00:00-04:00",
66 "1997-10-05T09:00:00-04:00",
67 "1997-10-06T09:00:00-04:00",
68 "1997-10-07T09:00:00-04:00",
69 "1997-10-08T09:00:00-04:00",
70 "1997-10-09T09:00:00-04:00",
71 "1997-10-10T09:00:00-04:00",
72 "1997-10-11T09:00:00-04:00",
73 "1997-10-12T09:00:00-04:00",
74 "1997-10-13T09:00:00-04:00",
75 "1997-10-14T09:00:00-04:00",
76 "1997-10-15T09:00:00-04:00",
77 "1997-10-16T09:00:00-04:00",
78 "1997-10-17T09:00:00-04:00",
79 "1997-10-18T09:00:00-04:00",
80 "1997-10-19T09:00:00-04:00",
81 "1997-10-20T09:00:00-04:00",
82 "1997-10-21T09:00:00-04:00",
83 "1997-10-22T09:00:00-04:00",
84 "1997-10-23T09:00:00-04:00",
85 "1997-10-24T09:00:00-04:00",
86 "1997-10-25T09:00:00-04:00",
87 // Daylight saving time change
88 "1997-10-26T09:00:00-05:00",
89 "1997-10-27T09:00:00-05:00",
90 "1997-10-28T09:00:00-05:00",
91 "1997-10-29T09:00:00-05:00",
92 "1997-10-30T09:00:00-05:00",
93 "1997-10-31T09:00:00-05:00",
94 // November
95 "1997-11-01T09:00:00-05:00",
96 "1997-11-02T09:00:00-05:00",
97 ],
98 );
99 }
100
101 /// Every other day - forever
102 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
103 fn every_other_dayrust-analyzer cargo rrule 0.14.0 tests/rfc_tests/every_other_day().() {
104 let dates = "DTSTART;TZID=America/New_York:19970902T090000\n\
105 RRULE:FREQ=DAILY;INTERVAL=2"
106 .parserust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]parse().::<RRuleSetrust-analyzer cargo rrule 0.14.0 core/rruleset/RRuleSet#>()
107 .unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().()
108 .allrust-analyzer cargo rrule 0.14.0 core/rruleset/impl#[RRuleSet]all().(32)
109 .datesrust-analyzer cargo rrule 0.14.0 core/rruleset/RRuleResult#dates.;
110 commonrust-analyzer cargo rrule 0.14.0 tests/common/::check_occurrencesrust-analyzer cargo rrule 0.14.0 tests/common/check_occurrences().(
111 &dates,
112 &[
113 "1997-09-02T09:00:00-04:00",
114 "1997-09-04T09:00:00-04:00",
115 "1997-09-06T09:00:00-04:00",
116 "1997-09-08T09:00:00-04:00",
117 "1997-09-10T09:00:00-04:00",
118 "1997-09-12T09:00:00-04:00",
119 "1997-09-14T09:00:00-04:00",
120 "1997-09-16T09:00:00-04:00",
121 "1997-09-18T09:00:00-04:00",
122 "1997-09-20T09:00:00-04:00",
123 "1997-09-22T09:00:00-04:00",
124 "1997-09-24T09:00:00-04:00",
125 "1997-09-26T09:00:00-04:00",
126 "1997-09-28T09:00:00-04:00",
127 "1997-09-30T09:00:00-04:00",
128 "1997-10-02T09:00:00-04:00",
129 "1997-10-04T09:00:00-04:00",
130 "1997-10-06T09:00:00-04:00",
131 "1997-10-08T09:00:00-04:00",
132 "1997-10-10T09:00:00-04:00",
133 "1997-10-12T09:00:00-04:00",
134 "1997-10-14T09:00:00-04:00",
135 "1997-10-16T09:00:00-04:00",
136 "1997-10-18T09:00:00-04:00",
137 "1997-10-20T09:00:00-04:00",
138 "1997-10-22T09:00:00-04:00",
139 "1997-10-24T09:00:00-04:00",
140 "1997-10-26T09:00:00-05:00",
141 "1997-10-28T09:00:00-05:00",
142 "1997-10-30T09:00:00-05:00",
143 "1997-11-01T09:00:00-05:00",
144 "1997-11-03T09:00:00-05:00",
145 ],
146 );
147 }
148
149 /// Every 10 days, 5 occurrences
150 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
151 fn every_10_days_5_occurrencesrust-analyzer cargo rrule 0.14.0 tests/rfc_tests/every_10_days_5_occurrences().() {
152 let dates = "DTSTART;TZID=America/New_York:19970902T090000\n\
153 RRULE:FREQ=DAILY;INTERVAL=10;COUNT=5"
154 .parserust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]parse().::<RRuleSetrust-analyzer cargo rrule 0.14.0 core/rruleset/RRuleSet#>()
155 .unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().()
156 .allrust-analyzer cargo rrule 0.14.0 core/rruleset/impl#[RRuleSet]all().(u16::MAXrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[u16]MAX.)
157 .datesrust-analyzer cargo rrule 0.14.0 core/rruleset/RRuleResult#dates.;
158 commonrust-analyzer cargo rrule 0.14.0 tests/common/::check_occurrencesrust-analyzer cargo rrule 0.14.0 tests/common/check_occurrences().(
159 &dates,
160 &[
161 "1997-09-02T09:00:00-04:00",
162 "1997-09-12T09:00:00-04:00",
163 "1997-09-22T09:00:00-04:00",
164 "1997-10-02T09:00:00-04:00",
165 "1997-10-12T09:00:00-04:00",
166 ],
167 );
168 }
169
170 /// Every day in January, for 3 years
171 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
172 fn every_days_in_jan_for_3_yearsrust-analyzer cargo rrule 0.14.0 tests/rfc_tests/every_days_in_jan_for_3_years().() {
173 // To patterns that have the same result
174 let dates = "DTSTART;TZID=America/New_York:19980101T090000\n\
175 RRULE:FREQ=YEARLY;UNTIL=20000131T140000Z;BYMONTH=1;BYDAY=SU,MO,TU,WE,TH,FR,SA"
176 .parserust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]parse().::<RRuleSetrust-analyzer cargo rrule 0.14.0 core/rruleset/RRuleSet#>()
177 .unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().()
178 .allrust-analyzer cargo rrule 0.14.0 core/rruleset/impl#[RRuleSet]all().(100)
179 .datesrust-analyzer cargo rrule 0.14.0 core/rruleset/RRuleResult#dates.;
180 let dates_alt = "DTSTART;TZID=America/New_York:19980101T090000\n\
181 RRULE:FREQ=DAILY;UNTIL=20000131T140000Z;BYMONTH=1"
182 .parserust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]parse().::<RRuleSetrust-analyzer cargo rrule 0.14.0 core/rruleset/RRuleSet#>()
183 .unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().()
184 .allrust-analyzer cargo rrule 0.14.0 core/rruleset/impl#[RRuleSet]all().(100)
185 .datesrust-analyzer cargo rrule 0.14.0 core/rruleset/RRuleResult#dates.;
186 let mut expected = vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![];
187 for year in 1998..=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeInclusive#2000 {
188 for day in 1..=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeInclusive#31 {
189 expected.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().(formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("{}-01-{:02}T09:00:00-05:00", year, day));
190 }
191 }
192 commonrust-analyzer cargo rrule 0.14.0 tests/common/::check_occurrencesrust-analyzer cargo rrule 0.14.0 tests/common/check_occurrences().(&dates, &expected);
193 commonrust-analyzer cargo rrule 0.14.0 tests/common/::check_occurrencesrust-analyzer cargo rrule 0.14.0 tests/common/check_occurrences().(&dates_alt, &expected);
194 }
195
196 // ------------------------------------------ Weekly ---------------------------------------------
197
198 /// Weekly for 10 occurrences
199 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
200 fn weekly_10_occurrencesrust-analyzer cargo rrule 0.14.0 tests/rfc_tests/weekly_10_occurrences().() {
201 let dates = "DTSTART;TZID=America/New_York:19970902T090000\n\
202 RRULE:FREQ=WEEKLY;COUNT=10"
203 .parserust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]parse().::<RRuleSetrust-analyzer cargo rrule 0.14.0 core/rruleset/RRuleSet#>()
204 .unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().()
205 .allrust-analyzer cargo rrule 0.14.0 core/rruleset/impl#[RRuleSet]all().(u16::MAXrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[u16]MAX.)
206 .datesrust-analyzer cargo rrule 0.14.0 core/rruleset/RRuleResult#dates.;
207 commonrust-analyzer cargo rrule 0.14.0 tests/common/::check_occurrencesrust-analyzer cargo rrule 0.14.0 tests/common/check_occurrences().(
208 &dates,
209 &[
210 "1997-09-02T09:00:00-04:00",
211 "1997-09-09T09:00:00-04:00",
212 "1997-09-16T09:00:00-04:00",
213 "1997-09-23T09:00:00-04:00",
214 "1997-09-30T09:00:00-04:00",
215 "1997-10-07T09:00:00-04:00",
216 "1997-10-14T09:00:00-04:00",
217 "1997-10-21T09:00:00-04:00",
218 "1997-10-28T09:00:00-05:00",
219 "1997-11-04T09:00:00-05:00",
220 ],
221 );
222 }
223
224 /// Weekly until November 03, 1997
225 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
226 fn weekly_until_novemberrust-analyzer cargo rrule 0.14.0 tests/rfc_tests/weekly_until_november().() {
227 // This has been changes to make it shorter, so it is not too long.
228 // From september-november
229 let dates = "DTSTART;TZID=America/New_York:19970923T090000\n\
230 RRULE:FREQ=WEEKLY;UNTIL=19971105T000000Z"
231 .parserust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]parse().::<RRuleSetrust-analyzer cargo rrule 0.14.0 core/rruleset/RRuleSet#>()
232 .unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().()
233 .allrust-analyzer cargo rrule 0.14.0 core/rruleset/impl#[RRuleSet]all().(u16::MAXrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[u16]MAX.)
234 .datesrust-analyzer cargo rrule 0.14.0 core/rruleset/RRuleResult#dates.;
235 commonrust-analyzer cargo rrule 0.14.0 tests/common/::check_occurrencesrust-analyzer cargo rrule 0.14.0 tests/common/check_occurrences().(
236 &dates,
237 &[
238 // September
239 "1997-09-23T09:00:00-04:00",
240 "1997-09-30T09:00:00-04:00",
241 // October
242 "1997-10-07T09:00:00-04:00",
243 "1997-10-14T09:00:00-04:00",
244 "1997-10-21T09:00:00-04:00",
245 // Daylight saving time change
246 "1997-10-28T09:00:00-05:00",
247 // November
248 "1997-11-04T09:00:00-05:00",
249 ],
250 );
251 }
252
253 /// Every other week - forever
254 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
255 fn every_other_weekrust-analyzer cargo rrule 0.14.0 tests/rfc_tests/every_other_week().() {
256 let dates = "DTSTART;TZID=America/New_York:19970902T090000\n\
257 RRULE:FREQ=WEEKLY;INTERVAL=2;WKST=SU"
258 .parserust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]parse().::<RRuleSetrust-analyzer cargo rrule 0.14.0 core/rruleset/RRuleSet#>()
259 .unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().()
260 .allrust-analyzer cargo rrule 0.14.0 core/rruleset/impl#[RRuleSet]all().(13)
261 .datesrust-analyzer cargo rrule 0.14.0 core/rruleset/RRuleResult#dates.;
262 commonrust-analyzer cargo rrule 0.14.0 tests/common/::check_occurrencesrust-analyzer cargo rrule 0.14.0 tests/common/check_occurrences().(
263 &dates,
264 &[
265 "1997-09-02T09:00:00-04:00",
266 "1997-09-16T09:00:00-04:00",
267 "1997-09-30T09:00:00-04:00",
268 "1997-10-14T09:00:00-04:00",
269 "1997-10-28T09:00:00-05:00",
270 "1997-11-11T09:00:00-05:00",
271 "1997-11-25T09:00:00-05:00",
272 "1997-12-09T09:00:00-05:00",
273 "1997-12-23T09:00:00-05:00",
274 "1998-01-06T09:00:00-05:00",
275 "1998-01-20T09:00:00-05:00",
276 "1998-02-03T09:00:00-05:00",
277 "1998-02-17T09:00:00-05:00",
278 ],
279 );
280 }
281
282 /// Weekly on Tuesday and Thursday for five weeks
283 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
284 fn weekly_on_tue_and_thu_for_5_weeksrust-analyzer cargo rrule 0.14.0 tests/rfc_tests/weekly_on_tue_and_thu_for_5_weeks().() {
285 let dates = "DTSTART;TZID=America/New_York:19970902T090000\n\
286 RRULE:FREQ=WEEKLY;UNTIL=19971007T000000Z;WKST=SU;BYDAY=TU,TH"
287 .parserust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]parse().::<RRuleSetrust-analyzer cargo rrule 0.14.0 core/rruleset/RRuleSet#>()
288 .unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().()
289 .allrust-analyzer cargo rrule 0.14.0 core/rruleset/impl#[RRuleSet]all().(u16::MAXrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[u16]MAX.)
290 .datesrust-analyzer cargo rrule 0.14.0 core/rruleset/RRuleResult#dates.;
291 let dates_alt = "DTSTART;TZID=America/New_York:19970902T090000\n\
292 RRULE:FREQ=WEEKLY;COUNT=10;WKST=SU;BYDAY=TU,TH"
293 .parserust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]parse().::<RRuleSetrust-analyzer cargo rrule 0.14.0 core/rruleset/RRuleSet#>()
294 .unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().()
295 .allrust-analyzer cargo rrule 0.14.0 core/rruleset/impl#[RRuleSet]all().(u16::MAXrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[u16]MAX.)
296 .datesrust-analyzer cargo rrule 0.14.0 core/rruleset/RRuleResult#dates.;
297 let expected = vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![
298 "1997-09-02T09:00:00-04:00",
299 "1997-09-04T09:00:00-04:00",
300 "1997-09-09T09:00:00-04:00",
301 "1997-09-11T09:00:00-04:00",
302 "1997-09-16T09:00:00-04:00",
303 "1997-09-18T09:00:00-04:00",
304 "1997-09-23T09:00:00-04:00",
305 "1997-09-25T09:00:00-04:00",
306 "1997-09-30T09:00:00-04:00",
307 "1997-10-02T09:00:00-04:00",
308 ];
309 commonrust-analyzer cargo rrule 0.14.0 tests/common/::check_occurrencesrust-analyzer cargo rrule 0.14.0 tests/common/check_occurrences().(&dates, &expected);
310 commonrust-analyzer cargo rrule 0.14.0 tests/common/::check_occurrencesrust-analyzer cargo rrule 0.14.0 tests/common/check_occurrences().(&dates_alt, &expected);
311 }
312
313 /// Every other week on Monday, Wednesday, and Friday until December 24, 1997,
314 /// starting on Monday, September 1, 1997
315 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
316 fn every_other_week_some_days_until_decrust-analyzer cargo rrule 0.14.0 tests/rfc_tests/every_other_week_some_days_until_dec().() {
317 let dates = "DTSTART;TZID=America/New_York:19970901T090000\n\
318 RRULE:FREQ=WEEKLY;INTERVAL=2;UNTIL=19971224T000000Z;WKST=SU;BYDAY=MO,WE,FR"
319 .parserust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]parse().::<RRuleSetrust-analyzer cargo rrule 0.14.0 core/rruleset/RRuleSet#>()
320 .unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().()
321 .allrust-analyzer cargo rrule 0.14.0 core/rruleset/impl#[RRuleSet]all().(u16::MAXrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[u16]MAX.)
322 .datesrust-analyzer cargo rrule 0.14.0 core/rruleset/RRuleResult#dates.;
323 commonrust-analyzer cargo rrule 0.14.0 tests/common/::check_occurrencesrust-analyzer cargo rrule 0.14.0 tests/common/check_occurrences().(
324 &dates,
325 &[
326 "1997-09-01T09:00:00-04:00",
327 "1997-09-03T09:00:00-04:00",
328 "1997-09-05T09:00:00-04:00",
329 "1997-09-15T09:00:00-04:00",
330 "1997-09-17T09:00:00-04:00",
331 "1997-09-19T09:00:00-04:00",
332 "1997-09-29T09:00:00-04:00",
333 "1997-10-01T09:00:00-04:00",
334 "1997-10-03T09:00:00-04:00",
335 "1997-10-13T09:00:00-04:00",
336 "1997-10-15T09:00:00-04:00",
337 "1997-10-17T09:00:00-04:00",
338 "1997-10-27T09:00:00-05:00",
339 "1997-10-29T09:00:00-05:00",
340 "1997-10-31T09:00:00-05:00",
341 "1997-11-10T09:00:00-05:00",
342 "1997-11-12T09:00:00-05:00",
343 "1997-11-14T09:00:00-05:00",
344 "1997-11-24T09:00:00-05:00",
345 "1997-11-26T09:00:00-05:00",
346 "1997-11-28T09:00:00-05:00",
347 "1997-12-08T09:00:00-05:00",
348 "1997-12-10T09:00:00-05:00",
349 "1997-12-12T09:00:00-05:00",
350 "1997-12-22T09:00:00-05:00",
351 ],
352 );
353 }
354
355 /// Every other week on Tuesday and Thursday, for 8 occurrences
356 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
357 fn every_other_week_some_days_8_occurrencesrust-analyzer cargo rrule 0.14.0 tests/rfc_tests/every_other_week_some_days_8_occurrences().() {
358 let dates = "DTSTART;TZID=America/New_York:19970902T090000\n\
359 RRULE:FREQ=WEEKLY;INTERVAL=2;COUNT=8;WKST=SU;BYDAY=TU,TH"
360 .parserust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]parse().::<RRuleSetrust-analyzer cargo rrule 0.14.0 core/rruleset/RRuleSet#>()
361 .unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().()
362 .allrust-analyzer cargo rrule 0.14.0 core/rruleset/impl#[RRuleSet]all().(u16::MAXrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[u16]MAX.)
363 .datesrust-analyzer cargo rrule 0.14.0 core/rruleset/RRuleResult#dates.;
364 commonrust-analyzer cargo rrule 0.14.0 tests/common/::check_occurrencesrust-analyzer cargo rrule 0.14.0 tests/common/check_occurrences().(
365 &dates,
366 &[
367 "1997-09-02T09:00:00-04:00",
368 "1997-09-04T09:00:00-04:00",
369 "1997-09-16T09:00:00-04:00",
370 "1997-09-18T09:00:00-04:00",
371 "1997-09-30T09:00:00-04:00",
372 "1997-10-02T09:00:00-04:00",
373 "1997-10-14T09:00:00-04:00",
374 "1997-10-16T09:00:00-04:00",
375 ],
376 );
377 }
378
379 // ------------------------------------------ Monthly ---------------------------------------------
380
381 /// Monthly on the first Friday for 10 occurrences
382 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
383 fn monthly_on_first_friday_10_occurrencesrust-analyzer cargo rrule 0.14.0 tests/rfc_tests/monthly_on_first_friday_10_occurrences().() {
384 let dates = "DTSTART;TZID=America/New_York:19970905T090000\n\
385 RRULE:FREQ=MONTHLY;COUNT=10;BYDAY=1FR"
386 .parserust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]parse().::<RRuleSetrust-analyzer cargo rrule 0.14.0 core/rruleset/RRuleSet#>()
387 .unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().()
388 .allrust-analyzer cargo rrule 0.14.0 core/rruleset/impl#[RRuleSet]all().(u16::MAXrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[u16]MAX.)
389 .datesrust-analyzer cargo rrule 0.14.0 core/rruleset/RRuleResult#dates.;
390 commonrust-analyzer cargo rrule 0.14.0 tests/common/::check_occurrencesrust-analyzer cargo rrule 0.14.0 tests/common/check_occurrences().(
391 &dates,
392 &[
393 "1997-09-05T09:00:00-04:00",
394 "1997-10-03T09:00:00-04:00",
395 "1997-11-07T09:00:00-05:00",
396 "1997-12-05T09:00:00-05:00",
397 "1998-01-02T09:00:00-05:00",
398 "1998-02-06T09:00:00-05:00",
399 "1998-03-06T09:00:00-05:00",
400 "1998-04-03T09:00:00-05:00",
401 "1998-05-01T09:00:00-04:00",
402 "1998-06-05T09:00:00-04:00",
403 ],
404 );
405 }
406
407 /// Monthly on the first Friday until December 24, 1997
408 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
409 fn monthly_on_first_friday_until_decrust-analyzer cargo rrule 0.14.0 tests/rfc_tests/monthly_on_first_friday_until_dec().() {
410 let dates = "DTSTART;TZID=America/New_York:19970905T090000\n\
411 RRULE:FREQ=MONTHLY;UNTIL=19971224T000000Z;BYDAY=1FR"
412 .parserust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]parse().::<RRuleSetrust-analyzer cargo rrule 0.14.0 core/rruleset/RRuleSet#>()
413 .unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().()
414 .allrust-analyzer cargo rrule 0.14.0 core/rruleset/impl#[RRuleSet]all().(u16::MAXrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[u16]MAX.)
415 .datesrust-analyzer cargo rrule 0.14.0 core/rruleset/RRuleResult#dates.;
416 commonrust-analyzer cargo rrule 0.14.0 tests/common/::check_occurrencesrust-analyzer cargo rrule 0.14.0 tests/common/check_occurrences().(
417 &dates,
418 &[
419 "1997-09-05T09:00:00-04:00",
420 "1997-10-03T09:00:00-04:00",
421 "1997-11-07T09:00:00-05:00",
422 "1997-12-05T09:00:00-05:00",
423 ],
424 );
425 }
426
427 /// Every other month on the first and last Sunday of the month for 10 occurrences
428 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
429 fn every_other_month_on_first_and_last_sunday_10_occurrencesrust-analyzer cargo rrule 0.14.0 tests/rfc_tests/every_other_month_on_first_and_last_sunday_10_occurrences().() {
430 let dates = "DTSTART;TZID=America/New_York:19970907T090000\n\
431 RRULE:FREQ=MONTHLY;INTERVAL=2;COUNT=10;BYDAY=1SU,-1SU"
432 .parserust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]parse().::<RRuleSetrust-analyzer cargo rrule 0.14.0 core/rruleset/RRuleSet#>()
433 .unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().()
434 .allrust-analyzer cargo rrule 0.14.0 core/rruleset/impl#[RRuleSet]all().(u16::MAXrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[u16]MAX.)
435 .datesrust-analyzer cargo rrule 0.14.0 core/rruleset/RRuleResult#dates.;
436 commonrust-analyzer cargo rrule 0.14.0 tests/common/::check_occurrencesrust-analyzer cargo rrule 0.14.0 tests/common/check_occurrences().(
437 &dates,
438 &[
439 "1997-09-07T09:00:00-04:00",
440 "1997-09-28T09:00:00-04:00",
441 "1997-11-02T09:00:00-05:00",
442 "1997-11-30T09:00:00-05:00",
443 "1998-01-04T09:00:00-05:00",
444 "1998-01-25T09:00:00-05:00",
445 "1998-03-01T09:00:00-05:00",
446 "1998-03-29T09:00:00-05:00",
447 "1998-05-03T09:00:00-04:00",
448 "1998-05-31T09:00:00-04:00",
449 ],
450 );
451 }
452
453 /// Monthly on the second-to-last Monday of the month for 6 months
454 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
455 fn monthly_on_second_to_last_monday_for_6_monthsrust-analyzer cargo rrule 0.14.0 tests/rfc_tests/monthly_on_second_to_last_monday_for_6_months().() {
456 let dates = "DTSTART;TZID=America/New_York:19970922T090000\n\
457 RRULE:FREQ=MONTHLY;COUNT=6;BYDAY=-2MO"
458 .parserust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]parse().::<RRuleSetrust-analyzer cargo rrule 0.14.0 core/rruleset/RRuleSet#>()
459 .unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().()
460 .allrust-analyzer cargo rrule 0.14.0 core/rruleset/impl#[RRuleSet]all().(u16::MAXrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[u16]MAX.)
461 .datesrust-analyzer cargo rrule 0.14.0 core/rruleset/RRuleResult#dates.;
462 commonrust-analyzer cargo rrule 0.14.0 tests/common/::check_occurrencesrust-analyzer cargo rrule 0.14.0 tests/common/check_occurrences().(
463 &dates,
464 &[
465 "1997-09-22T09:00:00-04:00",
466 "1997-10-20T09:00:00-04:00",
467 "1997-11-17T09:00:00-05:00",
468 "1997-12-22T09:00:00-05:00",
469 "1998-01-19T09:00:00-05:00",
470 "1998-02-16T09:00:00-05:00",
471 ],
472 );
473 }
474
475 /// Monthly on the third-to-the-last day of the month, forever
476 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
477 fn monthly_on_third_to_last_day_foreverrust-analyzer cargo rrule 0.14.0 tests/rfc_tests/monthly_on_third_to_last_day_forever().() {
478 let dates = "DTSTART;TZID=America/New_York:19970928T090000\n\
479 RRULE:FREQ=MONTHLY;BYMONTHDAY=-3"
480 .parserust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]parse().::<RRuleSetrust-analyzer cargo rrule 0.14.0 core/rruleset/RRuleSet#>()
481 .unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().()
482 .allrust-analyzer cargo rrule 0.14.0 core/rruleset/impl#[RRuleSet]all().(6)
483 .datesrust-analyzer cargo rrule 0.14.0 core/rruleset/RRuleResult#dates.;
484 commonrust-analyzer cargo rrule 0.14.0 tests/common/::check_occurrencesrust-analyzer cargo rrule 0.14.0 tests/common/check_occurrences().(
485 &dates,
486 &[
487 "1997-09-28T09:00:00-04:00",
488 "1997-10-29T09:00:00-05:00",
489 "1997-11-28T09:00:00-05:00",
490 "1997-12-29T09:00:00-05:00",
491 "1998-01-29T09:00:00-05:00",
492 "1998-02-26T09:00:00-05:00",
493 ],
494 );
495 }
496
497 /// Monthly on the 2nd and 15th of the month for 10 occurrences
498 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
499 fn monthly_on_2nd_and_15th_10_occurrencesrust-analyzer cargo rrule 0.14.0 tests/rfc_tests/monthly_on_2nd_and_15th_10_occurrences().() {
500 let dates = "DTSTART;TZID=America/New_York:19970902T090000\n\
501 RRULE:FREQ=MONTHLY;COUNT=10;BYMONTHDAY=2,15"
502 .parserust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]parse().::<RRuleSetrust-analyzer cargo rrule 0.14.0 core/rruleset/RRuleSet#>()
503 .unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().()
504 .allrust-analyzer cargo rrule 0.14.0 core/rruleset/impl#[RRuleSet]all().(u16::MAXrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[u16]MAX.)
505 .datesrust-analyzer cargo rrule 0.14.0 core/rruleset/RRuleResult#dates.;
506 commonrust-analyzer cargo rrule 0.14.0 tests/common/::check_occurrencesrust-analyzer cargo rrule 0.14.0 tests/common/check_occurrences().(
507 &dates,
508 &[
509 "1997-09-02T09:00:00-04:00",
510 "1997-09-15T09:00:00-04:00",
511 "1997-10-02T09:00:00-04:00",
512 "1997-10-15T09:00:00-04:00",
513 "1997-11-02T09:00:00-05:00",
514 "1997-11-15T09:00:00-05:00",
515 "1997-12-02T09:00:00-05:00",
516 "1997-12-15T09:00:00-05:00",
517 "1998-01-02T09:00:00-05:00",
518 "1998-01-15T09:00:00-05:00",
519 ],
520 );
521 }
522
523 /// Monthly on the first and last day of the month for 10 occurrences
524 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
525 fn monthly_on_first_and_last_day_10_occurrencesrust-analyzer cargo rrule 0.14.0 tests/rfc_tests/monthly_on_first_and_last_day_10_occurrences().() {
526 let dates = "DTSTART;TZID=America/New_York:19970930T090000\n\
527 RRULE:FREQ=MONTHLY;COUNT=10;BYMONTHDAY=1,-1"
528 .parserust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]parse().::<RRuleSetrust-analyzer cargo rrule 0.14.0 core/rruleset/RRuleSet#>()
529 .unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().()
530 .allrust-analyzer cargo rrule 0.14.0 core/rruleset/impl#[RRuleSet]all().(u16::MAXrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[u16]MAX.)
531 .datesrust-analyzer cargo rrule 0.14.0 core/rruleset/RRuleResult#dates.;
532 commonrust-analyzer cargo rrule 0.14.0 tests/common/::check_occurrencesrust-analyzer cargo rrule 0.14.0 tests/common/check_occurrences().(
533 &dates,
534 &[
535 "1997-09-30T09:00:00-04:00",
536 "1997-10-01T09:00:00-04:00",
537 "1997-10-31T09:00:00-05:00",
538 "1997-11-01T09:00:00-05:00",
539 "1997-11-30T09:00:00-05:00",
540 "1997-12-01T09:00:00-05:00",
541 "1997-12-31T09:00:00-05:00",
542 "1998-01-01T09:00:00-05:00",
543 "1998-01-31T09:00:00-05:00",
544 "1998-02-01T09:00:00-05:00",
545 ],
546 );
547 }
548
549 /// Every 18 months on the 10th through 15th of the month for 10 occurrences
550 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
551 fn every_18_months_10th_to_15th_10_occurrencesrust-analyzer cargo rrule 0.14.0 tests/rfc_tests/every_18_months_10th_to_15th_10_occurrences().() {
552 let dates = "DTSTART;TZID=America/New_York:19970910T090000\n\
553 RRULE:FREQ=MONTHLY;INTERVAL=18;COUNT=10;BYMONTHDAY=10,11,12,13,14,15"
554 .parserust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]parse().::<RRuleSetrust-analyzer cargo rrule 0.14.0 core/rruleset/RRuleSet#>()
555 .unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().()
556 .allrust-analyzer cargo rrule 0.14.0 core/rruleset/impl#[RRuleSet]all().(u16::MAXrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[u16]MAX.)
557 .datesrust-analyzer cargo rrule 0.14.0 core/rruleset/RRuleResult#dates.;
558 commonrust-analyzer cargo rrule 0.14.0 tests/common/::check_occurrencesrust-analyzer cargo rrule 0.14.0 tests/common/check_occurrences().(
559 &dates,
560 &[
561 "1997-09-10T09:00:00-04:00",
562 "1997-09-11T09:00:00-04:00",
563 "1997-09-12T09:00:00-04:00",
564 "1997-09-13T09:00:00-04:00",
565 "1997-09-14T09:00:00-04:00",
566 "1997-09-15T09:00:00-04:00",
567 "1999-03-10T09:00:00-05:00",
568 "1999-03-11T09:00:00-05:00",
569 "1999-03-12T09:00:00-05:00",
570 "1999-03-13T09:00:00-05:00",
571 ],
572 );
573 }
574
575 /// Every Tuesday, every other month
576 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
577 fn every_tuesday_every_other_monthrust-analyzer cargo rrule 0.14.0 tests/rfc_tests/every_tuesday_every_other_month().() {
578 let dates = "DTSTART;TZID=America/New_York:19970902T090000\n\
579 RRULE:FREQ=MONTHLY;INTERVAL=2;BYDAY=TU"
580 .parserust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]parse().::<RRuleSetrust-analyzer cargo rrule 0.14.0 core/rruleset/RRuleSet#>()
581 .unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().()
582 .allrust-analyzer cargo rrule 0.14.0 core/rruleset/impl#[RRuleSet]all().(18)
583 .datesrust-analyzer cargo rrule 0.14.0 core/rruleset/RRuleResult#dates.;
584 commonrust-analyzer cargo rrule 0.14.0 tests/common/::check_occurrencesrust-analyzer cargo rrule 0.14.0 tests/common/check_occurrences().(
585 &dates,
586 &[
587 "1997-09-02T09:00:00-04:00",
588 "1997-09-09T09:00:00-04:00",
589 "1997-09-16T09:00:00-04:00",
590 "1997-09-23T09:00:00-04:00",
591 "1997-09-30T09:00:00-04:00",
592 "1997-11-04T09:00:00-05:00",
593 "1997-11-11T09:00:00-05:00",
594 "1997-11-18T09:00:00-05:00",
595 "1997-11-25T09:00:00-05:00",
596 "1998-01-06T09:00:00-05:00",
597 "1998-01-13T09:00:00-05:00",
598 "1998-01-20T09:00:00-05:00",
599 "1998-01-27T09:00:00-05:00",
600 "1998-03-03T09:00:00-05:00",
601 "1998-03-10T09:00:00-05:00",
602 "1998-03-17T09:00:00-05:00",
603 "1998-03-24T09:00:00-05:00",
604 "1998-03-31T09:00:00-05:00",
605 ],
606 );
607 }
608
609 // ------------------------------------------ Yearly ---------------------------------------------
610
611 /// Yearly in June and July for 10 occurrences
612 ///
613 /// Note: Since none of the BYDAY, BYMONTHDAY, or BYYEARDAY components are specified,
614 /// the day is gotten from "DTSTART".
615 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
616 fn yearly_in_june_and_july_for_10_occurrencesrust-analyzer cargo rrule 0.14.0 tests/rfc_tests/yearly_in_june_and_july_for_10_occurrences().() {
617 let dates = "DTSTART;TZID=America/New_York:19970610T090000\n\
618 RRULE:FREQ=YEARLY;COUNT=10;BYMONTH=6,7"
619 .parserust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]parse().::<RRuleSetrust-analyzer cargo rrule 0.14.0 core/rruleset/RRuleSet#>()
620 .unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().()
621 .allrust-analyzer cargo rrule 0.14.0 core/rruleset/impl#[RRuleSet]all().(u16::MAXrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[u16]MAX.)
622 .datesrust-analyzer cargo rrule 0.14.0 core/rruleset/RRuleResult#dates.;
623 commonrust-analyzer cargo rrule 0.14.0 tests/common/::check_occurrencesrust-analyzer cargo rrule 0.14.0 tests/common/check_occurrences().(
624 &dates,
625 &[
626 "1997-06-10T09:00:00-04:00",
627 "1997-07-10T09:00:00-04:00",
628 "1998-06-10T09:00:00-04:00",
629 "1998-07-10T09:00:00-04:00",
630 "1999-06-10T09:00:00-04:00",
631 "1999-07-10T09:00:00-04:00",
632 "2000-06-10T09:00:00-04:00",
633 "2000-07-10T09:00:00-04:00",
634 "2001-06-10T09:00:00-04:00",
635 "2001-07-10T09:00:00-04:00",
636 ],
637 );
638 }
639
640 /// Every other year on January, February, and March for 10 occurrences
641 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
642 fn every_other_year_on_jan_feb_and_march_for_10_occurrencesrust-analyzer cargo rrule 0.14.0 tests/rfc_tests/every_other_year_on_jan_feb_and_march_for_10_occurrences().() {
643 let dates = "DTSTART;TZID=America/New_York:19970310T090000\n\
644 RRULE:FREQ=YEARLY;INTERVAL=2;COUNT=10;BYMONTH=1,2,3"
645 .parserust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]parse().::<RRuleSetrust-analyzer cargo rrule 0.14.0 core/rruleset/RRuleSet#>()
646 .unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().()
647 .allrust-analyzer cargo rrule 0.14.0 core/rruleset/impl#[RRuleSet]all().(u16::MAXrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[u16]MAX.)
648 .datesrust-analyzer cargo rrule 0.14.0 core/rruleset/RRuleResult#dates.;
649 commonrust-analyzer cargo rrule 0.14.0 tests/common/::check_occurrencesrust-analyzer cargo rrule 0.14.0 tests/common/check_occurrences().(
650 &dates,
651 &[
652 "1997-03-10T09:00:00-05:00",
653 "1999-01-10T09:00:00-05:00",
654 "1999-02-10T09:00:00-05:00",
655 "1999-03-10T09:00:00-05:00",
656 "2001-01-10T09:00:00-05:00",
657 "2001-02-10T09:00:00-05:00",
658 "2001-03-10T09:00:00-05:00",
659 "2003-01-10T09:00:00-05:00",
660 "2003-02-10T09:00:00-05:00",
661 "2003-03-10T09:00:00-05:00",
662 ],
663 );
664 }
665
666 /// Every third year on the 1st, 100th, and 200th day for 10 occurrences
667 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
668 fn every_third_year_on_1st_100th_and_200th_day_for_10_occurrencesrust-analyzer cargo rrule 0.14.0 tests/rfc_tests/every_third_year_on_1st_100th_and_200th_day_for_10_occurrences().() {
669 let dates = "DTSTART;TZID=America/New_York:19970101T090000\n\
670 RRULE:FREQ=YEARLY;INTERVAL=3;COUNT=10;BYYEARDAY=1,100,200"
671 .parserust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]parse().::<RRuleSetrust-analyzer cargo rrule 0.14.0 core/rruleset/RRuleSet#>()
672 .unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().()
673 .allrust-analyzer cargo rrule 0.14.0 core/rruleset/impl#[RRuleSet]all().(u16::MAXrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[u16]MAX.)
674 .datesrust-analyzer cargo rrule 0.14.0 core/rruleset/RRuleResult#dates.;
675 commonrust-analyzer cargo rrule 0.14.0 tests/common/::check_occurrencesrust-analyzer cargo rrule 0.14.0 tests/common/check_occurrences().(
676 &dates,
677 &[
678 "1997-01-01T09:00:00-05:00",
679 "1997-04-10T09:00:00-04:00",
680 "1997-07-19T09:00:00-04:00",
681 "2000-01-01T09:00:00-05:00",
682 "2000-04-09T09:00:00-04:00",
683 "2000-07-18T09:00:00-04:00",
684 "2003-01-01T09:00:00-05:00",
685 "2003-04-10T09:00:00-04:00",
686 "2003-07-19T09:00:00-04:00",
687 "2006-01-01T09:00:00-05:00",
688 ],
689 );
690 }
691
692 /// Every 20th Monday of the year, forever
693 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
694 fn every_20th_monday_of_year_foreverrust-analyzer cargo rrule 0.14.0 tests/rfc_tests/every_20th_monday_of_year_forever().() {
695 let dates = "DTSTART;TZID=America/New_York:19970519T090000\n\
696 RRULE:FREQ=YEARLY;BYDAY=20MO"
697 .parserust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]parse().::<RRuleSetrust-analyzer cargo rrule 0.14.0 core/rruleset/RRuleSet#>()
698 .unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().()
699 .allrust-analyzer cargo rrule 0.14.0 core/rruleset/impl#[RRuleSet]all().(3)
700 .datesrust-analyzer cargo rrule 0.14.0 core/rruleset/RRuleResult#dates.;
701 commonrust-analyzer cargo rrule 0.14.0 tests/common/::check_occurrencesrust-analyzer cargo rrule 0.14.0 tests/common/check_occurrences().(
702 &dates,
703 &[
704 "1997-05-19T09:00:00-04:00",
705 "1998-05-18T09:00:00-04:00",
706 "1999-05-17T09:00:00-04:00",
707 ],
708 );
709 }
710
711 /// Monday of week number 20 (where the default start of the week is Monday), forever
712 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
713 fn monday_of_week_20_foreverrust-analyzer cargo rrule 0.14.0 tests/rfc_tests/monday_of_week_20_forever().() {
714 let dates = "DTSTART;TZID=America/New_York:19970512T090000\n\
715 RRULE:FREQ=YEARLY;BYWEEKNO=20;BYDAY=MO"
716 .parserust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]parse().::<RRuleSetrust-analyzer cargo rrule 0.14.0 core/rruleset/RRuleSet#>()
717 .unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().()
718 .allrust-analyzer cargo rrule 0.14.0 core/rruleset/impl#[RRuleSet]all().(3)
719 .datesrust-analyzer cargo rrule 0.14.0 core/rruleset/RRuleResult#dates.;
720 commonrust-analyzer cargo rrule 0.14.0 tests/common/::check_occurrencesrust-analyzer cargo rrule 0.14.0 tests/common/check_occurrences().(
721 &dates,
722 &[
723 "1997-05-12T09:00:00-04:00",
724 "1998-05-11T09:00:00-04:00",
725 "1999-05-17T09:00:00-04:00",
726 ],
727 );
728 }
729
730 /// Every Thursday in March, forever
731 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
732 fn every_thursday_in_march_foreverrust-analyzer cargo rrule 0.14.0 tests/rfc_tests/every_thursday_in_march_forever().() {
733 let dates = "DTSTART;TZID=America/New_York:19970313T090000\n\
734 RRULE:FREQ=YEARLY;BYMONTH=3;BYDAY=TH"
735 .parserust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]parse().::<RRuleSetrust-analyzer cargo rrule 0.14.0 core/rruleset/RRuleSet#>()
736 .unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().()
737 .allrust-analyzer cargo rrule 0.14.0 core/rruleset/impl#[RRuleSet]all().(11)
738 .datesrust-analyzer cargo rrule 0.14.0 core/rruleset/RRuleResult#dates.;
739 commonrust-analyzer cargo rrule 0.14.0 tests/common/::check_occurrencesrust-analyzer cargo rrule 0.14.0 tests/common/check_occurrences().(
740 &dates,
741 &[
742 "1997-03-13T09:00:00-05:00",
743 "1997-03-20T09:00:00-05:00",
744 "1997-03-27T09:00:00-05:00",
745 "1998-03-05T09:00:00-05:00",
746 "1998-03-12T09:00:00-05:00",
747 "1998-03-19T09:00:00-05:00",
748 "1998-03-26T09:00:00-05:00",
749 "1999-03-04T09:00:00-05:00",
750 "1999-03-11T09:00:00-05:00",
751 "1999-03-18T09:00:00-05:00",
752 "1999-03-25T09:00:00-05:00",
753 ],
754 );
755 }
756
757 /// Every Thursday, but only during June, July, and August, forever
758 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
759 fn every_thursday_only_during_june_july_and_august_foreverrust-analyzer cargo rrule 0.14.0 tests/rfc_tests/every_thursday_only_during_june_july_and_august_forever().() {
760 let dates = "DTSTART;TZID=America/New_York:19970605T090000\n\
761 RRULE:FREQ=YEARLY;BYDAY=TH;BYMONTH=6,7,8"
762 .parserust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]parse().::<RRuleSetrust-analyzer cargo rrule 0.14.0 core/rruleset/RRuleSet#>()
763 .unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().()
764 .allrust-analyzer cargo rrule 0.14.0 core/rruleset/impl#[RRuleSet]all().(39)
765 .datesrust-analyzer cargo rrule 0.14.0 core/rruleset/RRuleResult#dates.;
766 commonrust-analyzer cargo rrule 0.14.0 tests/common/::check_occurrencesrust-analyzer cargo rrule 0.14.0 tests/common/check_occurrences().(
767 &dates,
768 &[
769 "1997-06-05T09:00:00-04:00",
770 "1997-06-12T09:00:00-04:00",
771 "1997-06-19T09:00:00-04:00",
772 "1997-06-26T09:00:00-04:00",
773 "1997-07-03T09:00:00-04:00",
774 "1997-07-10T09:00:00-04:00",
775 "1997-07-17T09:00:00-04:00",
776 "1997-07-24T09:00:00-04:00",
777 "1997-07-31T09:00:00-04:00",
778 "1997-08-07T09:00:00-04:00",
779 "1997-08-14T09:00:00-04:00",
780 "1997-08-21T09:00:00-04:00",
781 "1997-08-28T09:00:00-04:00",
782 "1998-06-04T09:00:00-04:00",
783 "1998-06-11T09:00:00-04:00",
784 "1998-06-18T09:00:00-04:00",
785 "1998-06-25T09:00:00-04:00",
786 "1998-07-02T09:00:00-04:00",
787 "1998-07-09T09:00:00-04:00",
788 "1998-07-16T09:00:00-04:00",
789 "1998-07-23T09:00:00-04:00",
790 "1998-07-30T09:00:00-04:00",
791 "1998-08-06T09:00:00-04:00",
792 "1998-08-13T09:00:00-04:00",
793 "1998-08-20T09:00:00-04:00",
794 "1998-08-27T09:00:00-04:00",
795 "1999-06-03T09:00:00-04:00",
796 "1999-06-10T09:00:00-04:00",
797 "1999-06-17T09:00:00-04:00",
798 "1999-06-24T09:00:00-04:00",
799 "1999-07-01T09:00:00-04:00",
800 "1999-07-08T09:00:00-04:00",
801 "1999-07-15T09:00:00-04:00",
802 "1999-07-22T09:00:00-04:00",
803 "1999-07-29T09:00:00-04:00",
804 "1999-08-05T09:00:00-04:00",
805 "1999-08-12T09:00:00-04:00",
806 "1999-08-19T09:00:00-04:00",
807 "1999-08-26T09:00:00-04:00",
808 ],
809 );
810 }
811
812 /// Every Friday the 13th, forever
813 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
814 fn every_friday_the_13th_foreverrust-analyzer cargo rrule 0.14.0 tests/rfc_tests/every_friday_the_13th_forever().() {
815 let dates = "DTSTART;TZID=America/New_York:19970902T090000\n\
816 EXDATE;TZID=America/New_York:19970902T090000\n\
817 RRULE:FREQ=MONTHLY;BYDAY=FR;BYMONTHDAY=13"
818 .parserust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]parse().::<RRuleSetrust-analyzer cargo rrule 0.14.0 core/rruleset/RRuleSet#>()
819 .unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().()
820 .allrust-analyzer cargo rrule 0.14.0 core/rruleset/impl#[RRuleSet]all().(5)
821 .datesrust-analyzer cargo rrule 0.14.0 core/rruleset/RRuleResult#dates.;
822 commonrust-analyzer cargo rrule 0.14.0 tests/common/::check_occurrencesrust-analyzer cargo rrule 0.14.0 tests/common/check_occurrences().(
823 &dates,
824 &[
825 "1998-02-13T09:00:00-05:00",
826 "1998-03-13T09:00:00-05:00",
827 "1998-11-13T09:00:00-05:00",
828 "1999-08-13T09:00:00-04:00",
829 "2000-10-13T09:00:00-04:00",
830 ],
831 );
832 }
833
834 /// The first Saturday that follows the first Sunday of the month forever
835 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
836 fn first_sat_follows_first_sunday_of_month_foreverrust-analyzer cargo rrule 0.14.0 tests/rfc_tests/first_sat_follows_first_sunday_of_month_forever().() {
837 let dates = "DTSTART;TZID=America/New_York:19970913T090000\n\
838 RRULE:FREQ=MONTHLY;BYDAY=SA;BYMONTHDAY=7,8,9,10,11,12,13"
839 .parserust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]parse().::<RRuleSetrust-analyzer cargo rrule 0.14.0 core/rruleset/RRuleSet#>()
840 .unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().()
841 .allrust-analyzer cargo rrule 0.14.0 core/rruleset/impl#[RRuleSet]all().(10)
842 .datesrust-analyzer cargo rrule 0.14.0 core/rruleset/RRuleResult#dates.;
843 commonrust-analyzer cargo rrule 0.14.0 tests/common/::check_occurrencesrust-analyzer cargo rrule 0.14.0 tests/common/check_occurrences().(
844 &dates,
845 &[
846 "1997-09-13T09:00:00-04:00",
847 "1997-10-11T09:00:00-04:00",
848 "1997-11-08T09:00:00-05:00",
849 "1997-12-13T09:00:00-05:00",
850 "1998-01-10T09:00:00-05:00",
851 "1998-02-07T09:00:00-05:00",
852 "1998-03-07T09:00:00-05:00",
853 "1998-04-11T09:00:00-04:00",
854 "1998-05-09T09:00:00-04:00",
855 "1998-06-13T09:00:00-04:00",
856 ],
857 );
858 }
859
860 /// Every 4 years, the first Tuesday after a Monday in November, forever
861 /// (U.S. Presidential Election day)
862 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
863 fn every_4_years_us_presidential_election_day_foreverrust-analyzer cargo rrule 0.14.0 tests/rfc_tests/every_4_years_us_presidential_election_day_forever().() {
864 let dates = "DTSTART;TZID=America/New_York:19961105T090000\n\
865 RRULE:FREQ=YEARLY;INTERVAL=4;BYMONTH=11;BYDAY=TU;BYMONTHDAY=2,3,4,5,6,7,8"
866 .parserust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]parse().::<RRuleSetrust-analyzer cargo rrule 0.14.0 core/rruleset/RRuleSet#>()
867 .unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().()
868 .allrust-analyzer cargo rrule 0.14.0 core/rruleset/impl#[RRuleSet]all().(3)
869 .datesrust-analyzer cargo rrule 0.14.0 core/rruleset/RRuleResult#dates.;
870 commonrust-analyzer cargo rrule 0.14.0 tests/common/::check_occurrencesrust-analyzer cargo rrule 0.14.0 tests/common/check_occurrences().(
871 &dates,
872 &[
873 "1996-11-05T09:00:00-05:00",
874 "2000-11-07T09:00:00-05:00",
875 "2004-11-02T09:00:00-05:00",
876 ],
877 );
878 }
879
880 /// The third instance into the month of one of Tuesday, Wednesday, or Thursday,
881 /// for the next 3 months
882 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
883 fn every_third_instance_of_weekday_in_month_for_3_monthsrust-analyzer cargo rrule 0.14.0 tests/rfc_tests/every_third_instance_of_weekday_in_month_for_3_months().() {
884 let dates = "DTSTART;TZID=America/New_York:19970904T090000\n\
885 RRULE:FREQ=MONTHLY;COUNT=3;BYDAY=TU,WE,TH;BYSETPOS=3"
886 .parserust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]parse().::<RRuleSetrust-analyzer cargo rrule 0.14.0 core/rruleset/RRuleSet#>()
887 .unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().()
888 .allrust-analyzer cargo rrule 0.14.0 core/rruleset/impl#[RRuleSet]all().(u16::MAXrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[u16]MAX.)
889 .datesrust-analyzer cargo rrule 0.14.0 core/rruleset/RRuleResult#dates.;
890 commonrust-analyzer cargo rrule 0.14.0 tests/common/::check_occurrencesrust-analyzer cargo rrule 0.14.0 tests/common/check_occurrences().(
891 &dates,
892 &[
893 "1997-09-04T09:00:00-04:00",
894 "1997-10-07T09:00:00-04:00",
895 "1997-11-06T09:00:00-05:00",
896 ],
897 );
898 }
899
900 /// The second-to-last weekday of the month
901 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
902 fn second_to_last_weekday_of_monthrust-analyzer cargo rrule 0.14.0 tests/rfc_tests/second_to_last_weekday_of_month().() {
903 let dates = "DTSTART;TZID=America/New_York:19970929T090000\n\
904 RRULE:FREQ=MONTHLY;BYDAY=MO,TU,WE,TH,FR;BYSETPOS=-2"
905 .parserust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]parse().::<RRuleSetrust-analyzer cargo rrule 0.14.0 core/rruleset/RRuleSet#>()
906 .unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().()
907 .allrust-analyzer cargo rrule 0.14.0 core/rruleset/impl#[RRuleSet]all().(7)
908 .datesrust-analyzer cargo rrule 0.14.0 core/rruleset/RRuleResult#dates.;
909 commonrust-analyzer cargo rrule 0.14.0 tests/common/::check_occurrencesrust-analyzer cargo rrule 0.14.0 tests/common/check_occurrences().(
910 &dates,
911 &[
912 "1997-09-29T09:00:00-04:00",
913 "1997-10-30T09:00:00-05:00",
914 "1997-11-27T09:00:00-05:00",
915 "1997-12-30T09:00:00-05:00",
916 "1998-01-29T09:00:00-05:00",
917 "1998-02-26T09:00:00-05:00",
918 "1998-03-30T09:00:00-05:00",
919 ],
920 );
921 }
922
923 /// Every 3 hours from 9:00 AM to 5:00 PM on a specific day
924 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
925 fn every_3_hours_on_specific_dayrust-analyzer cargo rrule 0.14.0 tests/rfc_tests/every_3_hours_on_specific_day().() {
926 // https://www.rfc-editor.org/errata/eid3883
927 let dates = "DTSTART;TZID=America/New_York:19970902T090000\n\
928 RRULE:FREQ=HOURLY;INTERVAL=3;UNTIL=19970902T210000Z"
929 .parserust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]parse().::<RRuleSetrust-analyzer cargo rrule 0.14.0 core/rruleset/RRuleSet#>()
930 .unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().()
931 .allrust-analyzer cargo rrule 0.14.0 core/rruleset/impl#[RRuleSet]all().(u16::MAXrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[u16]MAX.)
932 .datesrust-analyzer cargo rrule 0.14.0 core/rruleset/RRuleResult#dates.;
933 commonrust-analyzer cargo rrule 0.14.0 tests/common/::check_occurrencesrust-analyzer cargo rrule 0.14.0 tests/common/check_occurrences().(
934 &dates,
935 &[
936 "1997-09-02T09:00:00-04:00",
937 "1997-09-02T12:00:00-04:00",
938 "1997-09-02T15:00:00-04:00", // Missing from result
939 ],
940 );
941 }
942
943 /// Every 15 minutes for 6 occurrences
944 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
945 fn every_15_min_for_6_occurrencesrust-analyzer cargo rrule 0.14.0 tests/rfc_tests/every_15_min_for_6_occurrences().() {
946 let dates = "DTSTART;TZID=America/New_York:19970902T090000\n\
947 RRULE:FREQ=MINUTELY;INTERVAL=15;COUNT=6"
948 .parserust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]parse().::<RRuleSetrust-analyzer cargo rrule 0.14.0 core/rruleset/RRuleSet#>()
949 .unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().()
950 .allrust-analyzer cargo rrule 0.14.0 core/rruleset/impl#[RRuleSet]all().(u16::MAXrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[u16]MAX.)
951 .datesrust-analyzer cargo rrule 0.14.0 core/rruleset/RRuleResult#dates.;
952 commonrust-analyzer cargo rrule 0.14.0 tests/common/::check_occurrencesrust-analyzer cargo rrule 0.14.0 tests/common/check_occurrences().(
953 &dates,
954 &[
955 "1997-09-02T09:00:00-04:00",
956 "1997-09-02T09:15:00-04:00",
957 "1997-09-02T09:30:00-04:00",
958 "1997-09-02T09:45:00-04:00",
959 "1997-09-02T10:00:00-04:00",
960 "1997-09-02T10:15:00-04:00",
961 ],
962 );
963 }
964
965 /// Every hour and a half for 4 occurrences
966 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
967 fn every_hour_and_a_half_for_4_occurrencesrust-analyzer cargo rrule 0.14.0 tests/rfc_tests/every_hour_and_a_half_for_4_occurrences().() {
968 let dates = "DTSTART;TZID=America/New_York:19970902T090000\n\
969 RRULE:FREQ=MINUTELY;INTERVAL=90;COUNT=4"
970 .parserust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]parse().::<RRuleSetrust-analyzer cargo rrule 0.14.0 core/rruleset/RRuleSet#>()
971 .unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().()
972 .allrust-analyzer cargo rrule 0.14.0 core/rruleset/impl#[RRuleSet]all().(u16::MAXrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[u16]MAX.)
973 .datesrust-analyzer cargo rrule 0.14.0 core/rruleset/RRuleResult#dates.;
974 commonrust-analyzer cargo rrule 0.14.0 tests/common/::check_occurrencesrust-analyzer cargo rrule 0.14.0 tests/common/check_occurrences().(
975 &dates,
976 &[
977 "1997-09-02T09:00:00-04:00",
978 "1997-09-02T10:30:00-04:00",
979 "1997-09-02T12:00:00-04:00",
980 "1997-09-02T13:30:00-04:00",
981 ],
982 );
983 }
984
985 /// Every 20 minutes from 9:00 AM to 4:40 PM every day
986 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
987 fn every_20_min_at_time_every_dayrust-analyzer cargo rrule 0.14.0 tests/rfc_tests/every_20_min_at_time_every_day().() {
988 let dates = "DTSTART;TZID=America/New_York:19970902T090000\n\
989 RRULE:FREQ=DAILY;BYHOUR=9,10,11,12,13,14,15,16;BYMINUTE=0,20,40"
990 .parserust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]parse().::<RRuleSetrust-analyzer cargo rrule 0.14.0 core/rruleset/RRuleSet#>()
991 .unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().()
992 .allrust-analyzer cargo rrule 0.14.0 core/rruleset/impl#[RRuleSet]all().(72)
993 .datesrust-analyzer cargo rrule 0.14.0 core/rruleset/RRuleResult#dates.;
994 let dates_alt = "DTSTART;TZID=America/New_York:19970902T090000\n\
995 RRULE:FREQ=MINUTELY;INTERVAL=20;BYHOUR=9,10,11,12,13,14,15,16"
996 .parserust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]parse().::<RRuleSetrust-analyzer cargo rrule 0.14.0 core/rruleset/RRuleSet#>()
997 .unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().()
998 .allrust-analyzer cargo rrule 0.14.0 core/rruleset/impl#[RRuleSet]all().(72)
999 .datesrust-analyzer cargo rrule 0.14.0 core/rruleset/RRuleResult#dates.;
1000
1001 let mut expected = vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![];
1002 for day in 2..=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeInclusive#4 {
1003 expected.appendrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]append().(&mut vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![
1004 formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("1997-09-{:02}T09:00:00-04:00", day),
1005 formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("1997-09-{:02}T09:20:00-04:00", day),
1006 formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("1997-09-{:02}T09:40:00-04:00", day),
1007 formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("1997-09-{:02}T10:00:00-04:00", day),
1008 formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("1997-09-{:02}T10:20:00-04:00", day),
1009 formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("1997-09-{:02}T10:40:00-04:00", day),
1010 formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("1997-09-{:02}T11:00:00-04:00", day),
1011 formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("1997-09-{:02}T11:20:00-04:00", day),
1012 formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("1997-09-{:02}T11:40:00-04:00", day),
1013 formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("1997-09-{:02}T12:00:00-04:00", day),
1014 formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("1997-09-{:02}T12:20:00-04:00", day),
1015 formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("1997-09-{:02}T12:40:00-04:00", day),
1016 formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("1997-09-{:02}T13:00:00-04:00", day),
1017 formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("1997-09-{:02}T13:20:00-04:00", day),
1018 formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("1997-09-{:02}T13:40:00-04:00", day),
1019 formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("1997-09-{:02}T14:00:00-04:00", day),
1020 formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("1997-09-{:02}T14:20:00-04:00", day),
1021 formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("1997-09-{:02}T14:40:00-04:00", day),
1022 formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("1997-09-{:02}T15:00:00-04:00", day),
1023 formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("1997-09-{:02}T15:20:00-04:00", day),
1024 formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("1997-09-{:02}T15:40:00-04:00", day),
1025 formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("1997-09-{:02}T16:00:00-04:00", day),
1026 formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("1997-09-{:02}T16:20:00-04:00", day),
1027 formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("1997-09-{:02}T16:40:00-04:00", day),
1028 ]);
1029 }
1030 commonrust-analyzer cargo rrule 0.14.0 tests/common/::check_occurrencesrust-analyzer cargo rrule 0.14.0 tests/common/check_occurrences().(&dates, &expected);
1031 commonrust-analyzer cargo rrule 0.14.0 tests/common/::check_occurrencesrust-analyzer cargo rrule 0.14.0 tests/common/check_occurrences().(&dates_alt, &expected);
1032 }
1033
1034 /// An example where the days generated make a difference because of `WKST` (week start)
1035 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
1036 fn week_day_start_monday_generated_daysrust-analyzer cargo rrule 0.14.0 tests/rfc_tests/week_day_start_monday_generated_days().() {
1037 let dates = "DTSTART;TZID=America/New_York:19970805T090000\n\
1038 RRULE:FREQ=WEEKLY;INTERVAL=2;COUNT=4;BYDAY=TU,SU;WKST=MO"
1039 .parserust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]parse().::<RRuleSetrust-analyzer cargo rrule 0.14.0 core/rruleset/RRuleSet#>()
1040 .unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().()
1041 .allrust-analyzer cargo rrule 0.14.0 core/rruleset/impl#[RRuleSet]all().(u16::MAXrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[u16]MAX.)
1042 .datesrust-analyzer cargo rrule 0.14.0 core/rruleset/RRuleResult#dates.;
1043 commonrust-analyzer cargo rrule 0.14.0 tests/common/::check_occurrencesrust-analyzer cargo rrule 0.14.0 tests/common/check_occurrences().(
1044 &dates,
1045 &[
1046 "1997-08-05T09:00:00-04:00",
1047 "1997-08-10T09:00:00-04:00",
1048 "1997-08-19T09:00:00-04:00",
1049 "1997-08-24T09:00:00-04:00",
1050 ],
1051 );
1052 }
1053
1054 /// Changing only WKST from MO to SU, yields different results...
1055 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
1056 fn week_day_start_sunday_generated_daysrust-analyzer cargo rrule 0.14.0 tests/rfc_tests/week_day_start_sunday_generated_days().() {
1057 let dates = "DTSTART;TZID=America/New_York:19970805T090000\n\
1058 RRULE:FREQ=WEEKLY;INTERVAL=2;COUNT=4;BYDAY=TU,SU;WKST=SU"
1059 .parserust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]parse().::<RRuleSetrust-analyzer cargo rrule 0.14.0 core/rruleset/RRuleSet#>()
1060 .unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().()
1061 .allrust-analyzer cargo rrule 0.14.0 core/rruleset/impl#[RRuleSet]all().(u16::MAXrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[u16]MAX.)
1062 .datesrust-analyzer cargo rrule 0.14.0 core/rruleset/RRuleResult#dates.;
1063 commonrust-analyzer cargo rrule 0.14.0 tests/common/::check_occurrencesrust-analyzer cargo rrule 0.14.0 tests/common/check_occurrences().(
1064 &dates,
1065 &[
1066 "1997-08-05T09:00:00-04:00",
1067 "1997-08-17T09:00:00-04:00",
1068 "1997-08-19T09:00:00-04:00",
1069 "1997-08-31T09:00:00-04:00",
1070 ],
1071 );
1072 }
1073
1074 /// An example where an invalid date (i.e., February 30) is ignored.
1075 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
1076 fn invalid_date_is_ignoredrust-analyzer cargo rrule 0.14.0 tests/rfc_tests/invalid_date_is_ignored().() {
1077 let dates = "DTSTART;TZID=America/New_York:20070115T090000\n\
1078 RRULE:FREQ=MONTHLY;BYMONTHDAY=15,30;COUNT=5"
1079 .parserust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]parse().::<RRuleSetrust-analyzer cargo rrule 0.14.0 core/rruleset/RRuleSet#>()
1080 .unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().()
1081 .allrust-analyzer cargo rrule 0.14.0 core/rruleset/impl#[RRuleSet]all().(u16::MAXrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[u16]MAX.)
1082 .datesrust-analyzer cargo rrule 0.14.0 core/rruleset/RRuleResult#dates.;
1083 commonrust-analyzer cargo rrule 0.14.0 tests/common/::check_occurrencesrust-analyzer cargo rrule 0.14.0 tests/common/check_occurrences().(
1084 &dates,
1085 &[
1086 "2007-01-15T09:00:00-05:00",
1087 "2007-01-30T09:00:00-05:00",
1088 "2007-02-15T09:00:00-05:00",
1089 "2007-03-15T09:00:00-04:00",
1090 "2007-03-30T09:00:00-04:00",
1091 ],
1092 );
1093 }