Add further fts5 tests. 100% code coverage is finally restored.
FossilOrigin-Name: b914ece0d146cfc8adba4dc4e8633e14f174d6ea
This commit is contained in:
parent
6d3c2889ec
commit
4684ffd495
@ -15,6 +15,11 @@ if {![info exists testdir]} {
|
||||
}
|
||||
source $testdir/tester.tcl
|
||||
|
||||
ifcapable !fts5 {
|
||||
finish_test
|
||||
return
|
||||
}
|
||||
|
||||
catch {
|
||||
sqlite3_fts5_may_be_corrupt 0
|
||||
reset_db
|
||||
|
67
ext/fts5/test/fts5bigtok.test
Normal file
67
ext/fts5/test/fts5bigtok.test
Normal file
@ -0,0 +1,67 @@
|
||||
# 2016 Jan 19
|
||||
#
|
||||
# The author disclaims copyright to this source code. In place of
|
||||
# a legal notice, here is a blessing:
|
||||
#
|
||||
# May you do good and not evil.
|
||||
# May you find forgiveness for yourself and forgive others.
|
||||
# May you share freely, never taking more than you give.
|
||||
#
|
||||
#*************************************************************************
|
||||
# This file implements regression tests for SQLite library. The
|
||||
# focus of this script is testing the FTS5 module.
|
||||
#
|
||||
|
||||
source [file join [file dirname [info script]] fts5_common.tcl]
|
||||
set testprefix fts5bigtok
|
||||
|
||||
proc rndterm {} {
|
||||
set L [list a b c d e f g h i j k l m n o p q r s t u v w x y z]
|
||||
set l [lindex $L [expr int(rand() * [llength $L])]]
|
||||
string repeat $l [expr int(rand() * 5) + 60]
|
||||
}
|
||||
|
||||
proc rnddoc {n} {
|
||||
set res [list]
|
||||
for {set i 0} {$i < $n} {incr i} {
|
||||
lappend res [rndterm]
|
||||
}
|
||||
set res
|
||||
}
|
||||
|
||||
foreach_detail_mode $::testprefix {
|
||||
db func rnddoc rnddoc
|
||||
do_execsql_test 1.0 {
|
||||
CREATE VIRTUAL TABLE t1 USING fts5(x, detail=%DETAIL%);
|
||||
INSERT INTO t1(t1, rank) VALUES('pgsz', 32);
|
||||
CREATE VIRTUAL TABLE t1vocab USING fts5vocab(t1, row);
|
||||
|
||||
WITH s(i) AS ( SELECT 1 UNION ALL SELECT i+1 FROM s WHERE i<10 )
|
||||
INSERT INTO t1 SELECT rnddoc(3) FROM s;
|
||||
|
||||
WITH s(i) AS ( SELECT 1 UNION ALL SELECT i+1 FROM s WHERE i<10 )
|
||||
INSERT INTO t1 SELECT rnddoc(3) FROM s;
|
||||
}
|
||||
|
||||
foreach v [db eval {SELECT term FROM t1vocab}] {
|
||||
set res [db eval {SELECT rowid FROM t1($v)}]
|
||||
do_execsql_test 1.[string range $v 0 0] {
|
||||
SELECT rowid FROM t1($v) ORDER BY rowid DESC
|
||||
} [lsort -integer -decr $res]
|
||||
}
|
||||
|
||||
do_execsql_test 2.0 {
|
||||
INSERT INTO t1(t1) VALUES('optimize');
|
||||
}
|
||||
|
||||
foreach v [db eval {SELECT term FROM t1vocab}] {
|
||||
set res [db eval {SELECT rowid FROM t1($v)}]
|
||||
do_execsql_test 2.[string range $v 0 0] {
|
||||
SELECT rowid FROM t1($v) ORDER BY rowid DESC
|
||||
} [lsort -integer -decr $res]
|
||||
}
|
||||
}
|
||||
|
||||
finish_test
|
||||
|
||||
|
@ -145,10 +145,69 @@ do_execsql_test 5.2 {
|
||||
INSERT INTO gg(gg) VALUES('optimize');
|
||||
}
|
||||
|
||||
breakpoint
|
||||
do_execsql_test 5.3 {
|
||||
INSERT INTO gg(gg) VALUES('integrity-check');
|
||||
}
|
||||
|
||||
do_test 5.4.1 {
|
||||
set ok 0
|
||||
for {set i 0} {$i < 10000} {incr i} {
|
||||
set T [format %.5d $i]
|
||||
set res [db eval { SELECT rowid FROM gg($T) ORDER BY rowid ASC }]
|
||||
set res2 [db eval { SELECT rowid FROM gg($T) ORDER BY rowid DESC }]
|
||||
if {$res == [lsort -integer $res2]} { incr ok }
|
||||
}
|
||||
set ok
|
||||
} {10000}
|
||||
|
||||
do_test 5.4.2 {
|
||||
set ok 0
|
||||
for {set i 0} {$i < 100} {incr i} {
|
||||
set T "[format %.3d $i]*"
|
||||
set res [db eval { SELECT rowid FROM gg($T) ORDER BY rowid ASC }]
|
||||
set res2 [db eval { SELECT rowid FROM gg($T) ORDER BY rowid DESC }]
|
||||
if {$res == [lsort -integer $res2]} { incr ok }
|
||||
}
|
||||
set ok
|
||||
} {100}
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
# Similar to 5.*.
|
||||
#
|
||||
foreach {tn pgsz} {
|
||||
1 32
|
||||
2 36
|
||||
3 40
|
||||
4 44
|
||||
5 48
|
||||
} {
|
||||
do_execsql_test 6.$tn.1 {
|
||||
DROP TABLE IF EXISTS hh;
|
||||
CREATE VIRTUAL TABLE hh USING fts5(y);
|
||||
INSERT INTO hh(hh, rank) VALUES('pgsz', $pgsz);
|
||||
|
||||
WITH s(i) AS (SELECT 0 UNION ALL SELECT i+1 FROM s WHERE i<999)
|
||||
INSERT INTO hh SELECT printf("%.3d%.3d%.3d %.3d%.3d%.3d",i,i,i,i+1,i+1,i+1)
|
||||
FROM s;
|
||||
|
||||
WITH s(i) AS (SELECT 0 UNION ALL SELECT i+1 FROM s WHERE i<999)
|
||||
INSERT INTO hh SELECT printf("%.3d%.3d%.3d %.3d%.3d%.3d",i,i,i,i+1,i+1,i+1)
|
||||
FROM s;
|
||||
|
||||
INSERT INTO hh(hh) VALUES('optimize');
|
||||
}
|
||||
|
||||
do_test 6.$tn.2 {
|
||||
set ok 0
|
||||
for {set i 0} {$i < 1000} {incr i} {
|
||||
set T [format %.3d%.3d%.3d $i $i $i]
|
||||
set res [db eval { SELECT rowid FROM hh($T) ORDER BY rowid ASC }]
|
||||
set res2 [db eval { SELECT rowid FROM hh($T) ORDER BY rowid DESC }]
|
||||
if {$res == [lsort -integer $res2]} { incr ok }
|
||||
}
|
||||
set ok
|
||||
} {1000}
|
||||
}
|
||||
|
||||
finish_test
|
||||
|
||||
|
@ -202,8 +202,12 @@ do_execsql_test 6.0 {
|
||||
} {32}
|
||||
|
||||
do_execsql_test 6.1 {
|
||||
DELETE FROM x5 WHERE rowid=1;
|
||||
UPDATE x5 SET x='a b c d e f' WHERE rowid=2;
|
||||
DELETE FROM x5 WHERE rowid <= 2;
|
||||
SELECT count(fts5_decode_none(rowid, block)) FROM x5_data;
|
||||
} {34}
|
||||
|
||||
do_execsql_test 6.2 {
|
||||
UPDATE x5 SET x='a b c d e f' WHERE rowid=3;
|
||||
SELECT count(fts5_decode_none(rowid, block)) FROM x5_data;
|
||||
} {36}
|
||||
|
||||
|
17
manifest
17
manifest
@ -1,5 +1,5 @@
|
||||
C Add\stests\sfor\sfts5.\sFix\sa\scrash\sthat\scan\soccur\sin\sfts5\sif\sthe\sdatabase\scontent\sis\scorrupted.
|
||||
D 2016-01-18T17:48:28.938
|
||||
C Add\sfurther\sfts5\stests.\s100%\scode\scoverage\sis\sfinally\srestored.
|
||||
D 2016-01-19T16:06:23.776
|
||||
F Makefile.in a476545d0c8626224d0bacac85c6e2967474af81
|
||||
F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434
|
||||
F Makefile.msc 01e855f958932d0d3ed62ec675fc63e2cef61fcb
|
||||
@ -115,7 +115,7 @@ F ext/fts5/fts5_varint.c 3f86ce09cab152e3d45490d7586b7ed2e40c13f1
|
||||
F ext/fts5/fts5_vocab.c ee6df1a3be103414d7b7af833ae1885c7b83a9d0
|
||||
F ext/fts5/fts5parse.y 1647eba089b9b3fc058b4dc989d9da87d15b9580
|
||||
F ext/fts5/mkportersteps.tcl 5acf962d2e0074f701620bb5308155fa1e4a63ba
|
||||
F ext/fts5/test/fts5_common.tcl cf6392ed5bd3e1e2c9eaff6a6409d9f0cfcc1efa
|
||||
F ext/fts5/test/fts5_common.tcl 6d0d74b695c4be055a8ba1dd807f22a2abc95b5e
|
||||
F ext/fts5/test/fts5aa.test 7e814df4a0e6c22a6fe2d84f210fdc0b5068a084
|
||||
F ext/fts5/test/fts5ab.test 30325a89453280160106be411bba3acf138e6d1b
|
||||
F ext/fts5/test/fts5ac.test d5073ca7bd2d9fe8aab0c82c6c75a7e4b0d70ced
|
||||
@ -133,6 +133,7 @@ F ext/fts5/test/fts5auto.test 401c20e89f1114d733b94809be1e6f893e16c09e
|
||||
F ext/fts5/test/fts5aux.test 8c687c948cc98e9a94be014df7d518acc1b3b74f
|
||||
F ext/fts5/test/fts5auxdata.test 141a7cbffcceb1bd2799b4b29c183ff8780d586e
|
||||
F ext/fts5/test/fts5bigpl.test 04ee0d7eebbebf17c31f5a0b5c5f9494eac3a0cb
|
||||
F ext/fts5/test/fts5bigtok.test 981b2790f6fa02773c889bd35d42c6b97f80f0f4
|
||||
F ext/fts5/test/fts5columnsize.test a8cfef21ffa1c264b9f670a7d94eeaccb5341c07
|
||||
F ext/fts5/test/fts5config.test 83941309b94d002ed6f55d9cd814e0353c9ae013
|
||||
F ext/fts5/test/fts5conflict.test 26f4e46c4d31e16221794832a990dc4e30e18de5
|
||||
@ -156,7 +157,7 @@ F ext/fts5/test/fts5fault8.test f2d8a2b673a5f72ca1fa0e85bdbfb2041ffd347d
|
||||
F ext/fts5/test/fts5fault9.test e10e395428a9ea0596ebe752ff7123d16ab78e08
|
||||
F ext/fts5/test/fts5full.test 6f6143af0c6700501d9fd597189dfab1555bb741
|
||||
F ext/fts5/test/fts5hash.test 00668f6fa9b9bffbd7c1be29f408aa2bdade0451
|
||||
F ext/fts5/test/fts5integrity.test 87db5d4e7da0ce04a1dcba5ba91658673c997a65
|
||||
F ext/fts5/test/fts5integrity.test f5e4f8d284385875068ad0f3e894ce43e9de835d
|
||||
F ext/fts5/test/fts5matchinfo.test 86569026d20f1ed748236587ce798de8a96615f1
|
||||
F ext/fts5/test/fts5merge.test 8f3cdba2ec9c5e7e568246e81b700ad37f764367
|
||||
F ext/fts5/test/fts5merge2.test c0cb66eb38a41c26cc5848fb9e50093e0f59ac93
|
||||
@ -172,7 +173,7 @@ F ext/fts5/test/fts5query.test f5ec25f5f2fbb70033424113cdffc101b1985a40
|
||||
F ext/fts5/test/fts5rank.test 7e9e64eac7245637f6f2033aec4b292aaf611aab
|
||||
F ext/fts5/test/fts5rebuild.test 03935f617ace91ed23a6099c7c74d905227ff29b
|
||||
F ext/fts5/test/fts5restart.test c17728fdea26e7d0f617d22ad5b4b2862b994c17
|
||||
F ext/fts5/test/fts5rowid.test 42de27109d2f6091108bf27097b105cb7e34f492
|
||||
F ext/fts5/test/fts5rowid.test 16908a99d6efc9ba21081b4f2b86b3fc699839a6
|
||||
F ext/fts5/test/fts5simple.test 2bc6451cbe887a9215f5b14ae307c70d850344c9
|
||||
F ext/fts5/test/fts5simple2.test 98377ae1ff7749a42c21fe1a139c1ed312522c46
|
||||
F ext/fts5/test/fts5synonym.test 6475d189c2e20d60795808f83e36bf9318708d48
|
||||
@ -1418,7 +1419,7 @@ F tool/vdbe_profile.tcl 246d0da094856d72d2c12efec03250d71639d19f
|
||||
F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4
|
||||
F tool/warnings.sh 48bd54594752d5be3337f12c72f28d2080cb630b
|
||||
F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f
|
||||
P 9e8c23acf74944a165c733682a956948b15bd401
|
||||
R 08e65f545f5743a4e11b0d8939a59f80
|
||||
P acaf426449bf6fd3140fd63141750ff69d1119a5
|
||||
R d08b3552b8f27561f27085942ba60d34
|
||||
U dan
|
||||
Z 3083046e1d22f6a7fb73cbf36ab37bf0
|
||||
Z 7a4ceb8872d3ff383d019f72843d63a3
|
||||
|
@ -1 +1 @@
|
||||
acaf426449bf6fd3140fd63141750ff69d1119a5
|
||||
b914ece0d146cfc8adba4dc4e8633e14f174d6ea
|
Loading…
Reference in New Issue
Block a user