Add a few extra tests to select9.test. (CVS 5296)

FossilOrigin-Name: 37b084fd7d7ad7f13fc9454fc25ca5aed48d4a31
This commit is contained in:
danielk1977
2008-06-24 15:39:43 +00:00
parent f6e369a119
commit 6fb6444c3e
3 changed files with 93 additions and 15 deletions
+7 -7
View File
@@ -1,5 +1,5 @@
C Fix\sa\sproblem\sin\ssqlite3ExprIsInteger()\scausing\sfailures\son\sselect1-4.9.2.\nOther\sbug\sfixes\sin\scompound-merge.\s\sThe\scompound-merge\sis\sstill\sdisabled\nin\sthis\scheck-in\susing\s"#if\s0"\sdue\sto\sadditional\sbugs.\s(CVS\s5295)
D 2008-06-24T12:46:31
C Add\sa\sfew\sextra\stests\sto\sselect9.test.\s(CVS\s5296)
D 2008-06-24T15:39:44
F Makefile.arm-wince-mingw32ce-gcc ac5f7b2cef0cd850d6f755ba6ee4ab961b1fadf7
F Makefile.in ff6f90048555a0088f6a4b7406bed5e55a7c4eff
F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654
@@ -446,7 +446,7 @@ F test/select5.test 5ad14ea338aada2e6394ba98fa9aa40e3e50aec0
F test/select6.test 399f14b9ba37b768afe5d2cd8c12e4f340a69db8
F test/select7.test 7906735805cfbee4dddc0bed4c14e68d7f5f9c5f
F test/select8.test 391de11bdd52339c30580dabbbbe97e3e9a3c79d
F test/select9.test 231bf2b40f2279202e387f2f667a0d0f9df49fca
F test/select9.test 0e1a5470bac7e6daa757d8df3fbfaee6730c544e
F test/server1.test f5b790d4c0498179151ca8a7715a65a7802c859c
F test/shared.test c6769531e0cb751d46a9838c0532d3786606c0f6
F test/shared2.test 0ee9de8964d70e451936a48c41cb161d9134ccf4
@@ -593,7 +593,7 @@ F tool/speedtest16.c c8a9c793df96db7e4933f0852abb7a03d48f2e81
F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff
F tool/speedtest8.c 1dbced29de5f59ba2ebf877edcadf171540374d1
F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
P 3117238ce9cbfc36e2de929592decef86220e2a2
R 26a607ae3a119e64f7c632da62404b44
U drh
Z bac94444cc935a7d7088735bd4cb7650
P 95037e6dbf4ed0ffd38790f3270dcaa4c1ae64ed
R 879d6fa70b53daac352e6369bd96ed5f
U danielk1977
Z 2e92c316b0879406df658fc531e7ea9a
+1 -1
View File
@@ -1 +1 @@
95037e6dbf4ed0ffd38790f3270dcaa4c1ae64ed
37b084fd7d7ad7f13fc9454fc25ca5aed48d4a31
+85 -7
View File
@@ -10,7 +10,7 @@
#***********************************************************************
# This file implements regression tests for SQLite library.
#
# $Id: select9.test,v 1.1 2008/06/24 11:21:21 danielk1977 Exp $
# $Id: select9.test,v 1.2 2008/06/24 15:39:44 danielk1977 Exp $
# The tests in this file are focused on test compound SELECT statements
# that have any or all of an ORDER BY, LIMIT or OFFSET clauses. As of
@@ -25,6 +25,8 @@
set testdir [file dirname $argv0]
source $testdir/tester.tcl
#set ISQUICK 1
#-------------------------------------------------------------------------
# test_compound_select TESTNAME SELECT RESULT
#
@@ -59,13 +61,17 @@ proc test_compound_select {testname sql result} {
#return
set iLimitIncr 1
set iLimitEnd [expr $nRow+1]
set iOffsetIncr 1
set iOffsetEnd $nRow
if {[info exists ::ISQUICK] && $::ISQUICK && $nRow>=5} {
set iOffsetIncr [expr $nRow / 5]
set iLimitIncr [expr $nRow / 5]
}
for {set iOffset 0} {$iOffset <= $iOffsetEnd} {incr iOffset $iOffsetIncr} {
for {set iLimit 0} {$iLimit <= ($nRow+1)} {incr iLimit} {
set iLimitEnd [expr $nRow+$iLimitIncr]
set iOffsetEnd [expr $nRow+$iOffsetIncr]
for {set iOffset 0} {$iOffset < $iOffsetEnd} {incr iOffset $iOffsetIncr} {
for {set iLimit 0} {$iLimit < $iLimitEnd} {incr iLimit} {
set ::compound_sql "$sql LIMIT $iLimit"
if {$iOffset != 0} {
@@ -250,5 +256,77 @@ foreach indexes [list {
incr iOuterLoop
}
finish_test
do_test select9-2.0 {
execsql {
DROP INDEX i1;
DROP INDEX i2;
DROP INDEX i3;
DROP INDEX i4;
}
} {}
proc reverse {lhs rhs} {
return [string compare $rhs $lhs]
}
db collate reverse reverse
# This loop is similar to the previous one (test cases select9-1.*)
# except that the simple select statements have WHERE clauses attached
# to them. Sometimes the WHERE clause may be satisfied using the same
# index used for ORDER BY, sometimes not.
#
set iOuterLoop 1
foreach indexes [list {
/* Do not create any indexes. */
} {
CREATE INDEX i1 ON t1(a)
} {
DROP INDEX i1;
CREATE INDEX i1 ON t1(b, a)
} {
CREATE INDEX i2 ON t2(d DESC, e COLLATE REVERSE ASC);
} {
CREATE INDEX i3 ON t1(a DESC);
}] {
do_test select9-2.$iOuterLoop.1 {
execsql $indexes
} {}
test_compound_select_flippable select9-2.$iOuterLoop.2 {
SELECT * FROM t1 WHERE a<5 UNION SELECT * FROM t2 WHERE d>=5 ORDER BY 1
} {1 one I 2 two II 3 {} {} 4 four IV 5 ten XX 6 {} {} 7 fourteen XXVIII 8 sixteen XXXII 9 {} {} 10 twenty XL}
test_compound_select_flippable select9-2.$iOuterLoop.2 {
SELECT * FROM t1 WHERE a<5 UNION SELECT * FROM t2 WHERE d>=5 ORDER BY 2, 1
} {3 {} {} 6 {} {} 9 {} {} 4 four IV 7 fourteen XXVIII 1 one I 8 sixteen XXXII 5 ten XX 10 twenty XL 2 two II}
test_compound_select_flippable select9-2.$iOuterLoop.3 {
SELECT * FROM t1 WHERE a<5 UNION SELECT * FROM t2 WHERE d>=5
ORDER BY 2 COLLATE reverse, 1
} {3 {} {} 6 {} {} 9 {} {} 2 two II 10 twenty XL 5 ten XX 8 sixteen XXXII 1 one I 7 fourteen XXVIII 4 four IV}
test_compound_select_flippable select9-2.$iOuterLoop.4 {
SELECT * FROM t1 WHERE a<5 UNION ALL SELECT * FROM t2 WHERE d>=5 ORDER BY 1
} {1 one I 2 two II 3 {} {} 4 four IV 5 ten XX 6 {} {} 7 fourteen XXVIII 8 sixteen XXXII 9 {} {} 10 twenty XL}
test_compound_select_flippable select9-2.$iOuterLoop.5 {
SELECT * FROM t1 WHERE a<5 UNION ALL SELECT * FROM t2 WHERE d>=5 ORDER BY 2, 1
} {3 {} {} 6 {} {} 9 {} {} 4 four IV 7 fourteen XXVIII 1 one I 8 sixteen XXXII 5 ten XX 10 twenty XL 2 two II}
test_compound_select_flippable select9-2.$iOuterLoop.6 {
SELECT * FROM t1 WHERE a<5 UNION ALL SELECT * FROM t2 WHERE d>=5
ORDER BY 2 COLLATE reverse, 1
} {3 {} {} 6 {} {} 9 {} {} 2 two II 10 twenty XL 5 ten XX 8 sixteen XXXII 1 one I 7 fourteen XXVIII 4 four IV}
test_compound_select select9-2.$iOuterLoop.4 {
SELECT a FROM t1 WHERE a<8 EXCEPT SELECT d FROM t2 WHERE d<=3 ORDER BY 1
} {4 5 6 7}
test_compound_select select9-2.$iOuterLoop.4 {
SELECT a FROM t1 WHERE a<8 INTERSECT SELECT d FROM t2 WHERE d<=3 ORDER BY 1
} {1 2 3}
}
finish_test