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 #***********************************************************************
14 set testdir [file dirname $argv0]
15 source $testdir/tester.tcl
16 set ::testprefix index5
19 if {[permutation]=="memsubsys1"} {
20 execsql { PRAGMA auto_vacuum = 0; }
23 PRAGMA page_size = 1024;
27 for {set i 0} {$i < 100000} {incr i} {
28 execsql { INSERT INTO t1 VALUES(randstr(100,100)) }
32 CREATE INDEX i1 ON t1(x);
34 PRAGMA main.page_size;
42 proc write_cb {xCall file handle iOfst args} {
43 if {[file tail $file]=="test.db"} {
44 lappend ::write_list [expr $iOfst/1024 + 1]
49 sqlite3 db test.db -vfs tvfs
50 set ::write_list [list]
51 execsql { CREATE INDEX i1 ON t1(x) }
58 set iPrev [lindex $::write_list 0]
59 for {set i 1} {$i < [llength $::write_list]} {incr i} {
60 set iNext [lindex $::write_list $i]
61 if {$iNext==($iPrev+1)} {
63 } elseif {$iNext==($iPrev-1)} {
71 " (forward=$nForward, back=$nBackward, noncontiguous=$nNoncont)"
73 expr {$nForward > 2*($nBackward + $nNoncont)}