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

Side by Side Diff: third_party/sqlite/src/test/fts3defer.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/fts3d.test ('k') | third_party/sqlite/src/test/fts3defer2.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 # 2010 October 15 1 # 2010 October 15
2 # 2 #
3 # The author disclaims copyright to this source code. In place of 3 # The author disclaims copyright to this source code. In place of
4 # a legal notice, here is a blessing: 4 # a legal notice, here is a blessing:
5 # 5 #
6 # May you do good and not evil. 6 # May you do good and not evil.
7 # May you find forgiveness for yourself and forgive others. 7 # May you find forgiveness for yourself and forgive others.
8 # May you share freely, never taking more than you give. 8 # May you share freely, never taking more than you give.
9 # 9 #
10 #*********************************************************************** 10 #***********************************************************************
11 11
12 set testdir [file dirname $argv0] 12 set testdir [file dirname $argv0]
13 source $testdir/tester.tcl 13 source $testdir/tester.tcl
14 source $testdir/malloc_common.tcl 14 source $testdir/malloc_common.tcl
15 15
16 ifcapable !fts3 { 16 ifcapable !fts3||!fts4_deferred {
17 finish_test 17 finish_test
18 return 18 return
19 } 19 }
20 20
21 set sqlite_fts3_enable_parentheses 1 21 set sqlite_fts3_enable_parentheses 1
22 22
23 set fts3_simple_deferred_tokens_only 1
24
23 set ::testprefix fts3defer 25 set ::testprefix fts3defer
24 26
25 #-------------------------------------------------------------------------- 27 #--------------------------------------------------------------------------
26 # Test cases fts3defer-1.* are the "warm body" cases. The database contains 28 # Test cases fts3defer-1.* are the "warm body" cases. The database contains
27 # one row with 15000 instances of the token "a". This makes the doclist for 29 # one row with 15000 instances of the token "a". This makes the doclist for
28 # "a" so large that FTS3 will avoid loading it in most cases. 30 # "a" so large that FTS3 will avoid loading it in most cases.
29 # 31 #
30 # To show this, test cases fts3defer-1.2.* execute a bunch of FTS3 queries 32 # To show this, test cases fts3defer-1.2.* execute a bunch of FTS3 queries
31 # involving token "a". Then, fts3defer-1.3.* replaces the doclist for token 33 # involving token "a". Then, fts3defer-1.3.* replaces the doclist for token
32 # "a" with all zeroes and fts3defer-1.4.* repeats the tests from 1.2. If 34 # "a" with all zeroes and fts3defer-1.4.* repeats the tests from 1.2. If
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after
250 do_execsql_test 0 { 252 do_execsql_test 0 {
251 SELECT count(*) FROM t1_segments WHERE length(block)>10000 253 SELECT count(*) FROM t1_segments WHERE length(block)>10000
252 } {2} 254 } {2}
253 255
254 do_select_test 1.1 { 256 do_select_test 1.1 {
255 SELECT rowid FROM t1 WHERE t1 MATCH 'jk xnxhf' 257 SELECT rowid FROM t1 WHERE t1 MATCH 'jk xnxhf'
256 } {13 29 40 47 48 52 63 92} 258 } {13 29 40 47 48 52 63 92}
257 do_select_test 1.2 { 259 do_select_test 1.2 {
258 SELECT rowid FROM t1 WHERE t1 MATCH 'jk eh' 260 SELECT rowid FROM t1 WHERE t1 MATCH 'jk eh'
259 } {100} 261 } {100}
260 if {$tn==3} breakpoint
261 do_select_test 1.3 { 262 do_select_test 1.3 {
262 SELECT rowid FROM t1 WHERE t1 MATCH 'jk ubwrfqnbjf' 263 SELECT rowid FROM t1 WHERE t1 MATCH 'jk ubwrfqnbjf'
263 } {7 70 98} 264 } {7 70 98}
264 do_select_test 1.4 { 265 do_select_test 1.4 {
265 SELECT rowid FROM t1 WHERE t1 MATCH 'duszemmzl jk' 266 SELECT rowid FROM t1 WHERE t1 MATCH 'duszemmzl jk'
266 } {3 5 8 10 13 18 20 23 32 37 41 43 55 60 65 67 72 74 76 81 94 96 97} 267 } {3 5 8 10 13 18 20 23 32 37 41 43 55 60 65 67 72 74 76 81 94 96 97}
267 do_select_test 1.5 { 268 do_select_test 1.5 {
268 SELECT rowid FROM t1 WHERE t1 MATCH 'ubwrfqnbjf jk' 269 SELECT rowid FROM t1 WHERE t1 MATCH 'ubwrfqnbjf jk'
269 } {7 70 98} 270 } {7 70 98}
270 do_select_test 1.6 { 271 do_select_test 1.6 {
271 SELECT rowid FROM t1 WHERE t1 MATCH 'jk ubwrfqnbjf jk jk jk jk' 272 SELECT rowid FROM t1 WHERE t1 MATCH 'jk ubwrfqnbjf jk jk jk jk'
272 } {7 70 98} 273 } {7 70 98}
273 do_select_test 1.7 { 274 do_select_test 1.7 {
274 SELECT rowid FROM t1 WHERE t1 MATCH 'zm xnxhf' 275 SELECT rowid FROM t1 WHERE t1 MATCH 'zm xnxhf'
275 } {12 13 29 30 40 47 48 52 63 92 93} 276 } {12 13 29 30 40 47 48 52 63 92 93}
276 do_select_test 1.8 { 277 do_select_test 1.8 {
277 SELECT rowid FROM t1 WHERE t1 MATCH 'zm eh' 278 SELECT rowid FROM t1 WHERE t1 MATCH 'zm eh'
278 } {68 100} 279 } {68 100}
279 do_select_test 1.9 { 280 do_select_test 1.9 {
280 SELECT rowid FROM t1 WHERE t1 MATCH 'zm ubwrfqnbjf' 281 SELECT rowid FROM t1 WHERE t1 MATCH 'zm ubwrfqnbjf'
281 } {7 70 98} 282 } {7 70 98}
282 do_select_test 1.10 { 283 do_select_test 1.10 {
283 SELECT rowid FROM t1 WHERE t1 MATCH 'z* vgsld' 284 SELECT rowid FROM t1 WHERE t1 MATCH 'z* vgsld'
284 } {10 13 17 31 35 51 58 88 89 90 93 100} 285 } {10 13 17 31 35 51 58 88 89 90 93 100}
285 do_select_test 1.11 { 286
286 SELECT rowid FROM t1 287 if { $fts3_simple_deferred_tokens_only==0 } {
287 WHERE t1 MATCH '( 288 do_select_test 1.11 {
288 zdu OR zexh OR zf OR zhbrzadb OR zidhxhbtv OR 289 SELECT rowid FROM t1
289 zk OR zkhdvkw OR zm OR zsmhnf 290 WHERE t1 MATCH '(
290 ) vgsld' 291 zdu OR zexh OR zf OR zhbrzadb OR zidhxhbtv OR
291 } {10 13 17 31 35 51 58 88 89 90 93 100} 292 zk OR zkhdvkw OR zm OR zsmhnf
293 ) vgsld'
294 } {10 13 17 31 35 51 58 88 89 90 93 100}
295 }
292 296
293 do_select_test 2.1 { 297 do_select_test 2.1 {
294 SELECT rowid FROM t1 WHERE t1 MATCH '"zm agmckuiu"' 298 SELECT rowid FROM t1 WHERE t1 MATCH '"zm agmckuiu"'
295 } {3 24 52 53} 299 } {3 24 52 53}
296 do_select_test 2.2 { 300 do_select_test 2.2 {
297 SELECT rowid FROM t1 WHERE t1 MATCH '"zm zf"' 301 SELECT rowid FROM t1 WHERE t1 MATCH '"zm zf"'
298 } {33 53 75 88 101} 302 } {33 53 75 88 101}
299 do_select_test 2.3 { 303 do_select_test 2.3 {
300 SELECT rowid FROM t1 WHERE t1 MATCH '"zm aayxpmve"' 304 SELECT rowid FROM t1 WHERE t1 MATCH '"zm aayxpmve"'
301 } {48 65 84} 305 } {48 65 84}
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
357 WHERE t1 MATCH 'vgsld (hrlipdm OR (aapmve NEAR duszemmzl))' 361 WHERE t1 MATCH 'vgsld (hrlipdm OR (aapmve NEAR duszemmzl))'
358 } {{0 0 0 5 0 1 15 7 0 0 36 5}} 362 } {{0 0 0 5 0 1 15 7 0 0 36 5}}
359 363
360 # The following block of tests runs normally with FTS3 or FTS4 without the 364 # The following block of tests runs normally with FTS3 or FTS4 without the
361 # long doclists zeroed. And with OOM-injection for FTS4 with long doclists 365 # long doclists zeroed. And with OOM-injection for FTS4 with long doclists
362 # zeroed. Change this by messing with the [set dmt_modes] commands above. 366 # zeroed. Change this by messing with the [set dmt_modes] commands above.
363 # 367 #
364 foreach DO_MALLOC_TEST $dmt_modes { 368 foreach DO_MALLOC_TEST $dmt_modes {
365 369
366 # Phrase search. 370 # Phrase search.
371 #
367 do_select_test 5.$DO_MALLOC_TEST.1 { 372 do_select_test 5.$DO_MALLOC_TEST.1 {
368 SELECT rowid FROM t1 WHERE t1 MATCH '"jk mjpavjuhw"' 373 SELECT rowid FROM t1 WHERE t1 MATCH '"jk mjpavjuhw"'
369 } {8 15 36 64 67 72} 374 } {8 15 36 64 67 72}
370 375
371 # Multiple tokens search. 376 # Multiple tokens search.
372 do_select_test 5.$DO_MALLOC_TEST.2 { 377 do_select_test 5.$DO_MALLOC_TEST.2 {
373 SELECT rowid FROM t1 WHERE t1 MATCH 'duszemmzl zm' 378 SELECT rowid FROM t1 WHERE t1 MATCH 'duszemmzl zm'
374 } {3 5 8 10 12 13 18 20 23 37 43 55 60 65 67 72 74 81 94 96 97} 379 } {3 5 8 10 12 13 18 20 23 37 43 55 60 65 67 72 74 81 94 96 97}
375 380
376 # snippet() function with phrase. 381 # snippet() function with phrase.
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
409 do_select_test 6.1 { 414 do_select_test 6.1 {
410 SELECT rowid FROM t1 415 SELECT rowid FROM t1
411 WHERE t1 MATCH 'vgsld (hrlipdm OR (aayxpmve duszemmzl))' 416 WHERE t1 MATCH 'vgsld (hrlipdm OR (aayxpmve duszemmzl))'
412 } {10} 417 } {10}
413 do_select_test 6.2.1 { 418 do_select_test 6.2.1 {
414 SELECT rowid FROM t1 WHERE t1 MATCH '"jk xduvfhk"' 419 SELECT rowid FROM t1 WHERE t1 MATCH '"jk xduvfhk"'
415 } {8} 420 } {8}
416 do_select_test 6.2.2 { 421 do_select_test 6.2.2 {
417 SELECT rowid FROM t1 WHERE t1 MATCH '"zm azavwm"' 422 SELECT rowid FROM t1 WHERE t1 MATCH '"zm azavwm"'
418 } {15 26 92 96} 423 } {15 26 92 96}
419 do_select_test 6.2.3 { 424 if {$fts3_simple_deferred_tokens_only==0} {
420 SELECT rowid FROM t1 WHERE t1 MATCH '"jk xduvfhk" OR "zm azavwm"' 425 do_select_test 6.2.3 {
421 } {8 15 26 92 96} 426 SELECT rowid FROM t1 WHERE t1 MATCH '"jk xduvfhk" OR "zm azavwm"'
427 } {8 15 26 92 96}
428 }
429
430 if {$tn>1} {
431 # These tests will not work with $tn==1, as in this case table t1 is
432 # created using FTS3. The ^ syntax is only available with FTS4 tables.
433 #
434 do_select_test 7.1 {
435 SELECT rowid FROM t1 WHERE t1 MATCH '^zm mjpavjuhw'
436 } {56 62}
437 do_select_test 7.2 {
438 SELECT rowid FROM t1 WHERE t1 MATCH '^azavwm zm'
439 } {43}
440 }
422 } 441 }
423 442
424 set testprefix fts3defer 443 set testprefix fts3defer
425 444
426 do_execsql_test 3.1 { 445 do_execsql_test 3.1 {
427 CREATE VIRTUAL TABLE x1 USING fts4(a, b); 446 CREATE VIRTUAL TABLE x1 USING fts4(a, b);
428 INSERT INTO x1 VALUES('a b c', 'd e f'); 447 INSERT INTO x1 VALUES('a b c', 'd e f');
429 INSERT INTO x1 SELECT * FROM x1; 448 INSERT INTO x1 SELECT * FROM x1;
430 INSERT INTO x1 SELECT * FROM x1; 449 INSERT INTO x1 SELECT * FROM x1;
431 INSERT INTO x1 SELECT * FROM x1; 450 INSERT INTO x1 SELECT * FROM x1;
432 INSERT INTO x1 SELECT * FROM x1; 451 INSERT INTO x1 SELECT * FROM x1;
433 } 452 }
434 do_execsql_test 3.2 " 453 do_execsql_test 3.2 "
435 INSERT INTO x1 VALUES( 454 INSERT INTO x1 VALUES(
436 '[string repeat {d } 3000]', '[string repeat {f } 30000]' 455 '[string repeat {d } 3000]', '[string repeat {f } 30000]'
437 ); 456 );
438 INSERT INTO x1(x1) VALUES('optimize'); 457 INSERT INTO x1(x1) VALUES('optimize');
439 " 458 "
440 459
441 do_execsql_test 3.3 { 460 do_execsql_test 3.3 {
442 SELECT count(*) FROM x1 WHERE x1 MATCH '"d e f"' 461 SELECT count(*) FROM x1 WHERE x1 MATCH '"d e f"'
443 } {16} 462 } {16}
444 463
464 # At one point the following was causing a floating-point exception.
465 #
466 do_execsql_test 4.1 {
467 CREATE VIRTUAL TABLE x2 USING FTS4(x);
468 BEGIN;
469 INSERT INTO x2 VALUES('m m m m m m m m m m m m m m m m m m m m m m m m m m');
470 INSERT INTO x2 SELECT * FROM x2;
471 INSERT INTO x2 SELECT * FROM x2;
472 INSERT INTO x2 SELECT * FROM x2;
473 INSERT INTO x2 SELECT * FROM x2;
474 INSERT INTO x2 SELECT * FROM x2;
475 INSERT INTO x2 SELECT * FROM x2;
476 INSERT INTO x2 SELECT * FROM x2;
477 INSERT INTO x2 SELECT * FROM x2;
478 INSERT INTO x2 SELECT * FROM x2;
479 INSERT INTO x2 SELECT * FROM x2;
480 INSERT INTO x2 SELECT * FROM x2;
481 INSERT INTO x2 SELECT * FROM x2;
482 INSERT INTO x2 SELECT * FROM x2;
483 INSERT INTO x2 SELECT * FROM x2;
484 INSERT INTO x2 SELECT * FROM x2;
485 INSERT INTO x2 VALUES('a b c d e f g h i j k l m n o p q r s t u v w x y m');
486 COMMIT;
487 }
488 do_execsql_test 4.2 {
489 SELECT * FROM x2 WHERE x2 MATCH 'a b c d e f g h i j k l m n o p q r s';
490 } {{a b c d e f g h i j k l m n o p q r s t u v w x y m}}
491
492 set tokenizers {1 simple}
493 ifcapable icu { lappend tokenizers 2 {icu en_US} }
494 foreach {tn tokenizer} $tokenizers {
495 do_execsql_test 5.$tn.1 "
496 CREATE VIRTUAL TABLE x3 USING FTS4(a, b, TOKENIZE $tokenizer)
497 "
498 do_execsql_test 5.$tn.2 {
499 BEGIN;
500 INSERT INTO x3 VALUES('b b b b b b b b b b b', 'b b b b b b b b b b b b b');
501 INSERT INTO x3 SELECT * FROM x3;
502 INSERT INTO x3 SELECT * FROM x3;
503 INSERT INTO x3 SELECT * FROM x3;
504 INSERT INTO x3 SELECT * FROM x3;
505 INSERT INTO x3 SELECT * FROM x3;
506 INSERT INTO x3 SELECT * FROM x3;
507 INSERT INTO x3 SELECT * FROM x3;
508 INSERT INTO x3 SELECT * FROM x3;
509 INSERT INTO x3 SELECT * FROM x3;
510 INSERT INTO x3 SELECT * FROM x3;
511 INSERT INTO x3 SELECT * FROM x3;
512 INSERT INTO x3 SELECT * FROM x3;
513 INSERT INTO x3 SELECT * FROM x3;
514 INSERT INTO x3 SELECT * FROM x3;
515 INSERT INTO x3 SELECT * FROM x3;
516 INSERT INTO x3 SELECT * FROM x3;
517 INSERT INTO x3 VALUES('a b c', NULL);
518 INSERT INTO x3 VALUES('a x c', NULL);
519 COMMIT;
520
521 SELECT * FROM x3 WHERE x3 MATCH 'a b';
522 } {{a b c} {}}
523
524 do_execsql_test 5.$tn.3 { DROP TABLE x3 }
525 }
445 526
446 finish_test 527 finish_test
OLDNEW
« no previous file with comments | « third_party/sqlite/src/test/fts3d.test ('k') | third_party/sqlite/src/test/fts3defer2.test » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698