1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-07-29 08:01:23 +03:00

Improved test coverage for vdbeaux.c. (CVS 2195)

FossilOrigin-Name: 3f46cd7767cf7c48dd1de7ae1c4104d6d1a609be
This commit is contained in:
drh
2005-01-11 16:54:14 +00:00
parent cacb208e4e
commit c5cdca613a
8 changed files with 146 additions and 21 deletions

View File

@ -11,7 +11,7 @@
# This file implements regression tests for SQLite library. The
# focus of this script testing the sqlite_bind API.
#
# $Id: bind.test,v 1.23 2004/11/20 20:18:55 drh Exp $
# $Id: bind.test,v 1.24 2005/01/11 16:54:15 drh Exp $
#
set testdir [file dirname $argv0]
@ -419,12 +419,28 @@ do_test bind-10.6 {
do_test bind-10.7 {
sqlite3_bind_parameter_name $VM 3
} $v2
do_test bind-10.7.1 {
sqlite3_bind_parameter_name 0 1 ;# Ignore if VM is NULL
} {}
do_test bind-10.7.2 {
sqlite3_bind_parameter_name $VM 0 ;# Ignore if index too small
} {}
do_test bind-10.7.3 {
sqlite3_bind_parameter_name $VM 4 ;# Ignore if index is too big
} {}
do_test bind-10.8 {
sqlite3_bind_int $VM 1 1
sqlite3_bind_int $VM 2 2
sqlite3_bind_int $VM 3 3
sqlite3_step $VM
} SQLITE_DONE
do_test bind-10.8.1 {
# Binding attempts after program start should fail
set rc [catch {
sqlite3_bind_int $VM 1 1
} msg]
lappend rc $msg
} {1 {}}
do_test bind-10.9 {
sqlite3_finalize $VM
} SQLITE_OK
@ -443,6 +459,9 @@ do_test bind-10.11 {
]
sqlite3_bind_parameter_count $VM
} 5
do_test bind-10.11.1 {
sqlite3_bind_parameter_index 0 :xyz ;# ignore NULL VM arguments
} 0
do_test bind-10.12 {
sqlite3_bind_parameter_index $VM :xyz
} 0

View File

@ -11,7 +11,7 @@
# This file implements regression tests for SQLite library. The
# focus of this file is testing built-in functions.
#
# $Id: func.test,v 1.30 2005/01/11 13:02:34 danielk1977 Exp $
# $Id: func.test,v 1.31 2005/01/11 16:54:15 drh Exp $
set testdir [file dirname $argv0]
source $testdir/tester.tcl
@ -248,6 +248,7 @@ do_test func-7.1 {
# Tests for aggregate functions and how they handle NULLs.
#
do_test func-8.1 {
execsql {EXPLAIN SELECT sum(a) FROM t2;}
execsql {
SELECT sum(a), count(a), round(avg(a),2), min(a), max(a), count(*) FROM t2;
}

72
test/index2.test Normal file
View File

@ -0,0 +1,72 @@
# 2005 January 11
#
# 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 the CREATE INDEX statement.
#
# $Id: index2.test,v 1.1 2005/01/11 16:54:15 drh Exp $
set testdir [file dirname $argv0]
source $testdir/tester.tcl
# Create a table with a large number of columns
#
do_test index2-1.1 {
set sql {CREATE TABLE t1(}
for {set i 1} {$i<1000} {incr i} {
append sql "c$i,"
}
append sql "c1000);"
execsql $sql
} {}
do_test index2-1.2 {
set sql {INSERT INTO t1 VALUES(}
for {set i 1} {$i<1000} {incr i} {
append sql $i,
}
append sql {1000);}
execsql $sql
} {}
do_test index2-1.3 {
execsql {SELECT c123 FROM t1}
} 123
do_test index2-1.4 {
execsql BEGIN
for {set j 1} {$j<=100} {incr j} {
set sql {INSERT INTO t1 VALUES(}
for {set i 1} {$i<1000} {incr i} {
append sql [expr {$j*10000+$i}],
}
append sql "[expr {$j*10000+1000}]);"
execsql $sql
}
execsql COMMIT
execsql {SELECT count(*) FROM t1}
} 101
do_test index2-1.5 {
execsql {SELECT round(sum(c1000)) FROM t1}
} {50601000}
# Create indices with many columns
#
do_test index2-2.1 {
set sql "CREATE INDEX t1i1 ON t1("
for {set i 1} {$i<1000} {incr i} {
append sql c$i,
}
append sql c1000)
execsql $sql
} {}
do_test index2-2.2 {
execsql {EXPLAIN SELECT c9 FROM t1 ORDER BY c1, c2, c3, c4, c5}
execsql {SELECT c9 FROM t1 ORDER BY c1, c2, c3, c4, c5, c6 LIMIT 5}
} {9 10009 20009 30009 40009}
finish_test

View File

@ -11,11 +11,13 @@
# This file implements regression tests for SQLite library. The
# focus of this script is the sqlite_interrupt() API.
#
# $Id: interrupt.test,v 1.8 2004/11/14 04:04:18 drh Exp $
# $Id: interrupt.test,v 1.9 2005/01/11 16:54:15 drh Exp $
set testdir [file dirname $argv0]
source $testdir/tester.tcl
db close
set DB [sqlite3 db test.db]
# Compute a checksum on the entire database.
#
@ -107,7 +109,15 @@ ifcapable {vacuum && !default_autovacuum} {
expr {$::origsize>[file size test.db]}
} 1
}
integrity_check interrupt-2.5
ifcapable {explain} {
do_test interrupt-2.5 {
set sql {EXPLAIN SELECT max(a,b), a, b FROM t1}
execsql $sql
set rc [catch {db eval $sql {sqlite3_interrupt $DB}} msg]
lappend rc $msg
} {1 interrupted}
}
integrity_check interrupt-2.6
# Ticket #594. If an interrupt occurs in the middle of a transaction
# and that transaction is later rolled back, the internal schema tables do