summaryrefslogtreecommitdiff
path: root/src/test
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2016-12-20 11:14:59 +0100
committerGitHub <noreply@github.com>2016-12-20 11:14:59 +0100
commitce5cbd8679605f3c9220d09c3a184e77bde15e2e (patch)
tree0cddf9c0c6a6de4f3456d4684a2a8a35a333766e /src/test
parent6483ad89f5563494190e5ada179ac98b8204c3e9 (diff)
parent482f3b54418095c31b1054c00877d086e9dc007c (diff)
Merge pull request #4904 from dobyrch/calendar-range-step
calendarspec: allow repetition values with ranges
Diffstat (limited to 'src/test')
-rw-r--r--src/test/test-calendarspec.c23
1 files changed, 18 insertions, 5 deletions
diff --git a/src/test/test-calendarspec.c b/src/test/test-calendarspec.c
index b8320b081b..5fd749a6a8 100644
--- a/src/test/test-calendarspec.c
+++ b/src/test/test-calendarspec.c
@@ -149,8 +149,8 @@ int main(int argc, char* argv[]) {
test_one("*-*-7 0:0:0", "*-*-07 00:00:00");
test_one("10-15", "*-10-15 00:00:00");
test_one("monday *-12-* 17:00", "Mon *-12-* 17:00:00");
- test_one("Mon,Fri *-*-3,1,2 *:30:45", "Mon,Fri *-*-01..03 *:30:45");
- test_one("12,14,13,12:20,10,30", "*-*-* 12..14:10,20,30:00");
+ test_one("Mon,Fri *-*-3,1,2 *:30:45", "Mon,Fri *-*-01,02,03 *:30:45");
+ test_one("12,14,13,12:20,10,30", "*-*-* 12,13,14:10,20,30:00");
test_one("mon,fri *-1/2-1,3 *:30:45", "Mon,Fri *-01/2-01,03 *:30:45");
test_one("03-05 08:05:40", "*-03-05 08:05:40");
test_one("08:05:40", "*-*-* 08:05:40");
@@ -172,13 +172,12 @@ int main(int argc, char* argv[]) {
test_one("2015-10-25 01:00:00 uTc", "2015-10-25 01:00:00 UTC");
test_one("2016-03-27 03:17:00.4200005", "2016-03-27 03:17:00.420001");
test_one("2016-03-27 03:17:00/0.42", "2016-03-27 03:17:00/0.420000");
- test_one("2016-03-27 03:17:00/0.42", "2016-03-27 03:17:00/0.420000");
test_one("9..11,13:00,30", "*-*-* 09..11,13:00,30:00");
test_one("1..3-1..3 1..3:1..3", "*-01..03-01..03 01..03:01..03:00");
- test_one("00:00:1.125..2.125", "*-*-* 00:00:01.125000,02.125000");
+ 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..03");
test_one("00:00:01..03", "*-*-* 00:00:01..03");
- test_one("00:00:01/2,02..03", "*-*-* 00:00:01/2,02,03");
+ test_one("00:00:01/2,02..03", "*-*-* 00:00:01/2,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");
@@ -189,6 +188,10 @@ int main(int argc, char* argv[]) {
test_one("*:*", "*-*-* *:*:00");
test_one("12:*", "*-*-* 12:*:00");
test_one("*:30", "*-*-* *:30:00");
+ test_one("93..00-*-*", "1993..2000-*-* 00:00:00");
+ test_one("00..07-*-*", "2000..2007-*-* 00:00:00");
+ test_one("*:20..39/5", "*-*-* *:20..35/5:00");
+ test_one("00:00:20..40/1", "*-*-* 00:00:20..40");
test_next("2016-03-27 03:17:00", "", 12345, 1459048620000000);
test_next("2016-03-27 03:17:00", "CET", 12345, 1459041420000000);
@@ -207,6 +210,9 @@ int main(int argc, char* argv[]) {
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);
+ test_next("2017-08-06 9,11,13,15,17:00 UTC", "", 1502029800000000, 1502031600000000);
+ test_next("2017-08-06 9..17/2:00 UTC", "", 1502029800000000, 1502031600000000);
+ test_next("2016-12-* 3..21/6:00 UTC", "", 1482613200000001, 1482634800000000);
assert_se(calendar_spec_from_string("test", &c) < 0);
assert_se(calendar_spec_from_string(" utc", &c) < 0);
@@ -225,6 +231,13 @@ int main(int argc, char* argv[]) {
assert_se(calendar_spec_from_string("-00:+00/-5", &c) < 0);
assert_se(calendar_spec_from_string("00:+00/-5", &c) < 0);
assert_se(calendar_spec_from_string("2016- 11- 24 12: 30: 00", &c) < 0);
+ assert_se(calendar_spec_from_string("*~29", &c) < 0);
+ assert_se(calendar_spec_from_string("*~16..31", &c) < 0);
+ assert_se(calendar_spec_from_string("12..1/2-*", &c) < 0);
+ assert_se(calendar_spec_from_string("*:05..05", &c) < 0);
+ assert_se(calendar_spec_from_string("*:05..10/6", &c) < 0);
+ assert_se(calendar_spec_from_string("20/4:00", &c) < 0);
+ assert_se(calendar_spec_from_string("00:00/60", &c) < 0);
test_timestamp();
test_hourly_bug_4031();