1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-08-08 14:02:16 +03:00

Add comments to test cases. Improvements to the query plan test variable. (CVS 2555)

FossilOrigin-Name: ef3a157f469d72cbd2f713f997598ddf47f340d2
This commit is contained in:
drh
2005-07-21 03:48:20 +00:00
parent fe05af87f8
commit 7ec764a29e
6 changed files with 81 additions and 19 deletions

View File

@@ -13,7 +13,7 @@
# This file implements tests for the special processing associated
# with INTEGER PRIMARY KEY columns.
#
# $Id: intpkey.test,v 1.22 2005/03/31 18:40:05 drh Exp $
# $Id: intpkey.test,v 1.23 2005/07/21 03:48:20 drh Exp $
set testdir [file dirname $argv0]
source $testdir/tester.tcl
@@ -119,11 +119,14 @@ do_test intpkey-1.11 {
# Make sure SELECT statements are able to use the primary key column
# as an index.
#
do_test intpkey-1.12 {
do_test intpkey-1.12.1 {
execsql {
SELECT * FROM t1 WHERE a==4;
}
} {4 one two}
do_test intpkey-1.12.2 {
set sqlite_query_plan
} {t1 *}
# Try to insert a non-integer value into the primary key field. This
# should result in a data type mismatch.

View File

@@ -11,7 +11,7 @@
# This file implements regression tests for SQLite library. The
# focus of this script is testing correlated subqueries
#
# $Id: subquery.test,v 1.10 2005/07/21 03:15:01 drh Exp $
# $Id: subquery.test,v 1.11 2005/07/21 03:48:20 drh Exp $
#
set testdir [file dirname $argv0]
@@ -221,18 +221,28 @@ do_test subquery-2.5.1 {
}
} {}
do_test subquery-2.5.2 {
# In the expr "x IN (SELECT a FROM t3)" the RHS of the IN operator
# has text affinity and the LHS has integer affinity. The rule is
# that we try to convert both sides to an integer before doing the
# comparision. Hence, the integer value 10 in t3 will compare equal
# to the string value '10.0' in t4 because the t4 value will be
# converted into an integer.
execsql {
SELECT * FROM t4 WHERE x IN (SELECT a FROM t3);
}
} {10.0}
do_test subquery-2.5.3 {
do_test subquery-2.5.3.1 {
# The t4i index cannot be used to resolve the "x IN (...)" constraint
# because the constraint has integer affinity but t4i has text affinity.
execsql {
CREATE INDEX t4i ON t4(x);
--pragma vdbe_listing=on; pragma vdbe_trace=on;
SELECT * FROM t4 WHERE x IN (SELECT a FROM t3);
}
} {10.0}
#exit
do_test subquery-2.5.3.2 {
# Verify that the t4i index was not used in the previous query
set ::sqlite_query_plan
} {t4 {}}
do_test subquery-2.5.4 {
execsql {
DROP TABLE t3;

View File

@@ -11,7 +11,7 @@
# This file implements regression tests for SQLite library. The
# focus of this file is testing the use of indices in WHERE clases.
#
# $Id: where.test,v 1.30 2005/07/15 23:24:25 drh Exp $
# $Id: where.test,v 1.31 2005/07/21 03:48:20 drh Exp $
set testdir [file dirname $argv0]
source $testdir/tester.tcl
@@ -78,7 +78,7 @@ do_test where-1.4 {
count {SELECT x, y FROM t1 WHERE 11=w AND x>2}
} {3 144 3}
do_test where-1.4.2 {
set sqlite_query_plan
set sqlite_query_plan
} {t1 i1w}
do_test where-1.5 {
count {SELECT x, y FROM t1 WHERE y<200 AND w=11 AND x>2}