summaryrefslogtreecommitdiffstats
path: root/test/test_sql_time_func.sh
blob: 181dd70d60ba8a120f2aee3af09193838cde9577 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
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')"