summaryrefslogtreecommitdiff
path: root/src/test
diff options
context:
space:
mode:
authorDouglas Christman <DouglasChristman@gmail.com>2016-11-22 10:05:10 -0500
committerDouglas Christman <DouglasChristman@gmail.com>2016-11-23 12:37:43 -0500
commit8ea803516e4a4265a77d026f740c272cd60107a4 (patch)
tree639382e116b9be3ae51635dcb3bcbcf88c1b3ed4 /src/test
parentf6e7d66b9f1db07ae80af3d75dabaf95f7f43a15 (diff)
calendarspec: add support for scheduling timers at the end of the month
"*-*~1" => The last day of every month "*-02~3..5" => The third, fourth, and fifth last days in February "Mon 05~07/1" => The last Monday in May Resolves #3861
Diffstat (limited to 'src/test')
-rw-r--r--src/test/test-calendarspec.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/test/test-calendarspec.c b/src/test/test-calendarspec.c
index 18e46f2ac4..76f5819bb9 100644
--- a/src/test/test-calendarspec.c
+++ b/src/test/test-calendarspec.c
@@ -176,6 +176,9 @@ int main(int argc, char* argv[]) {
test_one("1..3-1..3 1..3:1..3", "*-01,02,03-01,02,03 01,02,03:01,02,03:00");
test_one("00:00:1.125..2.125", "*-*-* 00:00:01.125000,02.125000");
test_one("00:00:1.0..3.8", "*-*-* 00:00:01,02,03");
+ test_one("*-*~1 Utc", "*-*~01 00:00:00 UTC");
+ test_one("*-*~05,3 ", "*-*~03,05 00:00:00");
+ test_one("*-*~* 00:00:00", "*-*-* 00:00:00");
test_next("2016-03-27 03:17:00", "", 12345, 1459048620000000);
test_next("2016-03-27 03:17:00", "CET", 12345, 1459041420000000);
@@ -191,6 +194,9 @@ int main(int argc, char* argv[]) {
test_next("2015-11-13 09:11:23.42/1.77", "EET", 1447398683419999, 1447398683420000);
test_next("Sun 16:00:00", "CET", 1456041600123456, 1456066800000000);
test_next("*-04-31", "", 12345, -1);
+ test_next("2016-02~01 UTC", "", 12345, 1456704000000000);
+ test_next("Mon 2017-05~01..07 UTC", "", 12345, 1496016000000000);
+ test_next("Mon 2017-05~07/1 UTC", "", 12345, 1496016000000000);
assert_se(calendar_spec_from_string("test", &c) < 0);
assert_se(calendar_spec_from_string("", &c) < 0);
@@ -200,6 +206,8 @@ int main(int argc, char* argv[]) {
assert_se(calendar_spec_from_string("2000-03-05 00:00.1:00", &c) < 0);
assert_se(calendar_spec_from_string("00:00:00/0.00000001", &c) < 0);
assert_se(calendar_spec_from_string("00:00:00.0..00.9", &c) < 0);
+ assert_se(calendar_spec_from_string("2016~11-22", &c) < 0);
+ assert_se(calendar_spec_from_string("*-*~5/5", &c) < 0);
test_timestamp();
test_hourly_bug_4031();