| Index: third_party/sqlite/sqlite-src-3100200/test/fts3matchinfo.test
|
| diff --git a/third_party/sqlite/sqlite-src-3080704/test/fts3matchinfo.test b/third_party/sqlite/sqlite-src-3100200/test/fts3matchinfo.test
|
| similarity index 82%
|
| copy from third_party/sqlite/sqlite-src-3080704/test/fts3matchinfo.test
|
| copy to third_party/sqlite/sqlite-src-3100200/test/fts3matchinfo.test
|
| index 36c91211180e6f6b25078d0883fae0c2bc0fdb38..b17d7da0a59c8bfdddd5495d7f92d83c9715faef 100644
|
| --- a/third_party/sqlite/sqlite-src-3080704/test/fts3matchinfo.test
|
| +++ b/third_party/sqlite/sqlite-src-3100200/test/fts3matchinfo.test
|
| @@ -449,5 +449,107 @@ do_execsql_test 10.1 {
|
| ORDER BY 1;
|
| } {1 1 one 2 2 two 3 3 three}
|
|
|
| +#---------------------------------------------------------------------------
|
| +# Test the 'y' matchinfo flag
|
| +#
|
| +set sqlite_fts3_enable_parentheses 1
|
| +reset_db
|
| +do_execsql_test 11.0 {
|
| + CREATE VIRTUAL TABLE tt USING fts3(x, y);
|
| + INSERT INTO tt VALUES('c d a c d d', 'e a g b d a'); -- 1
|
| + INSERT INTO tt VALUES('c c g a e b', 'c g d g e c'); -- 2
|
| + INSERT INTO tt VALUES('b e f d e g', 'b a c b c g'); -- 3
|
| + INSERT INTO tt VALUES('a c f f g d', 'd b f d e g'); -- 4
|
| + INSERT INTO tt VALUES('g a c f c f', 'd g g b c c'); -- 5
|
| + INSERT INTO tt VALUES('g a c e b b', 'd b f b g g'); -- 6
|
| + INSERT INTO tt VALUES('f d a a f c', 'e e a d c f'); -- 7
|
| + INSERT INTO tt VALUES('a c b b g f', 'a b a e d f'); -- 8
|
| + INSERT INTO tt VALUES('b a f e c c', 'f d b b a b'); -- 9
|
| + INSERT INTO tt VALUES('f d c e a c', 'f a f a a f'); -- 10
|
| +}
|
| +
|
| +db func mit mit
|
| +foreach {tn expr res} {
|
| + 1 "a" {
|
| + 1 {1 2} 2 {1 0} 3 {0 1} 4 {1 0} 5 {1 0}
|
| + 6 {1 0} 7 {2 1} 8 {1 2} 9 {1 1} 10 {1 3}
|
| + }
|
| +
|
| + 2 "b" {
|
| + 1 {0 1} 2 {1 0} 3 {1 2} 4 {0 1} 5 {0 1}
|
| + 6 {2 2} 8 {2 1} 9 {1 3}
|
| + }
|
| +
|
| + 3 "y:a" {
|
| + 1 {0 2} 3 {0 1}
|
| + 7 {0 1} 8 {0 2} 9 {0 1} 10 {0 3}
|
| + }
|
| +
|
| + 4 "x:a" {
|
| + 1 {1 0} 2 {1 0} 4 {1 0} 5 {1 0}
|
| + 6 {1 0} 7 {2 0} 8 {1 0} 9 {1 0} 10 {1 0}
|
| + }
|
| +
|
| + 5 "a OR b" {
|
| + 1 {1 2 0 1} 2 {1 0 1 0} 3 {0 1 1 2} 4 {1 0 0 1} 5 {1 0 0 1}
|
| + 6 {1 0 2 2} 7 {2 1 0 0} 8 {1 2 2 1} 9 {1 1 1 3} 10 {1 3 0 0}
|
| + }
|
| +
|
| + 6 "a AND b" {
|
| + 1 {1 2 0 1} 2 {1 0 1 0} 3 {0 1 1 2} 4 {1 0 0 1} 5 {1 0 0 1}
|
| + 6 {1 0 2 2} 8 {1 2 2 1} 9 {1 1 1 3}
|
| + }
|
| +
|
| + 7 "a OR (a AND b)" {
|
| + 1 {1 2 1 2 0 1} 2 {1 0 1 0 1 0} 3 {0 1 0 1 1 2} 4 {1 0 1 0 0 1}
|
| + 5 {1 0 1 0 0 1} 6 {1 0 1 0 2 2} 7 {2 1 0 0 0 0} 8 {1 2 1 2 2 1}
|
| + 9 {1 1 1 1 1 3} 10 {1 3 0 0 0 0}
|
| + }
|
|
|
| +} {
|
| + do_execsql_test 11.1.$tn.1 {
|
| + SELECT rowid, mit(matchinfo(tt, 'y')) FROM tt WHERE tt MATCH $expr
|
| + } $res
|
| +
|
| + set r2 [list]
|
| + foreach {rowid L} $res {
|
| + lappend r2 $rowid
|
| + set M [list]
|
| + foreach {a b} $L {
|
| + lappend M [expr ($a ? 1 : 0) + ($b ? 2 : 0)]
|
| + }
|
| + lappend r2 $M
|
| + }
|
| +
|
| + do_execsql_test 11.1.$tn.2 {
|
| + SELECT rowid, mit(matchinfo(tt, 'b')) FROM tt WHERE tt MATCH $expr
|
| + } $r2
|
| + breakpoint
|
| +
|
| + do_execsql_test 11.1.$tn.2 {
|
| + SELECT rowid, mit(matchinfo(tt, 'b')) FROM tt WHERE tt MATCH $expr
|
| + } $r2
|
| +}
|
| +set sqlite_fts3_enable_parentheses 0
|
| +
|
| +#---------------------------------------------------------------------------
|
| +# Test the 'b' matchinfo flag
|
| +#
|
| +set sqlite_fts3_enable_parentheses 1
|
| +reset_db
|
| +db func mit mit
|
| +
|
| +do_test 12.0 {
|
| + set cols [list]
|
| + for {set i 0} {$i < 50} {incr i} { lappend cols "c$i" }
|
| + execsql "CREATE VIRTUAL TABLE tt USING fts3([join $cols ,])"
|
| +} {}
|
| +
|
| +do_execsql_test 12.1 {
|
| + INSERT INTO tt (rowid, c4, c45) VALUES(1, 'abc', 'abc');
|
| + SELECT mit(matchinfo(tt, 'b')) FROM tt WHERE tt MATCH 'abc';
|
| +} [list [list [expr 1<<4] [expr 1<<(45-32)]]]
|
| +
|
| +set sqlite_fts3_enable_parentheses 0
|
| finish_test
|
| +
|
|
|