SQLite

Check-in [5767850cca]
Login

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

Overview
Comment:Test coverage improvements on tokenize.c. (CVS 2196)
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 5767850ccadb3b53d14bca547e50f65de1d3092e
User & Date: drh 2005-01-11 17:46:42.000
Context
2005-01-11
17:59
Allow '$' in the middle of identifiers. Ticket #1066. This is an experimental change. It might be backed out at a later date. (CVS 2197) (check-in: 00a352ea79 user: drh tags: trunk)
17:46
Test coverage improvements on tokenize.c. (CVS 2196) (check-in: 5767850cca user: drh tags: trunk)
16:54
Improved test coverage for vdbeaux.c. (CVS 2195) (check-in: 3f46cd7767 user: drh tags: trunk)
Changes
Side-by-Side Diff Ignore Whitespace Patch
Changes to test/bind.test.
1
2
3
4
5
6
7
8
9
10
11
12
13
14

15
16
17
18
19
20
21
1
2
3
4
5
6
7
8
9
10
11
12
13

14
15
16
17
18
19
20
21













-
+







# 2003 September 6
#
# The author disclaims copyright to this source code.  In place of
# a legal notice, here is a blessing:
#
#    May you do good and not evil.
#    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 script testing the sqlite_bind API.
#
# $Id: bind.test,v 1.24 2005/01/11 16:54:15 drh Exp $
# $Id: bind.test,v 1.25 2005/01/11 17:46:42 drh Exp $
#

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

proc sqlite_step {stmt N VALS COLS} {
  upvar VALS vals
100
101
102
103
104
105
106
107


108
109
110
111
112

113
114
115
116
117
118
119
100
101
102
103
104
105
106

107
108
109
110
111
112

113
114
115
116
117
118
119
120







-
+
+




-
+







# the $var processing is compiled into the library.
#
ifcapable {tclvar} {
  do_test bind-2.1 {
    execsql {
      DELETE FROM t1;
    }
    set VM [sqlite3_prepare $DB {INSERT INTO t1 VALUES($one,$::two,${x})} -1 TX]
    set VM [sqlite3_prepare $DB {INSERT INTO t1 VALUES($one,$::two,${x{y}z})}\
            -1 TX]
    set TX
  } {}
  set v1 {$one}
  set v2 {$::two}
  set v3 {${x}}
  set v3 {${x{y}z}}
}
ifcapable {!tclvar} {
  do_test bind-2.1 {
    execsql {
      DELETE FROM t1;
    }
    set VM [sqlite3_prepare $DB {INSERT INTO t1 VALUES(:one,:two,:_)} -1 TX]
486
487
488
489
490
491
492
493







494
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502








+
+
+
+
+
+
+

do_test bind-10.16 {
  sqlite3_bind_parameter_name $VM 4
} {?4}
do_test bind-10.16 {
  sqlite3_bind_parameter_name $VM 5
} :pqr
catch {sqlite3_finalize $VM}

# Make sure we catch an unterminated "(" in a Tcl-style variable name
#
do_test bind-11.1 {
  catchsql {SELECT * FROM sqlite_master WHERE name=$abc(123 and sql NOT NULL;}
} {1 {unrecognized token: "$abc(123"}}


finish_test
Changes to test/expr.test.
1
2
3
4
5
6
7
8
9
10
11
12
13
14

15
16
17
18
19
20
21
1
2
3
4
5
6
7
8
9
10
11
12
13

14
15
16
17
18
19
20
21













-
+







# 2001 September 15
#
# The author disclaims copyright to this source code.  In place of
# a legal notice, here is a blessing:
#
#    May you do good and not evil.
#    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.40 2004/11/17 16:41:29 danielk1977 Exp $
# $Id: expr.test,v 1.41 2005/01/11 17:46:42 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)}
538
539
540
541
542
543
544
545




546
538
539
540
541
542
543
544
545
546
547
548
549
550








+
+
+
+

    execsql {SELECT CURRENT_DATE==date('now');}
  } 1
  do_test expr-8.6 {
    execsql {SELECT CURRENT_TIMESTAMP==datetime('now');}
  } 1
}
set sqlite_current_time 0

do_test expr-9.1 {
  execsql {SELECT round(-('-'||'123'))}
} 123

finish_test
Changes to test/interrupt.test.
1
2
3
4
5
6
7
8
9
10
11
12
13
14

15
16
17
18
19
20
21
1
2
3
4
5
6
7
8
9
10
11
12
13

14
15
16
17
18
19
20
21













-
+







# 2004 Feb 8
#
# The author disclaims copyright to this source code.  In place of
# a legal notice, here is a blessing:
#
#    May you do good and not evil.
#    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 script is the sqlite_interrupt() API.
#
# $Id: interrupt.test,v 1.9 2005/01/11 16:54:15 drh Exp $
# $Id: interrupt.test,v 1.10 2005/01/11 17:46:42 drh Exp $


set testdir [file dirname $argv0]
source $testdir/tester.tcl
db close
set DB [sqlite3 db test.db]

171
172
173
174
175
176
177
178










179
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189








+
+
+
+
+
+
+
+
+
+

set max_count [expr {1000000-$sqlite_interrupt_count}]
for {set i 1} {$i<$max_count-5} {incr i 1} {
  do_test interrupt-4.$i.1 {
    set ::sqlite_interrupt_count $::i
    catchsql $sql
  } {1 interrupted}
}

# Interrupt during parsing
#
do_test interrupt-5.1 {
  proc fake_interrupt {args} {sqlite3_interrupt $::DB; return SQLITE_OK}
  db collation_needed fake_interrupt
  catchsql {
    CREATE INDEX fake ON fake1(a COLLATE fake_collation, b, c DESC);
  }
} {1 interrupt}

finish_test
Changes to test/main.test.
1
2
3
4
5
6
7
8
9
10
11
12
13
14

15
16
17
18
19
20
21
1
2
3
4
5
6
7
8
9
10
11
12
13

14
15
16
17
18
19
20
21













-
+







# 2001 September 15
#
# The author disclaims copyright to this source code.  In place of
# a legal notice, here is a blessing:
#
#    May you do good and not evil.
#    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 exercising the code in main.c.
#
# $Id: main.test,v 1.18 2004/11/04 04:42:28 drh Exp $
# $Id: main.test,v 1.19 2005/01/11 17:46:42 drh Exp $

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

# Tests of the sqlite_complete() function.
#
do_test main-1.1 {
64
65
66
67
68
69
70
71

72
73
74
75
76
77
78
64
65
66
67
68
69
70

71
72
73
74
75
76
77
78







-
+







  db complete {DROP TABLE xyz; -- hi
  }
} {1}
do_test main-1.14 {
  db complete {SELECT a-b FROM t1; }
} {1}
do_test main-1.15 {
  db complete {SELECT a-b FROM t1 }
  db complete {SELECT a/e FROM t1 }
} {0}
do_test main-1.16 {
  db complete {
    CREATE TABLE abc(x,y);
  }
} {1}
ifcapable {trigger} {
175
176
177
178
179
180
181
182

183
184
185
186
187
188
189
175
176
177
178
179
180
181

182
183
184
185
186
187
188
189







-
+







        CREATE TEMP TRIGGER xyz AFTER DELETE backend BEGIN
           UPDATE pqr SET a=5;
      }
    } {0}
  }
  do_test main-1.28 {
    db complete {
      CREATE TEMP TRIGGER xyz AFTER DELETE backend BEGIN
      CREATE TEMPORARY TRIGGER xyz AFTER DELETE backend BEGIN
         UPDATE pqr SET a=5;
    }
  } {0}
  do_test main-1.29 {
    db complete {
      CREATE TRIGGER xyz AFTER DELETE backend BEGIN
         UPDATE pqr SET a=5;
273
274
275
276
277
278
279
280

281
282
283
284
285
286
287
273
274
275
276
277
278
279

280
281
282
283
284
285
286
287







-
+








do_test main-3.3 {
  catch {db close}
  foreach f [glob -nocomplain testdb/*] {file delete -force $f}
  file delete -force testdb
  sqlite3 db testdb
  execsql {
    create table T1(X REAL);
    create table T1(X REAL);  /* C-style comments allowed */
    insert into T1 values(0.5);
    insert into T1 values(0.5e2);
    insert into T1 values(0.5e-002);
    insert into T1 values(5e-002);
    insert into T1 values(-5.0e-2);
    insert into T1 values(-5.1e-2);
    insert into T1 values(0.5e2);