Add test for FTS 'rebuild' command.

FossilOrigin-Name: 181bc35731f19c3e4497ba3338c209918d34ea69
This commit is contained in:
dan 2012-03-02 16:18:21 +00:00
parent 8fb662b0be
commit c0db214b10
3 changed files with 36 additions and 18 deletions

View File

@ -1,5 +1,5 @@
C Fix\sthe\sFTS\s'optimize'\scommand\son\smulti-lingual\sdatabases.
D 2012-03-02T12:26:19.396
C Add\stest\sfor\sFTS\s'rebuild'\scommand.
D 2012-03-02T16:18:21.845
F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
F Makefile.in 3f79a373e57c3b92dabf76f40b065e719d31ac34
F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
@ -496,7 +496,7 @@ F test/fts3snippet.test 8e956051221a34c7daeb504f023cb54d5fa5a8b2
F test/fts3sort.test 95be0b19d7e41c44b29014f13ea8bddd495fd659
F test/fts4aa.test 6e7f90420b837b2c685f3bcbe84c868492d40a68
F test/fts4content.test 17b2360f7d1a9a7e5aa8022783f5c5731b6dfd4f
F test/fts4langid.test a793f2da4cbe9c8ad2f49d2a013c6a0ff61e1783
F test/fts4langid.test 343a65d54419b45a318a1acdb1c37749f26fdc79
F test/func.test 6c5ce11e3a0021ca3c0649234e2d4454c89110ca
F test/func2.test 772d66227e4e6684b86053302e2d74a2500e1e0f
F test/func3.test 001021e5b88bd02a3b365a5c5fd8f6f49d39744a
@ -992,7 +992,7 @@ F tool/tostr.awk e75472c2f98dd76e06b8c9c1367f4ab07e122d06
F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f
F tool/warnings-clang.sh 9f406d66e750e8ac031c63a9ef3248aaa347ef2a
F tool/warnings.sh fbc018d67fd7395f440c28f33ef0f94420226381
P d281cb8984c911a4c0cce2ec299e1351d8e580e4
R 2e9c73a6dc49c268fdce6f613b343e49
P 65fa693729a336e4d905ce72e6b9ccf4faa772bd
R 4e2c13b79ff592d73e478288d906b721
U dan
Z bf6a4c44b9753bccc8cfbcc7423214ad
Z bcf6ed8432a11d3fdd53825eba08d4d7

View File

@ -1 +1 @@
65fa693729a336e4d905ce72e6b9ccf4faa772bd
181bc35731f19c3e4497ba3338c209918d34ea69

View File

@ -30,19 +30,21 @@ set ::testprefix fts4langid
# 1.* - Warm-body tests created for specific purposes during development.
# Passing these doesn't really prove much.
#
# 2.* - Test that FTS queries only ever return rows associated with
# the requested language.
# 2.1.* - Test that FTS queries only ever return rows associated with
# the requested language.
#
# 3.* - Test that the 'optimize' and 'rebuild' commands work correctly.
# 2.2.* - Same as 2.1.*, after an 'optimize' command.
#
# 4.* - Test that if one is provided, the tokenizer xLanguage method
# 2.3.* - Same as 2.1.*, after a 'rebuild' command.
#
# 3.* - Test that if one is provided, the tokenizer xLanguage method
# is called to configure the tokenizer before tokenizing query
# or document text.
#
# 5.* - Test the fts4aux table when the associated FTS4 table contains
# 4.* - Test the fts4aux table when the associated FTS4 table contains
# multiple languages.
#
# 6.* - Tests with content= tables. Both where there is a real
# 5.* - Tests with content= tables. Both where there is a real
# underlying content table and where there is not.
#
@ -124,7 +126,6 @@ do_execsql_test 1.18 {
#-------------------------------------------------------------------------
# Test cases 2.*
#
proc build_multilingual_db_1 {db} {
$db eval { CREATE VIRTUAL TABLE t2 USING fts4(x, y, languageid=l) }
@ -258,16 +259,33 @@ do_test_2 1.4 {"zero one" OR "one two"} {
# Now try the same tests as above, but after running the 'optimize'
# command on the FTS table.
#
do_execsql_test 2.2 {
INSERT INTO t2(t2) VALUES('optimize');
SELECT count(*) FROM t2_segdir;
} {9}
do_test_2 2.1 {delta} { rowid_list delta }
do_test_2 2.2 {"zero one two"} { rowid_list "zero one two" }
do_test_2 2.3 {zero one two} {
do_test_2 2.1 {delta} { rowid_list delta }
do_test_2 2.2 {"zero one two"} { rowid_list "zero one two" }
do_test_2 2.3 {zero one two} {
and_merge_lists [rowid_list zero] [rowid_list one] [rowid_list two]
}
do_test_2 2.4 {"zero one" OR "one two"} {
do_test_2 2.4 {"zero one" OR "one two"} {
or_merge_lists [rowid_list "zero one"] [rowid_list "one two"]
}
# And rebuild.
#
do_test 2.3 {
reset_db
build_multilingual_db_1 db
execsql { INSERT INTO t2(t2) VALUES('rebuild') }
} {}
do_test_2 3.1 {delta} { rowid_list delta }
do_test_2 3.2 {"zero one two"} { rowid_list "zero one two" }
do_test_2 3.3 {zero one two} {
and_merge_lists [rowid_list zero] [rowid_list one] [rowid_list two]
}
do_test_2 3.4 {"zero one" OR "one two"} {
or_merge_lists [rowid_list "zero one"] [rowid_list "one two"]
}