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

Side by Side Diff: third_party/sqlite/src/ext/fts5/test/fts5update.test

Issue 2751253002: [sql] Import SQLite 3.17.0. (Closed)
Patch Set: also clang on Linux i386 Created 3 years, 9 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
OLDNEW
(Empty)
1 # 2016 Jan 16
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 # This file implements regression tests for SQLite library. The
12 # focus of this script is testing the FTS5 module.
13 #
14
15 source [file join [file dirname [info script]] fts5_common.tcl]
16 set testprefix fts5update
17
18 # If SQLITE_ENABLE_FTS5 is not defined, omit this file.
19 ifcapable !fts5 {
20 finish_test
21 return
22 }
23
24 set docs {
25 "eight zero iv eight 7" "ix one 8 one three ii one"
26 "1 9 9 three viii" "5 zero ii 6 nine ix 3"
27 "3 zero 5 2 seven nine" "two eight viii eight 1"
28 "4 six two 5 9 vii" "viii ii four 8 i i iv"
29 "vii 0 iv seven 7 viii" "five 1 nine vi seven"
30 "1 zero zero iii 1" "one one six 6 nine seven"
31 "one v 4 zero 4 iii ii" "2 3 eight six ix"
32 "six iv 7 three 5" "ix zero 0 8 ii 7 3"
33 "four six nine 2 vii 3" "five viii 5 8 0 7"
34 }
35
36 foreach_detail_mode $::testprefix {
37
38 do_execsql_test 1.0 {
39 CREATE VIRTUAL TABLE t1 USING fts5(a, b, detail=%DETAIL%);
40 } {}
41
42 do_test 1.1 {
43 foreach {a b} $docs {
44 execsql {INSERT INTO t1 VALUES($a, $b)}
45 }
46 } {}
47
48 proc update {iRowid iA iB} {
49 set a [lindex $::docs $iA]
50 set b [lindex $::docs $iB]
51 execsql { UPDATE t1 SET a=$a, b=$b WHERE rowid=$iRowid }
52 }
53
54 set nDoc [llength $::docs]
55 foreach n {1 5 10 50 100} {
56 do_test 1.2.$n {
57 execsql BEGIN
58 for {set i 1} {$i <= 1000} {incr i} {
59 set iRowid [expr {int(rand() * ($nDoc/2)) + 1}]
60 set iA [expr {int(rand() * $nDoc)}]
61 set iB [expr {int(rand() * $nDoc)}]
62 update $iRowid $iA $iB
63
64 if {($i % $n)==0} {
65 execsql { COMMIT; BEGIN }
66 }
67
68 if {($i % $n)==100} {
69 execsql { INSERT INTO t1(t1) VALUES('integrity-check') }
70 }
71 }
72 execsql COMMIT
73 execsql { INSERT INTO t1(t1) VALUES('integrity-check') }
74 } {}
75 }
76
77 do_execsql_test 1.3 {
78 UPDATE t1 SET a=a AND b=b;
79 INSERT INTO t1(t1) VALUES('integrity-check');
80 }
81
82 do_test 1.4 {
83 execsql { INSERT INTO t1(t1, rank) VALUES('pgsz', 32) }
84 for {set i 0} {$i < 50} {incr i} {
85 execsql { UPDATE t1 SET a=a AND b=b }
86 execsql { INSERT INTO t1(t1) VALUES('integrity-check') }
87 }
88 } {}
89
90 #-------------------------------------------------------------------------
91 # Lots of deletes/inserts of the same document with the same rowid.
92 #
93 do_execsql_test 2.0 {
94 CREATE VIRTUAL TABLE x2 USING fts5(x, detail=%DETAIL%);
95 INSERT INTO x2(x2, rank) VALUES('crisismerge', 2);
96 INSERT INTO x2 VALUES('a b c');
97 INSERT INTO x2 VALUES('a b c');
98 }
99 do_test 2.1 {
100 for {set i 0} {$i < 1000} {incr i} {
101 execsql { DELETE FROM x2 WHERE rowid = 2 }
102 execsql { INSERT INTO x2(rowid, x) VALUES(2, 'a b c') }
103 }
104 } {}
105 do_execsql_test 2.1.integrity {
106 INSERT INTO x2(x2) VALUES('integrity-check');
107 }
108
109 do_test 2.2 {
110 for {set i 0} {$i < 1000} {incr i} {
111 execsql { UPDATE x2 SET x=x WHERE rowid=2 }
112 }
113 } {}
114 do_execsql_test 2.2.integrity {
115 INSERT INTO x2(x2) VALUES('integrity-check');
116 }
117
118 }
119 finish_test
120
121
OLDNEW
« no previous file with comments | « third_party/sqlite/src/ext/fts5/test/fts5unicode2.test ('k') | third_party/sqlite/src/ext/fts5/test/fts5vocab.test » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698