aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authordan <dan@noemail.net>2014-05-14 18:45:27 +0000
committerdan <dan@noemail.net>2014-05-14 18:45:27 +0000
commita0b7ca90b71fb47e370ecb4b2ec2f27b01dc7617 (patch)
tree2a16baadb979a542c28719136aceea32c9fe66f4 /test
parent9e83e465eba9417372f45f5d87b2cd3777690a7a (diff)
downloadsqlite-a0b7ca90b71fb47e370ecb4b2ec2f27b01dc7617.tar.gz
sqlite-a0b7ca90b71fb47e370ecb4b2ec2f27b01dc7617.zip
Fix a problem to do with loading the value of the FTS automerge setting from the database.
FossilOrigin-Name: 7268119f74602929b372b88eca7b3c3b4964f7d5
Diffstat (limited to 'test')
-rw-r--r--test/fts4growth2.test25
-rw-r--r--test/fts4merge4.test44
-rw-r--r--test/permutations.test2
3 files changed, 57 insertions, 14 deletions
diff --git a/test/fts4growth2.test b/test/fts4growth2.test
index e56309ab3..023ca8ba1 100644
--- a/test/fts4growth2.test
+++ b/test/fts4growth2.test
@@ -15,7 +15,7 @@
set testdir [file dirname $argv0]
source $testdir/tester.tcl
-set testprefix fts4growth
+set testprefix fts4growth2
# If SQLITE_ENABLE_FTS3 is defined, omit this file.
ifcapable !fts3 {
@@ -30,13 +30,12 @@ fts_kjv_genesis
proc tt {val} {
execsql {
- BEGIN;
- DELETE FROM x1
- WHERE docid IN (SELECT docid FROM t1 WHERE (rowid-1)%4==$val+0);
- INSERT INTO x1(docid, content)
- SELECT docid, words FROM t1 WHERE (rowid%4)==$val+0;
- COMMIT;
+ DELETE FROM x1
+ WHERE docid IN (SELECT docid FROM t1 WHERE (rowid-1)%4==$val+0);
+ INSERT INTO x1(docid, content)
+ SELECT docid, words FROM t1 WHERE (rowid%4)==$val+0;
}
+ #puts [db eval {SELECT level, idx, end_block FROM x1_segdir}]
}
do_execsql_test 1.1 {
@@ -45,24 +44,24 @@ do_execsql_test 1.1 {
}
do_test 1.2 {
- for {set i 0} {$i < 100} {incr i} {
+ for {set i 0} {$i < 40} {incr i} {
tt 0 ; tt 1 ; tt 2 ; tt 3
}
execsql {
SELECT max(level) FROM x1_segdir;
- SELECT count(*) FROM x1_segdir WHERE level=4;
+ SELECT count(*) FROM x1_segdir WHERE level=3;
}
-} {4 1}
+} {3 1}
do_test 1.3 {
- for {set i 0} {$i < 100} {incr i} {
+ for {set i 0} {$i < 40} {incr i} {
tt 0 ; tt 1 ; tt 2 ; tt 3
}
execsql {
SELECT max(level) FROM x1_segdir;
- SELECT count(*) FROM x1_segdir WHERE level=4;
+ SELECT count(*) FROM x1_segdir WHERE level=2;
}
-} {4 1}
+} {2 1}
#-------------------------------------------------------------------------
#
diff --git a/test/fts4merge4.test b/test/fts4merge4.test
index 8e2119de2..038e460d0 100644
--- a/test/fts4merge4.test
+++ b/test/fts4merge4.test
@@ -53,6 +53,50 @@ do_execsql_test 2.2 { SELECT count(*) FROM t1_segdir; } 35
do_execsql_test 2.3 { INSERT INTO t1(t1) VALUES('optimize') } {}
do_execsql_test 2.4 { SELECT count(*) FROM t1_segdir; } 1
+#-------------------------------------------------------------------------
+# Now test that the automerge=? option appears to work.
+#
+do_execsql_test 2.1 { CREATE VIRTUAL TABLE t2 USING fts4; }
+
+set doc ""
+foreach c1 "a b c d e f g h i j" {
+ foreach c2 "a b c d e f g h i j" {
+ foreach c3 "a b c d e f g h i j" {
+ lappend doc "$c1$c2$c3"
+ }
+ }
+}
+set doc [string repeat $doc 10]
+
+foreach {tn am expected} {
+ 1 {automerge=2} {1 1 2 1 4 1 6 1}
+ 2 {automerge=4} {1 2 2 1 3 1}
+ 3 {automerge=8} {0 4 1 3 2 1}
+ 4 {automerge=1} {0 4 1 3 2 1}
+} {
+ foreach {tn2 openclose} {1 {} 2 { db close ; sqlite3 db test.db }} {
+ do_test 2.2.$tn.$tn2 {
+ execsql { DELETE FROM t2 }
+ execsql { INSERT INTO t2(t2) VALUES($am) };
+
+ eval $openclose
+
+ for {set i 0} {$i < 100} {incr i} {
+ execsql {
+ BEGIN;
+ INSERT INTO t2 VALUES($doc);
+ INSERT INTO t2 VALUES($doc);
+ INSERT INTO t2 VALUES($doc);
+ INSERT INTO t2 VALUES($doc);
+ INSERT INTO t2 VALUES($doc);
+ COMMIT;
+ }
+ }
+
+ execsql { SELECT level, count(*) FROM t2_segdir GROUP BY level }
+ } [list {*}$expected]
+ }
+}
sqlite3_enable_shared_cache $::enable_shared_cache
finish_test
diff --git a/test/permutations.test b/test/permutations.test
index b7e1eaf8d..0e5cc2c8d 100644
--- a/test/permutations.test
+++ b/test/permutations.test
@@ -112,7 +112,7 @@ set allquicktests [test_set $alltests -exclude {
incrvacuum_ioerr.test autovacuum_crash.test btree8.test shared_err.test
vtab_err.test walslow.test walcrash.test walcrash3.test
walthread.test rtree3.test indexfault.test securedel2.test
- fts3growth2.test
+ fts4growth.test fts4growth2.test
}]
if {[info exists ::env(QUICKTEST_INCLUDE)]} {
set allquicktests [concat $allquicktests $::env(QUICKTEST_INCLUDE)]