- commit
- cee0783c737a66ac477878ba3f99c81135de4e2a
- parent
- 6a6734ef105b801114d377508acb612c8de9f6a0
- Author
- Tobias Bengfort <tobias.bengfort@posteo.de>
- Date
- 2023-06-04 12:18
test negative nth_of_month
Diffstat
| M | test.c | 23 | +++++++++++++++++++++++ |
1 files changed, 23 insertions, 0 deletions
diff --git a/test.c b/test.c
@@ -181,6 +181,16 @@ char *test_parse_date_weekday(void) {
181 181 }
182 182
183 183 char *test_parse_date_weekday_with_nth_of_month(void) {
-1 184 struct tpl actual = parse_date_mut("Sat+1");
-1 185 struct tpl expected = mktpl();
-1 186 expected.weekday = 7;
-1 187 expected.nth_of_month = 1;
-1 188
-1 189 mu_assert("Sat+1", tpl_comp(actual, expected));
-1 190 return 0;
-1 191 }
-1 192
-1 193 char *test_parse_date_weekday_with_nth_last_of_month(void) {
184 194 struct tpl actual = parse_date_mut("Sat-1");
185 195 struct tpl expected = mktpl();
186 196 expected.weekday = 7;
@@ -298,6 +308,17 @@ char *test_is_match_weekday_with_nth_of_month(void) {
298 308 return 0;
299 309 }
300 310
-1 311 char *test_is_match_weekday_with_nth_last_of_month(void) {
-1 312 struct tpl tpl = mktpl();
-1 313 tpl.weekday = 7;
-1 314 tpl.nth_of_month = -2;
-1 315
-1 316 mu_assert("date does match", is_match(tpl, mkdate(1999, 2, 20)));
-1 317 mu_assert("next day does not match", !is_match(tpl, mkdate(1999, 2, 21)));
-1 318 mu_assert("one week later does not match", !is_match(tpl, mkdate(1999, 2, 27)));
-1 319 return 0;
-1 320 }
-1 321
301 322 char *test_is_match_mm_weekday(void) {
302 323 struct tpl tpl = mktpl();
303 324 tpl.month = 2;
@@ -381,6 +402,7 @@ int main(int argc, char **argv) {
381 402 mu_test("parses yyyy/mm/dd+n", test_parse_date_yyyymmdd_repeat);
382 403 mu_test("parses weekday", test_parse_date_weekday);
383 404 mu_test("parses weekday+n", test_parse_date_weekday_with_nth_of_month);
-1 405 mu_test("parses weekday-n", test_parse_date_weekday_with_nth_last_of_month);
384 406 mu_test("parses mm/weekday", test_parse_date_mm_weekday);
385 407 mu_test("parses yyyy/mm/weekday", test_parse_date_yyyymm_weekday);
386 408 mu_test("parses easter", test_parse_date_easter);
@@ -393,6 +415,7 @@ int main(int argc, char **argv) {
393 415 mu_test("matches yyyy/mm/dd+n", test_is_match_yyyymmdd_repeat);
394 416 mu_test("matches weekday", test_is_match_weekday);
395 417 mu_test("matches weekday+n", test_is_match_weekday_with_nth_of_month);
-1 418 mu_test("matches weekday-n", test_is_match_weekday_with_nth_last_of_month);
396 419 mu_test("matches mm/weekday", test_is_match_mm_weekday);
397 420 mu_test("matches yyyy/mm/weekday", test_is_match_yyyymm_weekday);
398 421 mu_test("matches easter", test_is_match_easter);