mirror of
https://github.com/sqlite/sqlite.git
synced 2025-08-10 01:02:56 +03:00
Add a couple of extra tests.
FossilOrigin-Name: aefd46dfae7e06fbaf4f2b9a86a7f2ac6927331e
This commit is contained in:
12
manifest
12
manifest
@@ -1,5 +1,5 @@
|
|||||||
C Fix\sanother\sbug\scaused\sby\sNEAR/matchinfo/order=DESC\sinteraction.
|
C Add\sa\scouple\sof\sextra\stests.
|
||||||
D 2011-06-14T09:00:27.140
|
D 2011-06-14T11:32:50.766
|
||||||
F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
|
F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
|
||||||
F Makefile.in c1d7a7f4fd8da6b1815032efca950e3d5125407e
|
F Makefile.in c1d7a7f4fd8da6b1815032efca950e3d5125407e
|
||||||
F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
|
F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
|
||||||
@@ -455,7 +455,7 @@ F test/fts3am.test 218aa6ba0dfc50c7c16b2022aac5c6be593d08d8
|
|||||||
F test/fts3an.test a49ccadc07a2f7d646ec1b81bc09da2d85a85b18
|
F test/fts3an.test a49ccadc07a2f7d646ec1b81bc09da2d85a85b18
|
||||||
F test/fts3ao.test b83f99f70e9eec85f27d75801a974b3f820e01f9
|
F test/fts3ao.test b83f99f70e9eec85f27d75801a974b3f820e01f9
|
||||||
F test/fts3atoken.test 402ef2f7c2fb4b3d4fa0587df6441c1447e799b3
|
F test/fts3atoken.test 402ef2f7c2fb4b3d4fa0587df6441c1447e799b3
|
||||||
F test/fts3auto.test 337dff2758887bfe7d337f76d25cc48db6e26f28
|
F test/fts3auto.test 2f86f2a0e8ffa26d81d570897e6cc1c2262256d5
|
||||||
F test/fts3aux1.test 0b02743955d56fc0d4d66236a26177bd1b726de0
|
F test/fts3aux1.test 0b02743955d56fc0d4d66236a26177bd1b726de0
|
||||||
F test/fts3b.test e93bbb653e52afde110ad53bbd793f14fe7a8984
|
F test/fts3b.test e93bbb653e52afde110ad53bbd793f14fe7a8984
|
||||||
F test/fts3c.test fc723a9cf10b397fdfc2b32e73c53c8b1ec02958
|
F test/fts3c.test fc723a9cf10b397fdfc2b32e73c53c8b1ec02958
|
||||||
@@ -945,7 +945,7 @@ F tool/split-sqlite3c.tcl d9be87f1c340285a3e081eb19b4a247981ed290c
|
|||||||
F tool/symbols.sh bc2a3709940d47c8ac8e0a1fdf17ec801f015a00
|
F tool/symbols.sh bc2a3709940d47c8ac8e0a1fdf17ec801f015a00
|
||||||
F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f
|
F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f
|
||||||
F tool/warnings.sh 347d974d143cf132f953b565fbc03026f19fcb4d
|
F tool/warnings.sh 347d974d143cf132f953b565fbc03026f19fcb4d
|
||||||
P 135ce30f62ebd6a1b239c18dbbd9c926ea507db4
|
P 04907fbadeb743c95cc9f3529e63ef388684799f
|
||||||
R 6437acdf1435a01de33437d42862b03a
|
R 84da75d7a3a06308ee488ec7371657d8
|
||||||
U dan
|
U dan
|
||||||
Z 0ea30b6b1ae90b1e541e7d3c3cb40fc6
|
Z 0b29b5535d6bfbaa65e9d19cac80576d
|
||||||
|
@@ -1 +1 @@
|
|||||||
04907fbadeb743c95cc9f3529e63ef388684799f
|
aefd46dfae7e06fbaf4f2b9a86a7f2ac6927331e
|
@@ -21,10 +21,14 @@ set sfep $sqlite_fts3_enable_parentheses
|
|||||||
set sqlite_fts3_enable_parentheses 1
|
set sqlite_fts3_enable_parentheses 1
|
||||||
|
|
||||||
#--------------------------------------------------------------------------
|
#--------------------------------------------------------------------------
|
||||||
# Start of Tcl infrastructure used by tests. The entry point is
|
# Start of Tcl infrastructure used by tests. The entry points are:
|
||||||
# [do_fts3query_test] (described below).
|
#
|
||||||
|
# do_fts3query_test
|
||||||
|
# fts3_make_deferrable
|
||||||
|
# fts3_zero_long_segments
|
||||||
#
|
#
|
||||||
|
|
||||||
|
#
|
||||||
# do_fts3query_test TESTNAME ?OPTIONS? TABLE MATCHEXPR
|
# do_fts3query_test TESTNAME ?OPTIONS? TABLE MATCHEXPR
|
||||||
#
|
#
|
||||||
# This proc runs several test cases on FTS3/4 table $TABLE using match
|
# This proc runs several test cases on FTS3/4 table $TABLE using match
|
||||||
@@ -103,6 +107,38 @@ proc do_fts3query_test {tn args} {
|
|||||||
" $matchinfo_asc
|
" $matchinfo_asc
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# fts3_make_deferrable TABLE TOKEN
|
||||||
|
#
|
||||||
|
proc fts3_make_deferrable {tbl token} {
|
||||||
|
|
||||||
|
set stmt [sqlite3_prepare db "SELECT * FROM $tbl" -1 dummy]
|
||||||
|
set name [sqlite3_column_name $stmt 0]
|
||||||
|
sqlite3_finalize $stmt
|
||||||
|
|
||||||
|
set nRow [db one "SELECT count(*) FROM $tbl"]
|
||||||
|
set pgsz [db one "PRAGMA page_size"]
|
||||||
|
execsql BEGIN
|
||||||
|
for {set i 0} {$i < ($nRow * $pgsz * 1.2)/100} {incr i} {
|
||||||
|
set doc [string repeat "$token " 100]
|
||||||
|
execsql "INSERT INTO $tbl ($name) VALUES(\$doc)"
|
||||||
|
}
|
||||||
|
execsql "INSERT INTO $tbl ($name) VALUES('aaaaaaa ${token}aaaaa')"
|
||||||
|
execsql COMMIT
|
||||||
|
|
||||||
|
return [expr $nRow*$pgsz]
|
||||||
|
}
|
||||||
|
|
||||||
|
# fts3_zero_long_segments TABLE ?LIMIT?
|
||||||
|
#
|
||||||
|
proc fts3_zero_long_segments {tbl limit} {
|
||||||
|
execsql "
|
||||||
|
UPDATE ${tbl}_segments
|
||||||
|
SET block = zeroblob(length(block))
|
||||||
|
WHERE length(block)>$limit
|
||||||
|
"
|
||||||
|
return [db changes]
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
proc mit {blob} {
|
proc mit {blob} {
|
||||||
set scan(littleEndian) i*
|
set scan(littleEndian) i*
|
||||||
@@ -414,17 +450,6 @@ foreach {tn create} {
|
|||||||
#--------------------------------------------------------------------------
|
#--------------------------------------------------------------------------
|
||||||
# Some test cases involving deferred tokens.
|
# Some test cases involving deferred tokens.
|
||||||
#
|
#
|
||||||
proc make_token_deferrable {tbl token} {
|
|
||||||
set nRow [db one "SELECT count(*) FROM $tbl"]
|
|
||||||
set pgsz [db one "PRAGMA page_size"]
|
|
||||||
execsql BEGIN
|
|
||||||
for {set i 0} {$i < ($nRow * $pgsz * 1.2)/100} {incr i} {
|
|
||||||
set doc [string repeat "$token " 100]
|
|
||||||
execsql "INSERT INTO $tbl VALUES(\$doc)"
|
|
||||||
}
|
|
||||||
execsql "INSERT INTO $tbl VALUES('aaaaaaa ${token}aaaaa')"
|
|
||||||
execsql COMMIT
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach {tn create} {
|
foreach {tn create} {
|
||||||
1 "fts4(x)"
|
1 "fts4(x)"
|
||||||
@@ -444,19 +469,14 @@ foreach {tn create} {
|
|||||||
INSERT INTO t1(docid, x) VALUES(6, 'c a b');
|
INSERT INTO t1(docid, x) VALUES(6, 'c a b');
|
||||||
}
|
}
|
||||||
|
|
||||||
make_token_deferrable t1 c
|
set limit [fts3_make_deferrable t1 c]
|
||||||
|
|
||||||
foreach {tn2 expr} {
|
do_fts3query_test 3.$tn.2.1 t1 {a OR c}
|
||||||
1 {a OR c}
|
|
||||||
} {
|
do_test 3.$tn.3 {
|
||||||
do_fts3query_test 3.$tn.2.$tn2 t1 $expr
|
fts3_zero_long_segments t1 $limit
|
||||||
}
|
} {1}
|
||||||
|
|
||||||
execsql {
|
|
||||||
UPDATE t1_segments
|
|
||||||
SET block = zeroblob(length(block))
|
|
||||||
WHERE length(block)>10000 AND 0
|
|
||||||
}
|
|
||||||
foreach {tn2 expr def} {
|
foreach {tn2 expr def} {
|
||||||
1 {a NEAR c} {}
|
1 {a NEAR c} {}
|
||||||
2 {a AND c} c
|
2 {a AND c} c
|
||||||
@@ -465,36 +485,49 @@ foreach {tn create} {
|
|||||||
5 {"a c" NEAR/1 g} {}
|
5 {"a c" NEAR/1 g} {}
|
||||||
6 {"a c" NEAR/0 g} {}
|
6 {"a c" NEAR/0 g} {}
|
||||||
} {
|
} {
|
||||||
do_fts3query_test 3.$tn.2.$tn2 -deferred $def t1 $expr
|
do_fts3query_test 3.$tn.4.$tn2 -deferred $def t1 $expr
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#--------------------------------------------------------------------------
|
#--------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
foreach {tn create} {
|
foreach {tn create} {
|
||||||
1 "fts4(x, y)"
|
1 "fts4(x, y)"
|
||||||
2 "fts4(x, y, order=DESC)"
|
2 "fts4(x, y, order=DESC)"
|
||||||
|
3 "fts4(x, y, order=DESC, prefix=2)"
|
||||||
} {
|
} {
|
||||||
catchsql { DROP TABLE t1 }
|
|
||||||
execsql "CREATE VIRTUAL TABLE t1 USING $create"
|
|
||||||
|
|
||||||
foreach {x y} {
|
execsql [subst {
|
||||||
{one two five four five} {}
|
DROP TABLE t1;
|
||||||
{} {one two five four five}
|
CREATE VIRTUAL TABLE t1 USING $create;
|
||||||
{one two} {five four five}
|
INSERT INTO t1 VALUES('one two five four five', '');
|
||||||
} {
|
INSERT INTO t1 VALUES('', 'one two five four five');
|
||||||
execsql {INSERT INTO t1 VALUES($x, $y)}
|
INSERT INTO t1 VALUES('one two', 'five four five');
|
||||||
}
|
}]
|
||||||
|
|
||||||
foreach {tn2 expr} {
|
do_fts3query_test 4.$tn.1.1 t1 {one AND five}
|
||||||
1 {one AND five}
|
do_fts3query_test 4.$tn.1.2 t1 {one NEAR five}
|
||||||
2 {one NEAR five}
|
do_fts3query_test 4.$tn.1.3 t1 {one NEAR/1 five}
|
||||||
3 {one NEAR/1 five}
|
do_fts3query_test 4.$tn.1.4 t1 {one NEAR/2 five}
|
||||||
4 {one NEAR/2 five}
|
do_fts3query_test 4.$tn.1.5 t1 {one NEAR/3 five}
|
||||||
5 {one NEAR/3 five}
|
|
||||||
} {
|
do_test 4.$tn.2 {
|
||||||
do_fts3query_test 4.$tn.2.$tn2 t1 $expr
|
set limit [fts3_make_deferrable t1 five]
|
||||||
}
|
execsql { INSERT INTO t1(t1) VALUES('optimize') }
|
||||||
|
expr {[fts3_zero_long_segments t1 $limit]>0}
|
||||||
|
} {1}
|
||||||
|
|
||||||
|
do_fts3query_test 4.$tn.3.1 -deferred five t1 {one AND five}
|
||||||
|
do_fts3query_test 4.$tn.3.2 -deferred five t1 {one NEAR five}
|
||||||
|
do_fts3query_test 4.$tn.3.3 -deferred five t1 {one NEAR/1 five}
|
||||||
|
do_fts3query_test 4.$tn.3.4 -deferred five t1 {one NEAR/2 five}
|
||||||
|
do_fts3query_test 4.$tn.3.5 -deferred five t1 {one NEAR/3 five}
|
||||||
|
|
||||||
|
do_fts3query_test 4.$tn.4.1 -deferred fi* t1 {on* AND fi*}
|
||||||
|
do_fts3query_test 4.$tn.4.2 -deferred fi* t1 {on* NEAR fi*}
|
||||||
|
do_fts3query_test 4.$tn.4.3 -deferred fi* t1 {on* NEAR/1 fi*}
|
||||||
|
do_fts3query_test 4.$tn.4.4 -deferred fi* t1 {on* NEAR/2 fi*}
|
||||||
|
do_fts3query_test 4.$tn.4.5 -deferred fi* t1 {on* NEAR/3 fi*}
|
||||||
}
|
}
|
||||||
|
|
||||||
set sqlite_fts3_enable_parentheses $sfep
|
set sqlite_fts3_enable_parentheses $sfep
|
||||||
|
Reference in New Issue
Block a user