1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-07-29 08:01:23 +03:00

Further modifications and test cases to improve test coverage of fts3.

FossilOrigin-Name: ea8a0d2ce0cb1ca3f4f18c72fb780d1c26792799acc87e6726f9eaccf2f178bf
This commit is contained in:
dan
2017-04-19 07:33:52 +00:00
parent 0027e98b85
commit a059e99ca8
5 changed files with 123 additions and 16 deletions

View File

@ -102,6 +102,7 @@ do_execsql_test 2.5 {
181 182 183 184 185 186 187 188 189 190 191 198 199
}
#-------------------------------------------------------------------------
# Range constraints on the docid using non-integer values.
#
do_execsql_test 2.6 {
@ -120,5 +121,56 @@ do_execsql_test 2.8 {
29 30 31 34 35 38 39 42 43 46 47 48
}
#-------------------------------------------------------------------------
# Phrase query tests.
#
do_execsql_test 3.1.1 {
CREATE VIRTUAL TABLE t3 USING fts3;
INSERT INTO t3 VALUES('a b c');
INSERT INTO t3 VALUES('d e f');
INSERT INTO t3 VALUES('a b d');
INSERT INTO t3 VALUES('1 2 3 4 5 6 7 8 9 10 11');
}
do_execsql_test 3.1.2 {
SELECT * FROM t3 WHERE t3 MATCH '"a b x y"' ORDER BY docid DESC
}
do_execsql_test 3.1.3 {
SELECT * FROM t3 WHERE t3 MATCH '"a b c" OR "a b x y"' ORDER BY docid DESC
} {{a b c}}
do_execsql_test 3.1.4 {
SELECT * FROM t3 WHERE t3 MATCH '"a* b* x* a*"'
}
do_execsql_test 3.1.5 {
SELECT rowid FROM t3 WHERE t3 MATCH '"2 3 4 5 6 7 8 9"'
} {4}
#-------------------------------------------------------------------------
#
reset_db
do_execsql_test 4.0 {
PRAGMA page_size = 512;
CREATE VIRTUAL TABLE t4 USING fts4;
WITH s(i) AS ( SELECT 1 UNION ALL SELECT i+1 FROM s WHERE i<8000 )
INSERT INTO t4 SELECT 'a b c a b c a b c' FROM s;
}
do_execsql_test 4.1 {
SELECT count(*) FROM t4 WHERE t4 MATCH '"a b c" OR "c a b"'
} {8000}
do_execsql_test 4.2 {
SELECT quote(value) from t4_stat where id=0
} {X'C03EC0B204C0A608'}
do_execsql_test 4.3 {
UPDATE t4_stat SET value = X'C03EC0B204C0A60800' WHERE id=0;
}
do_catchsql_test 4.4 {
SELECT count(*) FROM t4 WHERE t4 MATCH '"a b c" OR "c a b"'
} {1 {database disk image is malformed}}
do_execsql_test 4.5 {
UPDATE t4_stat SET value = X'00C03EC0B204C0A608' WHERE id=0;
}
do_catchsql_test 4.6 {
SELECT count(*) FROM t4 WHERE t4 MATCH '"a b c" OR "c a b"'
} {1 {database disk image is malformed}}
finish_test