| OLD | NEW |
| (Empty) |
| 1 # 2014 Dec 20 | |
| 2 # | |
| 3 # The author disclaims copyright to this source code. In place of | |
| 4 # a legal notice, here is a blessing: | |
| 5 # | |
| 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. | |
| 9 # | |
| 10 #*********************************************************************** | |
| 11 # | |
| 12 # | |
| 13 | |
| 14 source [file join [file dirname [info script]] fts5_common.tcl] | |
| 15 set testprefix fts5optimize | |
| 16 | |
| 17 # If SQLITE_ENABLE_FTS5 is defined, omit this file. | |
| 18 ifcapable !fts5 { | |
| 19 finish_test | |
| 20 return | |
| 21 } | |
| 22 | |
| 23 proc rnddoc {nWord} { | |
| 24 set vocab {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} | |
| 25 set nVocab [llength $vocab] | |
| 26 set ret [list] | |
| 27 for {set i 0} {$i < $nWord} {incr i} { | |
| 28 lappend ret [lindex $vocab [expr {int(rand() * $nVocab)}]] | |
| 29 } | |
| 30 return $ret | |
| 31 } | |
| 32 | |
| 33 | |
| 34 foreach {tn nStep} { | |
| 35 1 2 | |
| 36 2 10 | |
| 37 3 50 | |
| 38 4 500 | |
| 39 } { | |
| 40 if {$tn!=4} continue | |
| 41 reset_db | |
| 42 db func rnddoc rnddoc | |
| 43 do_execsql_test 1.$tn.1 { | |
| 44 CREATE VIRTUAL TABLE t1 USING fts5(x, y); | |
| 45 } | |
| 46 do_test 1.$tn.2 { | |
| 47 for {set i 0} {$i < $nStep} {incr i} { | |
| 48 execsql { INSERT INTO t1 VALUES( rnddoc(5), rnddoc(5) ) } | |
| 49 } | |
| 50 } {} | |
| 51 | |
| 52 do_execsql_test 1.$tn.3 { | |
| 53 INSERT INTO t1(t1) VALUES('integrity-check'); | |
| 54 } | |
| 55 | |
| 56 do_execsql_test 1.$tn.4 { | |
| 57 INSERT INTO t1(t1) VALUES('optimize'); | |
| 58 } | |
| 59 | |
| 60 do_execsql_test 1.$tn.5 { | |
| 61 INSERT INTO t1(t1) VALUES('integrity-check'); | |
| 62 } | |
| 63 } | |
| 64 | |
| 65 finish_test | |
| 66 | |
| OLD | NEW |