/ Check-in [bedbac54]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Remove use of the "clock" command in the test suite so that the tests will run in Tcl8.5. Ticket #1445. (CVS 3380)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:bedbac54db173ceb74bd78acd021209f28aa30a8
User & Date: drh 2006-09-01 15:49:06
Context
2006-09-01
17:06
Automatically compute the sqlite3.def and tclsqlite3.def files when building windows DLLs. This will (hopefully) keep the .def files in perfect synchronization with the DLLs. Ticket #1951. (CVS 3381) check-in: 1f6d7926 user: drh tags: trunk
15:49
Remove use of the "clock" command in the test suite so that the tests will run in Tcl8.5. Ticket #1445. (CVS 3380) check-in: bedbac54 user: drh tags: trunk
00:33
Make fts1.c not rely on nul-terminated strings. Mostly a matter of making sure we always pass around ptr/len, but there were a few places where we actually relied on nul-termination.

An earlier change had additionally changed appropriate sqlite3_bind_text() calls to sqlite3_bind_blob(). I've found that this changes what's actually stored in the database, so backed those changes out. Also (and this is weird), I found that I could no longer do straight-forward = queries against %_term.term at a command-line. (CVS 3379) check-in: 5844db1a user: shess tags: trunk

Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to test/date.test.

7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
...
135
136
137
138
139
140
141
142
143

144
145
146
147
148
149
150
151
152
153
154
155





156
157
158
159
160
161
162
#    May you find forgiveness for yourself and forgive others.
#    May you share freely, never taking more than you give.
#
#***********************************************************************
# This file implements regression tests for SQLite library.  The
# focus of this file is testing date and time functions.
#
# $Id: date.test,v 1.14 2006/01/09 00:18:03 drh Exp $

set testdir [file dirname $argv0]
source $testdir/tester.tcl

# Skip this whole file if date and time functions are omitted
# at compile-time
#
................................................................................
  }
  return $x
}
datetest 3.16 "strftime('[repeat 200 %Y]','2003-10-31')" [repeat 200 2003]
datetest 3.17 "strftime('[repeat 200 abc%m123]','2003-10-31')" \
    [repeat 200 abc10123]

set now [clock format [clock seconds] -format "%Y-%m-%d" -gmt 1]
datetest 4.1 {date('now')} $now


datetest 5.1 {datetime('1994-04-16 14:00:00 +05:00')} {1994-04-16 09:00:00}
datetest 5.2 {datetime('1994-04-16 14:00:00 -05:15')} {1994-04-16 19:15:00}
datetest 5.3 {datetime('1994-04-16 05:00:00 +08:30')} {1994-04-15 20:30:00}
datetest 5.4 {datetime('1994-04-16 14:00:00 -11:55')} {1994-04-17 01:55:00}
datetest 5.5 {datetime('1994-04-16 14:00:00 -11:60')} NULL

# localtime->utc and utc->localtime conversions.  These tests only work
# if the localtime is in the US Eastern Time (the time in Charlotte, NC
# and in New York.)
#
if {[clock scan [clock format 0 -format {%b %d, %Y %H:%M:%S}] -gmt 1]==-18000} {





  datetest 6.1 {datetime('2000-10-29 05:59:00','localtime')}\
      {2000-10-29 01:59:00}
  datetest 6.2 {datetime('2000-10-29 06:00:00','localtime')}\
      {2000-10-29 01:00:00}
  datetest 6.3 {datetime('2000-04-02 06:59:00','localtime')}\
      {2000-04-02 01:59:00}
  datetest 6.4 {datetime('2000-04-02 07:00:00','localtime')}\







|







 







|
|
>











|
>
>
>
>
>







7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
...
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
#    May you find forgiveness for yourself and forgive others.
#    May you share freely, never taking more than you give.
#
#***********************************************************************
# This file implements regression tests for SQLite library.  The
# focus of this file is testing date and time functions.
#
# $Id: date.test,v 1.15 2006/09/01 15:49:06 drh Exp $

set testdir [file dirname $argv0]
source $testdir/tester.tcl

# Skip this whole file if date and time functions are omitted
# at compile-time
#
................................................................................
  }
  return $x
}
datetest 3.16 "strftime('[repeat 200 %Y]','2003-10-31')" [repeat 200 2003]
datetest 3.17 "strftime('[repeat 200 abc%m123]','2003-10-31')" \
    [repeat 200 abc10123]

set sqlite_current_time 1157124367
datetest 4.1 {date('now')} {2006-09-01}
set sqlite_current_time 0

datetest 5.1 {datetime('1994-04-16 14:00:00 +05:00')} {1994-04-16 09:00:00}
datetest 5.2 {datetime('1994-04-16 14:00:00 -05:15')} {1994-04-16 19:15:00}
datetest 5.3 {datetime('1994-04-16 05:00:00 +08:30')} {1994-04-15 20:30:00}
datetest 5.4 {datetime('1994-04-16 14:00:00 -11:55')} {1994-04-17 01:55:00}
datetest 5.5 {datetime('1994-04-16 14:00:00 -11:60')} NULL

# localtime->utc and utc->localtime conversions.  These tests only work
# if the localtime is in the US Eastern Time (the time in Charlotte, NC
# and in New York.)
#
set tzoffset [db one {
  SELECT CAST(24*(julianday('2006-09-01') -
                  julianday('2006-09-01','localtime'))+0.5
              AS INT)
}]
if {$tzoffset==4} {
  datetest 6.1 {datetime('2000-10-29 05:59:00','localtime')}\
      {2000-10-29 01:59:00}
  datetest 6.2 {datetime('2000-10-29 06:00:00','localtime')}\
      {2000-10-29 01:00:00}
  datetest 6.3 {datetime('2000-04-02 06:59:00','localtime')}\
      {2000-04-02 01:59:00}
  datetest 6.4 {datetime('2000-04-02 07:00:00','localtime')}\

Changes to test/expr.test.

7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
...
589
590
591
592
593
594
595
596
597
598
599
600
601

602
603
604

605
606
607

608
609
610
611
612
613
614
#    May you find forgiveness for yourself and forgive others.
#    May you share freely, never taking more than you give.
#
#***********************************************************************
# This file implements regression tests for SQLite library.  The
# focus of this file is testing expressions.
#
# $Id: expr.test,v 1.51 2006/03/03 19:12:30 drh Exp $

set testdir [file dirname $argv0]
source $testdir/tester.tcl

# Create a table to work with.
#
execsql {CREATE TABLE test1(i1 int, i2 int, r1 real, r2 real, t1 text, t2 text)}
................................................................................
test_expr2 expr-7.60 {LIKE('_4',b)}                   {6}
test_expr2 expr-7.61 {GLOB('1?',a)}            {10 11 12 13 14 15 16 17 18 19}
test_expr2 expr-7.62 {GLOB('1*4',b)}                  {10 14}
test_expr2 expr-7.63 {GLOB('*1[456]',b)}              {4}

# Test the CURRENT_TIME, CURRENT_DATE, and CURRENT_TIMESTAMP expressions.
#
set sqlite_current_time [clock seconds]
set date [clock format $sqlite_current_time -format %Y-%m-%d -gmt 1]
set time [clock format $sqlite_current_time -format %H:%M:%S -gmt 1]
do_test expr-8.1 {
  execsql {SELECT CURRENT_TIME}
} $time

do_test expr-8.2 {
  execsql {SELECT CURRENT_DATE}
} $date

do_test expr-8.3 {
  execsql {SELECT CURRENT_TIMESTAMP}
} [list "$date $time"]

ifcapable datetime {
  do_test expr-8.4 {
    execsql {SELECT CURRENT_TIME==time('now');}
  } 1
  do_test expr-8.5 {
    execsql {SELECT CURRENT_DATE==date('now');}
  } 1







|







 







|
<
<


<
>


<
>


<
>







7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
...
589
590
591
592
593
594
595
596


597
598

599
600
601

602
603
604

605
606
607
608
609
610
611
612
#    May you find forgiveness for yourself and forgive others.
#    May you share freely, never taking more than you give.
#
#***********************************************************************
# This file implements regression tests for SQLite library.  The
# focus of this file is testing expressions.
#
# $Id: expr.test,v 1.52 2006/09/01 15:49:06 drh Exp $

set testdir [file dirname $argv0]
source $testdir/tester.tcl

# Create a table to work with.
#
execsql {CREATE TABLE test1(i1 int, i2 int, r1 real, r2 real, t1 text, t2 text)}
................................................................................
test_expr2 expr-7.60 {LIKE('_4',b)}                   {6}
test_expr2 expr-7.61 {GLOB('1?',a)}            {10 11 12 13 14 15 16 17 18 19}
test_expr2 expr-7.62 {GLOB('1*4',b)}                  {10 14}
test_expr2 expr-7.63 {GLOB('*1[456]',b)}              {4}

# Test the CURRENT_TIME, CURRENT_DATE, and CURRENT_TIMESTAMP expressions.
#
set sqlite_current_time 1157124849


do_test expr-8.1 {
  execsql {SELECT CURRENT_TIME}

} {15:34:09}
do_test expr-8.2 {
  execsql {SELECT CURRENT_DATE}

} {2006-09-01}
do_test expr-8.3 {
  execsql {SELECT CURRENT_TIMESTAMP}

} {{2006-09-01 15:34:09}}
ifcapable datetime {
  do_test expr-8.4 {
    execsql {SELECT CURRENT_TIME==time('now');}
  } 1
  do_test expr-8.5 {
    execsql {SELECT CURRENT_DATE==date('now');}
  } 1

Changes to test/table.test.

7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
...
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
#    May you find forgiveness for yourself and forgive others.
#    May you share freely, never taking more than you give.
#
#***********************************************************************
# This file implements regression tests for SQLite library.  The
# focus of this file is testing the CREATE TABLE statement.
#
# $Id: table.test,v 1.45 2006/03/29 00:24:07 drh Exp $

set testdir [file dirname $argv0]
source $testdir/tester.tcl

# Create a basic table and verify it is added to sqlite_master
#
do_test table-1.1 {
................................................................................
       dt text DEFAULT CURRENT_DATE,
       dttm text DEFAULT CURRENT_TIMESTAMP
    );
    SELECT * FROM tablet8;
  }
} {}
set i 0
foreach {date time} {
  1976-07-04 12:00:00
  1994-04-16 14:00:00
  2000-01-01 00:00:00
  2003-12-31 12:34:56
} {
  incr i
  set sqlite_current_time [clock scan "$date $time" -gmt 1]
  # set sqlite_current_time [execsql "SELECT strftime('%s','$date $time')"]
  do_test table-13.2.$i {
    execsql "
      INSERT INTO tablet8(a) VALUES($i);
      SELECT tm, dt, dttm FROM tablet8 WHERE a=$i;
    "
  } [list $time $date [list $date $time]]
}







|







 







|
|
|
|
|


|
<







7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
...
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575

576
577
578
579
580
581
582
#    May you find forgiveness for yourself and forgive others.
#    May you share freely, never taking more than you give.
#
#***********************************************************************
# This file implements regression tests for SQLite library.  The
# focus of this file is testing the CREATE TABLE statement.
#
# $Id: table.test,v 1.46 2006/09/01 15:49:06 drh Exp $

set testdir [file dirname $argv0]
source $testdir/tester.tcl

# Create a basic table and verify it is added to sqlite_master
#
do_test table-1.1 {
................................................................................
       dt text DEFAULT CURRENT_DATE,
       dttm text DEFAULT CURRENT_TIMESTAMP
    );
    SELECT * FROM tablet8;
  }
} {}
set i 0
foreach {date time seconds} {
  1976-07-04 12:00:00 205329600
  1994-04-16 14:00:00 766504800
  2000-01-01 00:00:00 946684800
  2003-12-31 12:34:56 1072874096
} {
  incr i
  set sqlite_current_time $seconds

  do_test table-13.2.$i {
    execsql "
      INSERT INTO tablet8(a) VALUES($i);
      SELECT tm, dt, dttm FROM tablet8 WHERE a=$i;
    "
  } [list $time $date [list $date $time]]
}

Changes to test/tclsqlite.test.

11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
...
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
# This file implements regression tests for TCL interface to the
# SQLite library. 
#
# Actually, all tests are based on the TCL interface, so the main
# interface is pretty well tested.  This file contains some addition
# tests for fringe issues that the main test suite does not cover.
#
# $Id: tclsqlite.test,v 1.55 2006/07/17 00:02:46 drh Exp $

set testdir [file dirname $argv0]
source $testdir/tester.tcl

# Check the error messages generated by tclsqlite
#
if {[sqlite3 -has-codec]} {
................................................................................
# Test the return type of user-defined functions
#
do_test tcl-9.1 {
  db function ret_str {return "hi"}
  execsql {SELECT typeof(ret_str())}
} {text}
do_test tcl-9.2 {
  db function ret_dbl {return [expr {[clock seconds]*0.5}]}
  execsql {SELECT typeof(ret_dbl())}
} {real}
do_test tcl-9.3 {
  db function ret_int {clock seconds}
  execsql {SELECT typeof(ret_int())}
} {integer}

# Recursive calls to the same user-defined function
#
ifcapable tclvar {
  do_test tcl-9.10 {







|







 







|



|







11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
...
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
# This file implements regression tests for TCL interface to the
# SQLite library. 
#
# Actually, all tests are based on the TCL interface, so the main
# interface is pretty well tested.  This file contains some addition
# tests for fringe issues that the main test suite does not cover.
#
# $Id: tclsqlite.test,v 1.56 2006/09/01 15:49:06 drh Exp $

set testdir [file dirname $argv0]
source $testdir/tester.tcl

# Check the error messages generated by tclsqlite
#
if {[sqlite3 -has-codec]} {
................................................................................
# Test the return type of user-defined functions
#
do_test tcl-9.1 {
  db function ret_str {return "hi"}
  execsql {SELECT typeof(ret_str())}
} {text}
do_test tcl-9.2 {
  db function ret_dbl {return [expr {rand()*0.5}]}
  execsql {SELECT typeof(ret_dbl())}
} {real}
do_test tcl-9.3 {
  db function ret_int {return [expr {int(rand()*200)}]}
  execsql {SELECT typeof(ret_int())}
} {integer}

# Recursive calls to the same user-defined function
#
ifcapable tclvar {
  do_test tcl-9.10 {