summaryrefslogtreecommitdiffstats
path: root/test/test_sql_time_func.sh
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--test/test_sql_time_func.sh71
1 files changed, 71 insertions, 0 deletions
diff --git a/test/test_sql_time_func.sh b/test/test_sql_time_func.sh
new file mode 100644
index 0000000..181dd70
--- /dev/null
+++ b/test/test_sql_time_func.sh
@@ -0,0 +1,71 @@
+#! /bin/bash
+
+# timeslice('blah')
+run_cap_test ./drive_sql "select timeslice('2015-08-07 12:01:00', 'blah')"
+
+# before 12pm
+run_cap_test ./drive_sql "select timeslice('2015-08-07 12:01:00', 'before fri')"
+
+# not before 12pm
+run_cap_test ./drive_sql "select timeslice('2015-08-07 11:59:00', 'after fri')"
+
+# not before 12pm
+run_cap_test ./drive_sql "select timeslice('2015-08-07 11:59:00', 'fri')"
+
+# before 12pm
+run_cap_test ./drive_sql "select timeslice('2015-08-07 12:01:00', 'before 12pm')"
+
+# not before 12pm
+run_cap_test ./drive_sql "select timeslice('2015-08-07 11:59:00', 'before 12pm')"
+
+# after 12pm
+run_cap_test ./drive_sql "select timeslice('2015-08-07 12:01:00', 'after 12pm')"
+
+# not after 12pm
+run_cap_test ./drive_sql "select timeslice('2015-08-07 11:59:00', 'after 12pm')"
+
+# timeslice()
+run_cap_test ./drive_sql "select timeslice()"
+
+# timeslice('2015-02-01T05:10:00')
+run_cap_test ./drive_sql "select timeslice('2015-02-01T05:10:00')"
+
+# timeslice empty
+run_cap_test ./drive_sql "select timeslice('', '')"
+
+# timeslice abs
+run_cap_test ./drive_sql "select timeslice('2015-08-07 12:01:00', '8 am')"
+
+# timeslice abs
+run_cap_test ./drive_sql "select timeslice('2015-08-07 08:00:33', '8 am')"
+
+# timeslice abs
+run_cap_test ./drive_sql "select timeslice('2015-08-07 08:01:33', '8 am')"
+
+# timeslice(null, null)
+run_cap_test ./drive_sql "select timeslice(null, null)"
+
+# timeslice(null)
+run_cap_test ./drive_sql "select timeslice(null)"
+
+# 100ms slice
+run_cap_test ./drive_sql "select timeslice(1616300753.333, '100ms')"
+
+# timeslice 5m
+run_cap_test ./drive_sql "select timeslice('2015-08-07 12:01:00', '5m')"
+
+# timeslice 1d
+run_cap_test ./drive_sql "select timeslice('2015-08-07 12:01:00', '1d')"
+
+# XXX This is wrong...
+# timeslice 1 month
+run_cap_test ./drive_sql "select timeslice('2015-08-07 12:01:00', '1 month')"
+
+# timeslice ms
+run_cap_test ./drive_sql "select timediff('2017-01-02T05:00:00.100', '2017-01-02T05:00:00.000')"
+
+# timeslice day
+run_cap_test ./drive_sql "select timediff('today', 'yesterday')"
+
+# timeslice day
+run_cap_test ./drive_sql "select timediff('foo', 'yesterday')"