summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNathan Gass2011-10-28 12:49:10 +0000
committerNathan Gass2011-10-28 12:49:10 +0000
commit1c514b000af332b3385b99f93af5132fcfe5a6f8 (patch)
tree6403f2fb1ae61e5629357413019a378eb16dbc4f
parentedd4c364b0ab77dcfa69465d7393226c450b683f (diff)
downloaditools-1c514b000af332b3385b99f93af5132fcfe5a6f8.tar.gz
itools-1c514b000af332b3385b99f93af5132fcfe5a6f8.tar.bz2
itools-1c514b000af332b3385b99f93af5132fcfe5a6f8.zip
add some date tests
-rwxr-xr-xtests/it.t13
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/it.t b/tests/it.t
index 0fa84f2..900641c 100755
--- a/tests/it.t
+++ b/tests/it.t
@@ -216,4 +216,17 @@ is(
array('b', 'a'),
"reorder with given key order");
+# it::date tests
+
+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('datetime', time()), it::date('datetime'), 'recognize int as timestamp');
+is(it::date('datetime', time()*1.0), it::date('datetime'), 'recognize float as timestamp');
+is(it::date('datetime', time() . ''), it::date('datetime'), 'recognize digit string as timestamp');
+is(it::date('datetime', 10), it::date('datetime', "10"), 'numeric and string give same result');
+is(it::date('datetime', 10.5), it::date('datetime', "10.5"), '... with one digit after point');
+is(it::date('datetime', 10.56), it::date('datetime', "10.56"), '... with two digits after point');
+is(it::date('datetime', 1000000), it::date('datetime', "1000000"), '... large nummer');
+is(it::date('datetime', 1000000.543), it::date('datetime', "1000000.543"), '... large nummer and point');
+
?>