1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-07-30 19:03:16 +03:00

Improvements to test coverage in the lemon-generated parser and in the

sqlite3_get_table() interface. (CVS 4745)

FossilOrigin-Name: 9f95d79daeb5e7f6fd62f3c896dae4d332121d1c
This commit is contained in:
drh
2008-01-23 12:52:40 +00:00
parent 7e8b848a60
commit 01495b9921
15 changed files with 126 additions and 154 deletions

View File

@ -12,7 +12,7 @@
# This file implements regression tests for SQLite library. The
# focus of this script is the sqlite3_table_column_metadata() API.
#
# $Id: colmeta.test,v 1.3 2006/02/10 13:33:31 danielk1977 Exp $
# $Id: colmeta.test,v 1.4 2008/01/23 12:52:41 drh Exp $
set testdir [file dirname $argv0]
source $testdir/tester.tcl
@ -91,13 +91,4 @@ foreach {tn params results} $tests {
} $results
}
do_test colmeta-misuse.1 {
db close
set rc [catch {
sqlite3_table_column_metadata $::DB a b c
} msg]
list $rc $msg
} {1 {library routine called out of sequence}}
finish_test

View File

@ -13,7 +13,7 @@
# in particular the optimizations that occur to help those operators
# run faster.
#
# $Id: like.test,v 1.7 2007/09/12 17:01:45 danielk1977 Exp $
# $Id: like.test,v 1.8 2008/01/23 12:52:41 drh Exp $
set testdir [file dirname $argv0]
source $testdir/tester.tcl
@ -397,4 +397,10 @@ do_test like-6.1 {
}
} {'abc 'ax}
do_test like-7.1 {
execsql {
SELECT * FROM t1 WHERE rowid GLOB '1*';
}
} {a}
finish_test

View File

@ -11,7 +11,7 @@
#
# This test script checks malloc failures in various obscure operations.
#
# $Id: mallocG.test,v 1.1 2008/01/22 01:48:09 drh Exp $
# $Id: mallocG.test,v 1.2 2008/01/23 12:52:41 drh Exp $
set testdir [file dirname $argv0]
source $testdir/tester.tcl
@ -39,4 +39,18 @@ do_malloc_test mallocG-2 -sqlprep {
SELECT y FROM t1 WHERE x IN t2;
}
do_malloc_test mallocG-3 -sqlprep {
CREATE TABLE t1(x UNIQUE);
INSERT INTO t1 VALUES ('hello');
INSERT INTO t1 VALUES ('out there');
} -sqlbody {
SELECT * FROM t1
WHERE x BETWEEN 'a' AND 'z'
AND x BETWEEN 'c' AND 'w'
AND x BETWEEN 'e' AND 'u'
AND x BETWEEN 'g' AND 'r'
AND x BETWEEN 'i' AND 'q'
AND x BETWEEN 'i' AND 'm'
}
finish_test

View File

@ -13,7 +13,7 @@
# This file implements tests for miscellanous features that were
# left out of other test files.
#
# $Id: misc5.test,v 1.19 2007/12/13 07:58:51 danielk1977 Exp $
# $Id: misc5.test,v 1.20 2008/01/23 12:52:41 drh Exp $
set testdir [file dirname $argv0]
source $testdir/tester.tcl
@ -581,15 +581,6 @@ do_test misc5-7.1 {
catchsql $sql
} {1 {parser stack overflow}}
# Check the MISUSE return from sqlitee3_busy_timeout
#
do_test misc5-8.1-misuse {
set DB [sqlite3_connection_pointer db]
db close
sqlite3_busy_timeout $DB 1000
} SQLITE_MISUSE
sqlite3 db test.db
# Ticket #1911
#
ifcapable compound {

View File

@ -10,14 +10,14 @@
#***********************************************************************
# This file implements regression tests for SQLite library.
#
# $Id: misc7.test,v 1.17 2007/12/13 21:54:11 drh Exp $
# $Id: misc7.test,v 1.18 2008/01/23 12:52:41 drh Exp $
set testdir [file dirname $argv0]
source $testdir/tester.tcl
#do_test misc7-1 {
# c_misuse_test
#} {}
do_test misc7-1-misuse {
c_misuse_test
} {}
do_test misc7-2 {
c_realloc_test

View File

@ -12,7 +12,7 @@
# focus of this file is testing the sqlite_exec_printf() and
# sqlite_get_table_printf() APIs.
#
# $Id: tableapi.test,v 1.13 2007/09/12 17:01:45 danielk1977 Exp $
# $Id: tableapi.test,v 1.14 2008/01/23 12:52:41 drh Exp $
set testdir [file dirname $argv0]
source $testdir/tester.tcl
@ -61,6 +61,11 @@ do_test tableapi-2.3.2 {
SELECT * FROM xyz WHERE a>47 ORDER BY a
} {}
} {0 3 2 a b 48 (48) 49 (49) 50 (50)}
do_test tableapi-2.3.3 {
sqlite3_get_table_printf $::dbx {
SELECT * FROM xyz WHERE a>47 ORDER BY a; invalid
} {}
} {1 {near "invalid": syntax error}}
do_test tableapi-2.4 {
set manyquote ''''''''
append manyquote $manyquote
@ -212,6 +217,20 @@ ifcapable schema_pragmas {
} {0 1 1 user_version 0}
}
ifcapable memdebug {
source $testdir/malloc_common.tcl
do_malloc_test tableapi-7 -sqlprep {
CREATE TABLE t1(a,b);
INSERT INTO t1 VALUES(1,2);
INSERT INTO t1 VALUES(3,4);
INSERT INTO t1 SELECT a+4, b+4 FROM t1;
INSERT INTO t1 SELECT a+8, b+8 FROM t1;
} -tclbody {
set r [sqlite3_get_table_printf db {SELECT rowid, a, b FROM t1} {}]
if {[llength $r]<26} {error "out of memory"}
}
}
do_test tableapi-99.0 {
sqlite3_close $::dbx
} {SQLITE_OK}