add some more time zone tests
[postmodern.git] / cl-postgres / simple-date-tests.lisp
blob0643a1f59699153d1d362685b5d94e2f4eb646aa
2 (in-package :cl-postgres-tests)
4 (def-suite :cl-postgres-simple-date)
5 (in-suite :cl-postgres-simple-date)
7 (test row-timestamp-without-time-zone-binary
8 (with-test-connection
9 (with-binary-row-values
10 (is (time= (caaar (exec-query connection "select row('2010-04-05 14:42:21.500'::timestamp without time zone)"
11 'list-row-reader))
12 (encode-timestamp 2010 4 5 14 42 21 500))))))
14 (test row-timestamp-with-time-zone-binary
15 (with-test-connection
16 (with-binary-row-values
17 (destructuring-bind (gmt pdt)
18 (caar
19 (exec-query
20 connection
21 (concatenate 'string
22 "select row('2010-04-05 14:42:21.500'::timestamp with time zone at time zone 'GMT', "
23 " '2010-04-05 14:42:21.500'::timestamp with time zone at time zone 'PST')")
24 'list-row-reader))
25 (is (time= gmt (encode-timestamp 2010 4 5 14 42 21 500)))
26 (is (time= pdt (encode-timestamp 2010 4 5 6 42 21 500)))))))
28 (test row-timestamp-without-time-zone-array-binary
29 (with-test-connection
30 (with-binary-row-values
31 (is (time= (elt (caaar (exec-query connection "select row(ARRAY['2010-04-05 14:42:21.500'::timestamp without time zone])"
32 'list-row-reader)) 0)
33 (encode-timestamp 2010 4 5 14 42 21 500))))))
35 (test row-time-binary
36 (with-test-connection
37 (with-binary-row-values
38 (is (time= (caaar (exec-query connection "select row('05:00'::time)"
39 'list-row-reader))
40 (encode-time-of-day 5 0))))))
42 (test row-timestamp-binary
43 (with-test-connection
44 (with-binary-row-values
45 (is (time= (caaar (exec-query connection "select row('2010-04-05 14:42:21.500'::timestamp)"
46 'list-row-reader))
47 (encode-timestamp 2010 4 5 14 42 21 500))))))