Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3)

Side by Side Diff: third_party/sqlite/src/test/index5.test

Issue 949043002: Add //third_party/sqlite to dirs_to_snapshot, remove net_sql.patch (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « third_party/sqlite/src/test/index4.test ('k') | third_party/sqlite/src/test/index6.test » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 # 2012 August 6
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 set testdir [file dirname $argv0]
15 source $testdir/tester.tcl
16 set ::testprefix index5
17
18 do_test 1.1 {
19 if {[permutation]=="memsubsys1"} {
20 execsql { PRAGMA auto_vacuum = 0; }
21 }
22 execsql {
23 PRAGMA page_size = 1024;
24 CREATE TABLE t1(x);
25 BEGIN;
26 }
27 for {set i 0} {$i < 100000} {incr i} {
28 execsql { INSERT INTO t1 VALUES(randstr(100,100)) }
29 }
30 execsql COMMIT
31 execsql {
32 CREATE INDEX i1 ON t1(x);
33 DROP INDEX I1;
34 PRAGMA main.page_size;
35 }
36 } {1024}
37
38 db close
39 testvfs tvfs
40 tvfs filter xWrite
41 tvfs script write_cb
42 proc write_cb {xCall file handle iOfst args} {
43 if {[file tail $file]=="test.db"} {
44 lappend ::write_list [expr $iOfst/1024 + 1]
45 }
46 }
47
48 do_test 1.2 {
49 sqlite3 db test.db -vfs tvfs
50 set ::write_list [list]
51 execsql { CREATE INDEX i1 ON t1(x) }
52 } {}
53
54 do_test 1.3 {
55 set nForward 0
56 set nBackward 0
57 set nNoncont 0
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)} {
62 incr nForward
63 } elseif {$iNext==($iPrev-1)} {
64 incr nBackward
65 } else {
66 incr nNoncont
67 }
68 set iPrev $iNext
69 }
70 puts -nonewline \
71 " (forward=$nForward, back=$nBackward, noncontiguous=$nNoncont)"
72
73 expr {$nForward > 2*($nBackward + $nNoncont)}
74 } {1}
75 db close
76 tvfs delete
77
78 finish_test
OLDNEW
« no previous file with comments | « third_party/sqlite/src/test/index4.test ('k') | third_party/sqlite/src/test/index6.test » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698