3 # The author disclaims copyright to this source code. In place of
4 # a legal notice, here is a blessing:
6 # May you do good and not evil.
7 # May you find forgiveness for yourself and forgive others.
8 # May you share freely, never taking more than you give.
10 #*************************************************************************
11 # This file implements regression tests for SQLite library. The
12 # focus of this script is testing the FTS5 module.
15 source [file join [file dirname [info script]] fts5_common.tcl]
16 set testprefix fts5bigtok
20 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]
21 set l [lindex $L [expr int(rand() * [llength $L])]]
22 string repeat $l [expr int(rand() * 5) + 60]
27 for {set i 0} {$i < $n} {incr i} {
33 foreach_detail_mode $::testprefix {
36 CREATE VIRTUAL TABLE t1 USING fts5(x, detail=%DETAIL%);
37 INSERT INTO t1(t1, rank) VALUES('pgsz', 32);
38 CREATE VIRTUAL TABLE t1vocab USING fts5vocab(t1, row);
40 WITH s(i) AS ( SELECT 1 UNION ALL SELECT i+1 FROM s WHERE i<10 )
41 INSERT INTO t1 SELECT rnddoc(3) FROM s;
43 WITH s(i) AS ( SELECT 1 UNION ALL SELECT i+1 FROM s WHERE i<10 )
44 INSERT INTO t1 SELECT rnddoc(3) FROM s;
47 foreach v [db eval {SELECT term FROM t1vocab}] {
48 set res [db eval {SELECT rowid FROM t1($v)}]
49 do_execsql_test 1.[string range $v 0 0] {
50 SELECT rowid FROM t1($v) ORDER BY rowid DESC
51 } [lsort -integer -decr $res]
55 INSERT INTO t1(t1) VALUES('optimize');
58 foreach v [db eval {SELECT term FROM t1vocab}] {
59 set res [db eval {SELECT rowid FROM t1($v)}]
60 do_execsql_test 2.[string range $v 0 0] {
61 SELECT rowid FROM t1($v) ORDER BY rowid DESC
62 } [lsort -integer -decr $res]