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

Unified 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 side-by-side diff with in-line comments
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 »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/sqlite/src/test/index5.test
diff --git a/third_party/sqlite/src/test/index5.test b/third_party/sqlite/src/test/index5.test
new file mode 100644
index 0000000000000000000000000000000000000000..e369d75717e48e6b0c26cc618f85b7183618e548
--- /dev/null
+++ b/third_party/sqlite/src/test/index5.test
@@ -0,0 +1,78 @@
+# 2012 August 6
+#
+# 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.
+#
+#***********************************************************************
+#
+
+
+set testdir [file dirname $argv0]
+source $testdir/tester.tcl
+set ::testprefix index5
+
+do_test 1.1 {
+ if {[permutation]=="memsubsys1"} {
+ execsql { PRAGMA auto_vacuum = 0; }
+ }
+ execsql {
+ PRAGMA page_size = 1024;
+ CREATE TABLE t1(x);
+ BEGIN;
+ }
+ for {set i 0} {$i < 100000} {incr i} {
+ execsql { INSERT INTO t1 VALUES(randstr(100,100)) }
+ }
+ execsql COMMIT
+ execsql {
+ CREATE INDEX i1 ON t1(x);
+ DROP INDEX I1;
+ PRAGMA main.page_size;
+ }
+} {1024}
+
+db close
+testvfs tvfs
+tvfs filter xWrite
+tvfs script write_cb
+proc write_cb {xCall file handle iOfst args} {
+ if {[file tail $file]=="test.db"} {
+ lappend ::write_list [expr $iOfst/1024 + 1]
+ }
+}
+
+do_test 1.2 {
+ sqlite3 db test.db -vfs tvfs
+ set ::write_list [list]
+ execsql { CREATE INDEX i1 ON t1(x) }
+} {}
+
+do_test 1.3 {
+ set nForward 0
+ set nBackward 0
+ set nNoncont 0
+ set iPrev [lindex $::write_list 0]
+ for {set i 1} {$i < [llength $::write_list]} {incr i} {
+ set iNext [lindex $::write_list $i]
+ if {$iNext==($iPrev+1)} {
+ incr nForward
+ } elseif {$iNext==($iPrev-1)} {
+ incr nBackward
+ } else {
+ incr nNoncont
+ }
+ set iPrev $iNext
+ }
+ puts -nonewline \
+ " (forward=$nForward, back=$nBackward, noncontiguous=$nNoncont)"
+
+ expr {$nForward > 2*($nBackward + $nNoncont)}
+} {1}
+db close
+tvfs delete
+
+finish_test
« 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