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

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

Issue 6990047: Import SQLite 3.7.6.3. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 7 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 | Annotate | Revision Log
« no previous file with comments | « third_party/sqlite/src/test/fts3al.test ('k') | third_party/sqlite/src/test/fts3ao.test » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # 2007 April 26 1 # 2007 April 26
2 # 2 #
3 # The author disclaims copyright to this source code. 3 # The author disclaims copyright to this source code.
4 # 4 #
5 #************************************************************************* 5 #*************************************************************************
6 # This file implements tests for prefix-searching in the fts3 6 # This file implements tests for prefix-searching in the fts3
7 # component of the SQLite library. 7 # component of the SQLite library.
8 # 8 #
9 # $Id: fts3an.test,v 1.2 2007/12/13 21:54:11 drh Exp $ 9 # $Id: fts3an.test,v 1.2 2007/12/13 21:54:11 drh Exp $
10 # 10 #
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 # hit. We'll have 6 hits for row 1, 1 for row 2, and 6*(2^5)==192 for 162 # hit. We'll have 6 hits for row 1, 1 for row 2, and 6*(2^5)==192 for
163 # $bigtext. 163 # $bigtext.
164 set ret {6 1} 164 set ret {6 1}
165 db eval { 165 db eval {
166 BEGIN; 166 BEGIN;
167 CREATE VIRTUAL TABLE t3 USING fts3(c); 167 CREATE VIRTUAL TABLE t3 USING fts3(c);
168 168
169 INSERT INTO t3(rowid, c) VALUES(1, $text); 169 INSERT INTO t3(rowid, c) VALUES(1, $text);
170 INSERT INTO t3(rowid, c) VALUES(2, 'Another lovely row'); 170 INSERT INTO t3(rowid, c) VALUES(2, 'Another lovely row');
171 } 171 }
172 for {set i 0} {$i<100} {incr i} { 172 for {set i 0} {$i<68} {incr i} {
173 db eval {INSERT INTO t3(rowid, c) VALUES(3+$i, $bigtext)} 173 db eval {INSERT INTO t3(rowid, c) VALUES(3+$i, $bigtext)}
174 lappend ret 192 174 lappend ret 192
175 } 175 }
176 db eval {COMMIT;} 176 db eval {COMMIT;}
177 177
178 # Test that we get the expected number of hits. 178 # Test that we get the expected number of hits.
179 do_test fts3an-3.1 { 179 do_test fts3an-3.1 {
180 set t {} 180 set t {}
181 db eval {SELECT offsets(t3) as o FROM t3 WHERE t3 MATCH 'l*'} { 181 db eval {SELECT offsets(t3) as o FROM t3 WHERE t3 MATCH 'l*'} {
182 set l [llength $o] 182 set l [llength $o]
183 lappend t [expr {$l/4}] 183 lappend t [expr {$l/4}]
184 } 184 }
185 set t 185 set t
186 } $ret 186 } $ret
187 187
188 # TODO(shess) It would be useful to test a couple edge cases, but I 188 # Test a boundary condition: More than 2^16 terms that match a searched for
189 # don't know if we have the precision to manage it from here at this 189 # prefix in a single segment.
190 # time. Prefix hits can cross leaves, which the code above _should_ 190 #
191 # hit by virtue of size. There are two variations on this. If the 191 puts "This next test can take a little while (~ 30 seconds)..."
192 # tree is 2 levels high, the code will find the leaf-node extent 192 do_test fts3an-4.1 {
193 # directly, but if it is higher, the code will have to follow two 193 execsql { CREATE VIRTUAL TABLE ft USING fts3(x) }
194 # separate interior branches down the tree. Both should be tested. 194 execsql BEGIN
195 execsql { INSERT INTO ft VALUES(NULL) }
196 execsql { INSERT INTO ft SELECT * FROM ft } ;# 2
197 execsql { INSERT INTO ft SELECT * FROM ft } ;# 4
198 execsql { INSERT INTO ft SELECT * FROM ft } ;# 8
199 execsql { INSERT INTO ft SELECT * FROM ft } ;# 16
200 execsql { INSERT INTO ft SELECT * FROM ft } ;# 32
201 execsql { INSERT INTO ft SELECT * FROM ft } ;# 64
202 execsql { INSERT INTO ft SELECT * FROM ft } ;# 128
203 execsql { INSERT INTO ft SELECT * FROM ft } ;# 256
204 execsql { INSERT INTO ft SELECT * FROM ft } ;# 512
205 execsql { INSERT INTO ft SELECT * FROM ft } ;# 1024
206 execsql { INSERT INTO ft SELECT * FROM ft } ;# 2048
207 execsql { INSERT INTO ft SELECT * FROM ft } ;# 4096
208 execsql { INSERT INTO ft SELECT * FROM ft } ;# 8192
209 execsql { INSERT INTO ft SELECT * FROM ft } ;# 16384
210 execsql { INSERT INTO ft SELECT * FROM ft } ;# 32768
211 execsql { INSERT INTO ft SELECT * FROM ft } ;# 65536
212 execsql { INSERT INTO ft SELECT * FROM ft } ;# 131072
213 execsql COMMIT
214 execsql { UPDATE ft SET x = 'abc' || rowid }
215 execsql { SELECT count(*) FROM ft WHERE x MATCH 'abc*' }
216 } {131072}
195 217
196 finish_test 218 finish_test
OLDNEW
« no previous file with comments | « third_party/sqlite/src/test/fts3al.test ('k') | third_party/sqlite/src/test/fts3ao.test » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698