summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rwxr-xr-xtest/it.t14
1 files changed, 13 insertions, 1 deletions
diff --git a/test/it.t b/test/it.t
index 41758da..34279ce 100755
--- a/test/it.t
+++ b/test/it.t
@@ -388,7 +388,19 @@ _time("152715", it::date('', '15:27:15'));
_time("yesterday", it::date('', 'yesterday'));
is(it::date('date', '2011-10-25'), '25.10.2011', 'parse date string with strtotime');
-is(it::date('date', '2011-10-25 + 3 days'), '28.10.2011', 'some date arithmetic');
+is(it::date('date', '2011-10-25 + 3 days'), '28.10.2011', 'date arithmetic (add)');
+is(it::date('date', '2011-10-25 - 3 days'), '22.10.2011', 'date arithmetic (subtract)');
+is(it::date('date', '2011-10-25 +-3 days'), '22.10.2011', 'date arithmetic (negative value)');
+is(it::date('date', '2011-10-25 --3 days'), '28.10.2011', 'date arithmetic (double negative)');
+is(it::date('date', '2011-10-25 ++ 3 days'), '28.10.2011', 'date arithmetic (double positive with space)');
+is(it::date('date', '2011-10-25 -+ 3 days'), '22.10.2011', 'date arithmetic (negative positive with space)');
+is(it::date('datetime', '2011-10-25 +12 hours +30 minutes'), '25.10.2011 12:30', 'datetime arithmetic (hours minutes)');
+is(it::date('datetime', '2011-10-25 +24 hours +30 minutes'), '26.10.2011 00:30', 'datetime arithmetic (hours minutes over midnight)');
+is(it::date('datetime', '2011-10-25 8:00 +10 minutes'), '25.10.2011 08:10', 'time arithmetic (add)');
+is(it::date('datetime', '2011-10-25 8:00 -10 minutes'), '25.10.2011 07:50', 'time arithmetic (subtract)');
+is(it::date('datetime', '2011-10-25 8:00 +-10 minutes'), '25.10.2011 07:50', 'time arithmetic (negative value)');
+is(it::date('datetime', '2011-10-25 8:00 --10 minutes'), '25.10.2011 08:10', 'time arithmetic (double negative)');
+is(it::date('datetime', '2011-10-25 --1 month --3 days 8:00 +- 4 hours +-10 minutes'), '28.11.2011 03:50', 'date and time arithmetic (multiple signs)');
is(it::date('datetime', it::time()), it::date('datetime'), 'recognize int as timestamp');
is(it::date('datetime', it::time()*1.0), it::date('datetime'), 'recognize float as timestamp');
is(it::date('datetime', it::time() . ''), it::date('datetime'), 'recognize digit string as timestamp');