summaryrefslogtreecommitdiffstats
path: root/third_party/sqlite/test/date.test
diff options
context:
space:
mode:
Diffstat (limited to 'third_party/sqlite/test/date.test')
-rw-r--r--third_party/sqlite/test/date.test39
1 files changed, 37 insertions, 2 deletions
diff --git a/third_party/sqlite/test/date.test b/third_party/sqlite/test/date.test
index 466fb65..df522c2 100644
--- a/third_party/sqlite/test/date.test
+++ b/third_party/sqlite/test/date.test
@@ -11,7 +11,7 @@
# This file implements regression tests for SQLite library. The
# focus of this file is testing date and time functions.
#
-# $Id: date.test,v 1.31 2008/07/08 02:12:37 drh Exp $
+# $Id: date.test,v 1.34 2009/04/16 12:58:03 drh Exp $
set testdir [file dirname $argv0]
source $testdir/tester.tcl
@@ -71,6 +71,11 @@ datetest 2.1c datetime(0,'unixepochx') NULL
datetest 2.1d datetime('2003-10-22','unixepoch') NULL
datetest 2.2 datetime(946684800,'unixepoch') {2000-01-01 00:00:00}
datetest 2.2b datetime('946684800','unixepoch') {2000-01-01 00:00:00}
+for {set i 0} {$i<1000} {incr i} {
+ set sql [format {strftime('%%H:%%M:%%f',1237962480.%03d,'unixepoch')} $i]
+ set res [format {06:28:00.%03d} $i]
+ datetest 2.2c-$i $sql $res
+}
datetest 2.3 {date('2003-10-22','weekday 0')} 2003-10-26
datetest 2.4 {date('2003-10-22','weekday 1')} 2003-10-27
datetest 2.4a {date('2003-10-22','weekday 1')} 2003-10-27
@@ -144,7 +149,15 @@ datetest 3.4 {strftime('%j','2003-10-31 12:34:56.432')} 304
datetest 3.5 {strftime('%J','2003-10-31 12:34:56.432')} 2452944.02426426
datetest 3.6 {strftime('%m','2003-10-31 12:34:56.432')} 10
datetest 3.7 {strftime('%M','2003-10-31 12:34:56.432')} 34
-datetest 3.8 {strftime('%s','2003-10-31 12:34:56.432')} 1067603696
+datetest 3.8.1 {strftime('%s','2003-10-31 12:34:56.432')} 1067603696
+datetest 3.8.2 {strftime('%s','2038-01-19 03:14:07')} 2147483647
+datetest 3.8.3 {strftime('%s','2038-01-19 03:14:08')} 2147483648
+datetest 3.8.4 {strftime('%s','2201-04-09 12:00:00')} 7298164800
+datetest 3.8.5 {strftime('%s','9999-12-31 23:59:59')} 253402300799
+datetest 3.8.6 {strftime('%s','1969-12-31 23:59:59')} -1
+datetest 3.8.7 {strftime('%s','1901-12-13 20:45:52')} -2147483648
+datetest 3.8.8 {strftime('%s','1901-12-13 20:45:51')} -2147483649
+datetest 3.8.9 {strftime('%s','1776-07-04 00:00:00')} -6106060800
datetest 3.9 {strftime('%S','2003-10-31 12:34:56.432')} 56
datetest 3.10 {strftime('%w','2003-10-31 12:34:56.432')} 5
datetest 3.11.1 {strftime('%W','2003-10-31 12:34:56.432')} 43
@@ -454,6 +467,28 @@ datetest 13.6 {strftime('%Y-%m-%d %H:%M:%S', '2007-01-01 23:59:59.6')} \
datetest 13.7 {strftime('%Y-%m-%d %H:%M:%f', '2007-01-01 23:59:59.6')} \
{2007-01-01 23:59:59.600}
+# Ticket #3618
+datetest 13.11 {julianday(2454832.5,'-1 day')} {2454831.5}
+datetest 13.12 {julianday(2454832.5,'+1 day')} {2454833.5}
+datetest 13.13 {julianday(2454832.5,'-1.5 day')} {2454831.0}
+datetest 13.14 {julianday(2454832.5,'+1.5 day')} {2454834.0}
+datetest 13.15 {julianday(2454832.5,'-3 hours')} {2454832.375}
+datetest 13.16 {julianday(2454832.5,'+3 hours')} {2454832.625}
+datetest 13.17 {julianday(2454832.5,'-45 minutes')} {2454832.46875}
+datetest 13.18 {julianday(2454832.5,'+45 minutes')} {2454832.53125}
+datetest 13.19 {julianday(2454832.5,'-675 seconds')} {2454832.4921875}
+datetest 13.20 {julianday(2454832.5,'+675 seconds')} {2454832.5078125}
+datetest 13.21 {julianday(2454832.5,'-1.5 months')} {2454786.5}
+datetest 13.22 {julianday(2454832.5,'+1.5 months')} {2454878.5}
+datetest 13.23 {julianday(2454832.5,'-1.5 years')} {2454284.0}
+datetest 13.24 {julianday(2454832.5,'+1.5 years')} {2455380.0}
+
+datetest 13.30 {date('2000-01-01','+1.5 years')} {2001-07-02}
+datetest 13.31 {date('2001-01-01','+1.5 years')} {2002-07-02}
+datetest 13.32 {date('2002-01-01','+1.5 years')} {2003-07-02}
+datetest 13.33 {date('2002-01-01','-1.5 years')} {2000-07-02}
+datetest 13.34 {date('2001-01-01','-1.5 years')} {1999-07-02}
+
# Test for issues reported by BareFeet (list.sql at tandb.com.au)
# on mailing list on 2008-06-12.
#