Skip to content

Commit

Permalink
More tests regarding usage of 'W' with multiple entries in DOM field
Browse files Browse the repository at this point in the history
  • Loading branch information
Kniggebrot committed Oct 22, 2024
1 parent 3989f92 commit f01bb90
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions ccronexpr_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -377,6 +377,19 @@ void test_expr() {
assert(check_next("0 0 1 1,3W * ?", "2022-09-02_00:00:00", "2022-09-02_01:00:00"));
assert(check_next("0 0 1 1,3W * ?", "2022-09-03_00:00:00", "2022-10-01_01:00:00"));
assert(check_next("0 0 1 1,3W * ?", "2022-10-02_00:00:00", "2022-10-03_01:00:00"));
// Check behaviour with more days mixed with W fields
assert(check_next("0 0 1 1,3W,15 * ?", "2022-09-01_00:00:00", "2022-09-01_01:00:00"));
assert(check_next("0 0 1 1,3W,15 * ?", "2022-09-02_00:00:00", "2022-09-02_01:00:00"));
assert(check_next("0 0 1 1,3W,15 * ?", "2022-09-03_00:00:00", "2022-09-15_01:00:00"));
assert(check_next("0 0 1 1,3W,15 * ?", "2022-09-16_00:00:00", "2022-10-01_01:00:00"));
assert(check_next("0 0 1 1,3W,15 * ?", "2022-10-02_00:00:00", "2022-10-03_01:00:00"));
assert(check_next("0 0 1 1,3W,15,16W * ?", "2022-09-01_00:00:00", "2022-09-01_01:00:00"));
assert(check_next("0 0 1 1,3W,15,16W * ?", "2022-09-02_00:00:00", "2022-09-02_01:00:00"));
assert(check_next("0 0 1 1,3W,15,16W * ?", "2022-09-03_00:00:00", "2022-09-15_01:00:00"));
assert(check_next("0 0 1 1,3W,15,16W * ?", "2022-09-16_00:00:00", "2022-09-16_01:00:00"));
assert(check_next("0 0 1 1,3W,15,16W * ?", "2022-09-17_00:00:00", "2022-10-01_01:00:00"));
assert(check_next("0 0 1 1,3W,15,16W * ?", "2022-10-02_00:00:00", "2022-10-03_01:00:00"));
assert(check_next("0 0 1 1,3W,15,16W * ?", "2025-02-16_00:00:00", "2025-02-17_01:00:00"));
assert(check_next("0 0 1 1W,4W * ?", "2022-09-01_00:00:00", "2022-09-01_01:00:00"));
assert(check_next("0 0 1 1W,4W * ?", "2022-09-02_00:00:00", "2022-09-05_01:00:00"));
assert(check_next("0 0 1 1W,4W * ?", "2022-06-03_00:00:00", "2022-06-03_01:00:00"));
Expand Down Expand Up @@ -488,6 +501,9 @@ void test_parse() {
assert(check_same("* * * * 1 *", "* * * * 1 *"));
assert(check_same("* * * * 1 L", "* * * * 1 SUN"));
assert(check_same("* * * * * *", "0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19-59,H 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18-59,H 0,1,2,3,4,5,6,7,8,9,10,11-23,H 1,2,3,4,5,6,7,8,9,10,11,12,13,14-31,H jan,feb,mar,apr,may,jun,jul,aug,sep,oct,nov,dec,H mon,tue,wed,thu,fri,sat,sun,H"));
//assert(check_same("0 0 15 1,16,L * *", "0 0 15 1,L,16 * *"));
//assert(check_expr_valid("0 0 15 1,16,L * *"));
//assert(check_expr_valid("0 0 15 1,L,16 * *"));
// check default hash func has valid output
cron_init_custom_hash_fn(NULL);
assert(check_expr_valid("0 0 1 * * ?"));
Expand Down

0 comments on commit f01bb90

Please sign in to comment.