mirror of
https://github.com/sqlite/sqlite.git
synced 2026-01-06 08:01:16 +03:00
Add tests for the remaining examples in fts3.in.
FossilOrigin-Name: e381cd5229b30168769330cb201bae2689e1a549
This commit is contained in:
24
manifest
24
manifest
@@ -1,8 +1,5 @@
|
||||
-----BEGIN PGP SIGNED MESSAGE-----
|
||||
Hash: SHA1
|
||||
|
||||
C Reorder\sfunction\sdeclarations\sin\smutex_os2.c.\s\sThis\sis\sa\sblind\schange\s-\swe\nhave\sno\scapability\sof\stesting\son\sOS/2.\s\s\nTicket\s[97214a34d814]
|
||||
D 2009-12-01T14:31:18
|
||||
C Add\stests\sfor\sthe\sremaining\sexamples\sin\sfts3.in.
|
||||
D 2009-12-01T15:04:33
|
||||
F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0
|
||||
F Makefile.in c5827ead754ab32b9585487177c93bb00b9497b3
|
||||
F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654
|
||||
@@ -329,7 +326,7 @@ F test/descidx3.test 3394ad4d089335cac743c36a14129d6d931c316f
|
||||
F test/diskfull.test 0cede7ef9d8f415d9d3944005c76be7589bb5ebb
|
||||
F test/distinctagg.test 1a6ef9c87a58669438fc771450d7a72577417376
|
||||
F test/e_fkey.test fd1fcf89badd5f2773d7ac04775b5ff3488eda17
|
||||
F test/e_fts3.test 8a1dd987d08a655c24be7e898fcbf1e7655ffbab
|
||||
F test/e_fts3.test ad278add0deca99d2d8ec3d8b06ffed965d5abc2
|
||||
F test/enc.test e54531cd6bf941ee6760be041dff19a104c7acea
|
||||
F test/enc2.test 6d91a5286f59add0cfcbb2d0da913b76f2242398
|
||||
F test/enc3.test 5c550d59ff31dccdba5d1a02ae11c7047d77c041
|
||||
@@ -778,14 +775,7 @@ F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff
|
||||
F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224
|
||||
F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
|
||||
F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f
|
||||
P 58113932d93926b4aa037a7487105a55f883cd0a
|
||||
R 58cd33bd0bb94a22fdbc237eacf229c6
|
||||
U drh
|
||||
Z ac2766d6a74824f241c62a9d81b5f1a1
|
||||
-----BEGIN PGP SIGNATURE-----
|
||||
Version: GnuPG v1.4.6 (GNU/Linux)
|
||||
|
||||
iD8DBQFLFSi6oxKgR168RlERAgiFAJ9wkFV7p4Q3F1E0PwZ7Jj6UDZugsACeOWwQ
|
||||
XFTghNztA5qx3UCLz2oGre0=
|
||||
=RI1L
|
||||
-----END PGP SIGNATURE-----
|
||||
P c40e4ef094bb9d58f14354602785ccc228f8bc2a
|
||||
R cccbd406b7272a2ee3a226a903f9413a
|
||||
U dan
|
||||
Z a0421c06194222c60ba1ecb18d1dddd8
|
||||
|
||||
@@ -1 +1 @@
|
||||
c40e4ef094bb9d58f14354602785ccc228f8bc2a
|
||||
e381cd5229b30168769330cb201bae2689e1a549
|
||||
133
test/e_fts3.test
133
test/e_fts3.test
@@ -123,8 +123,6 @@ ddl_test 1.1.8.1 {CREATE VIRTUAL TABLE data USING fts3;}
|
||||
read_test 1.1.8.2 {PRAGMA table_info(data)} {0 content {} 0 {} 0}
|
||||
ddl_test 1.1.8.3 {DROP TABLE data}
|
||||
|
||||
##########################################################################
|
||||
|
||||
##########################################################################
|
||||
# Test the examples in section 1.2 (populating fts3 tables)
|
||||
#
|
||||
@@ -173,7 +171,6 @@ write_test 1.2.2.4 docs_content {
|
||||
INSERT INTO docs VALUES('the book is dedicated to Solomon.');
|
||||
}
|
||||
read_test 1.2.2.5 { SELECT count(*) FROM docs_segdir } {3}
|
||||
#set DO_MALLOC_TEST 1
|
||||
write_test 1.2.2.6 docs_segdir {
|
||||
SELECT * FROM (SELECT optimize(docs) FROM docs LIMIT 1) WHERE 0;
|
||||
}
|
||||
@@ -231,8 +228,6 @@ do_error_test e_fts3-1.3.3.5 {
|
||||
} {no such column: main.docs}
|
||||
ddl_test 1.3.2.8 { DROP TABLE docs }
|
||||
|
||||
##########################################################################
|
||||
|
||||
##########################################################################
|
||||
# Test the examples in section 3 (full-text index queries).
|
||||
#
|
||||
@@ -297,53 +292,112 @@ ddl_test 1.4.2.10 { DROP TABLE docs }
|
||||
#
|
||||
set sqlite_fts3_enable_parentheses 1
|
||||
ddl_test 1.5.1.1 { CREATE VIRTUAL TABLE docs USING fts3() }
|
||||
foreach {tn docid content} {
|
||||
2 1 "a database is a software system"
|
||||
3 2 "sqlite is a software system"
|
||||
4 3 "sqlite is a database"
|
||||
} {
|
||||
set R($docid) $content
|
||||
write_test 1.5.1.$tn docs_content {
|
||||
INSERT INTO docs(docid, content) VALUES($docid, $content)
|
||||
}
|
||||
}
|
||||
read_test 1.5.1.4 {
|
||||
SELECT * FROM docs WHERE docs MATCH 'sqlite AND database'
|
||||
} [list $R(3)]
|
||||
read_test 1.5.1.5 {
|
||||
SELECT * FROM docs WHERE docs MATCH 'database sqlite'
|
||||
} [list $R(3)]
|
||||
read_test 1.5.1.6 {
|
||||
SELECT * FROM docs WHERE docs MATCH 'sqlite OR database'
|
||||
} [list $R(1) $R(2) $R(3)]
|
||||
read_test 1.5.1.7 {
|
||||
SELECT * FROM docs WHERE docs MATCH 'database NOT sqlite'
|
||||
} [list $R(1)]
|
||||
read_test 1.5.1.8 {
|
||||
SELECT * FROM docs WHERE docs MATCH 'database and sqlite'
|
||||
} {}
|
||||
|
||||
|
||||
# TODO: Change numbering after here...
|
||||
write_test 1.5.2.1 docs_content {
|
||||
INSERT INTO docs
|
||||
SELECT 'sqlite is also a library' UNION ALL
|
||||
SELECT 'library software'
|
||||
}
|
||||
read_test 1.5.2.2 {
|
||||
SELECT docid FROM docs WHERE docs MATCH 'sqlite AND database OR library'
|
||||
} {3 4 5}
|
||||
read_test 1.5.2.3 {
|
||||
SELECT docid FROM docs WHERE docs MATCH 'sqlite AND database'
|
||||
UNION
|
||||
SELECT docid FROM docs WHERE docs MATCH 'library'
|
||||
} {3 4 5}
|
||||
write_test 1.5.2.4 docs_content {
|
||||
INSERT INTO docs
|
||||
SELECT 'the sqlite library runs on linux' UNION ALL
|
||||
SELECT 'as does the sqlite database (on linux)' UNION ALL
|
||||
SELECT 'the sqlite database is accessed by the sqlite library'
|
||||
}
|
||||
read_test 1.5.2.2 {
|
||||
SELECT docid FROM docs
|
||||
WHERE docs MATCH '("sqlite database" OR "sqlite library") AND linux';
|
||||
} {6 7}
|
||||
read_test 1.5.2.3 {
|
||||
SELECT docid FROM docs WHERE docs MATCH 'linux'
|
||||
INTERSECT
|
||||
SELECT docid FROM (
|
||||
SELECT docid FROM docs WHERE docs MATCH '"sqlite library"'
|
||||
UNION
|
||||
SELECT docid FROM docs WHERE docs MATCH '"sqlite database"'
|
||||
);
|
||||
} {6 7}
|
||||
|
||||
##########################################################################
|
||||
# Test the example in section 5 (custom tokenizers).
|
||||
# Test the examples in section 3.2 (set operators with standard syntax).
|
||||
# These tests reuse the table populated by the block above.
|
||||
#
|
||||
ddl_test 2.1.1 { CREATE VIRTUAL TABLE simple USING fts3(tokenize=simple) }
|
||||
write_test 2.1.2 simple_content {
|
||||
INSERT INTO simple VALUES('Right now they''re very frustrated')
|
||||
}
|
||||
read_test 2.1.3 {SELECT docid FROM simple WHERE simple MATCH 'Frustrated'} {1}
|
||||
read_test 2.1.4 {SELECT docid FROM simple WHERE simple MATCH 'Frustration'} {}
|
||||
set sqlite_fts3_enable_parentheses 0
|
||||
read_test 1.6.1.1 {
|
||||
SELECT * FROM docs WHERE docs MATCH 'sqlite -database'
|
||||
} {{sqlite is a software system} {sqlite is also a library} {the sqlite library runs on linux}}
|
||||
read_test 1.6.1.2 {
|
||||
SELECT * FROM docs WHERE docs MATCH 'sqlite OR database library'
|
||||
} {{sqlite is also a library} {the sqlite library runs on linux} {the sqlite database is accessed by the sqlite library}}
|
||||
|
||||
ddl_test 2.2.1 { CREATE VIRTUAL TABLE porter USING fts3(tokenize=porter) }
|
||||
write_test 2.2.2 porter_content {
|
||||
INSERT INTO porter VALUES('Right now they''re very frustrated')
|
||||
}
|
||||
read_test 2.2.3 {SELECT docid FROM porter WHERE porter MATCH 'Frustrated'} {1}
|
||||
read_test 2.2.4 {SELECT docid FROM porter WHERE porter MATCH 'Frustration'} {1}
|
||||
##########################################################################
|
||||
set sqlite_fts3_enable_parentheses 1
|
||||
read_test 1.6.1.3 {
|
||||
SELECT * FROM docs WHERE docs MATCH 'sqlite OR database library'
|
||||
} {{sqlite is a software system} {sqlite is a database} {sqlite is also a library} {the sqlite library runs on linux} {as does the sqlite database (on linux)} {the sqlite database is accessed by the sqlite library}}
|
||||
read_test 1.6.1.4 {
|
||||
SELECT * FROM docs WHERE docs MATCH '(sqlite OR database) library'
|
||||
} {{sqlite is also a library} {the sqlite library runs on linux} {the sqlite database is accessed by the sqlite library}}
|
||||
set sqlite_fts3_enable_parentheses 0
|
||||
ddl_test 1.6.1.5 { DROP TABLE docs }
|
||||
|
||||
##########################################################################
|
||||
# Test the examples in section 4 (auxillary functions).
|
||||
#
|
||||
ddl_test 3.1.1 { CREATE VIRTUAL TABLE mail USING fts3(subject, body) }
|
||||
ddl_test 1.7.1.1 { CREATE VIRTUAL TABLE mail USING fts3(subject, body) }
|
||||
|
||||
write_test 3.1.2 mail_content {
|
||||
write_test 1.7.1.2 mail_content {
|
||||
INSERT INTO mail VALUES(
|
||||
'hello world', 'This message is a hello world message.');
|
||||
}
|
||||
write_test 3.1.3 mail_content {
|
||||
write_test 1.7.1.3 mail_content {
|
||||
INSERT INTO mail VALUES(
|
||||
'urgent: serious', 'This mail is seen as a more serious mail');
|
||||
}
|
||||
|
||||
read_test 3.1.4 {
|
||||
read_test 1.7.1.4 {
|
||||
SELECT offsets(mail) FROM mail WHERE mail MATCH 'world';
|
||||
} {{0 0 6 5 1 0 24 5}}
|
||||
read_test 3.1.5 {
|
||||
read_test 1.7.1.5 {
|
||||
SELECT offsets(mail) FROM mail WHERE mail MATCH 'message'
|
||||
} {{1 0 5 7 1 0 30 7}}
|
||||
read_test 3.1.6 {
|
||||
read_test 1.7.1.6 {
|
||||
SELECT offsets(mail) FROM mail WHERE mail MATCH '"serious mail"'
|
||||
} {{1 0 28 7 1 1 36 4}}
|
||||
|
||||
ddl_test 3.2.1 { CREATE VIRTUAL TABLE text USING fts3() }
|
||||
ddl_test 1.7.2.1 { CREATE VIRTUAL TABLE text USING fts3() }
|
||||
|
||||
write_test 3.2.2 text_content {
|
||||
INSERT INTO text VALUES('
|
||||
@@ -351,15 +405,32 @@ write_test 3.2.2 text_content {
|
||||
');
|
||||
}
|
||||
|
||||
read_test 3.2.3 {
|
||||
read_test 1.7.2.3 {
|
||||
SELECT snippet(text) FROM text WHERE text MATCH 'cold'
|
||||
} {{<b>...</b> elsewhere, minimum temperature 17-20oC. <b>Cold</b> to very <b>cold</b> on mountaintops, minimum <b>...</b>}}
|
||||
|
||||
read_test 3.2.4 {
|
||||
read_test 1.7.2.4 {
|
||||
SELECT snippet(text, '[', ']', '...') FROM text WHERE text MATCH '"min* tem*"'
|
||||
} {{... 2-3oC drops. Cool in the upper portion, [minimum] [temperature] 14-16oC and cool elsewhere, [minimum] ...}}
|
||||
|
||||
#break
|
||||
##########################################################################
|
||||
# Test the example in section 5 (custom tokenizers).
|
||||
#
|
||||
ddl_test 1.8.1.1 { CREATE VIRTUAL TABLE simple USING fts3(tokenize=simple) }
|
||||
write_test 1.8.1.2 simple_content {
|
||||
INSERT INTO simple VALUES('Right now they''re very frustrated')
|
||||
}
|
||||
read_test 1.8.1.3 {SELECT docid FROM simple WHERE simple MATCH 'Frustrated'} {1}
|
||||
read_test 1.8.1.4 {SELECT docid FROM simple WHERE simple MATCH 'Frustration'} {}
|
||||
|
||||
ddl_test 1.8.2.1 { CREATE VIRTUAL TABLE porter USING fts3(tokenize=porter) }
|
||||
write_test 1.8.2.2 porter_content {
|
||||
INSERT INTO porter VALUES('Right now they''re very frustrated')
|
||||
}
|
||||
read_test 1.8.2.4 {
|
||||
SELECT docid FROM porter WHERE porter MATCH 'Frustration'
|
||||
} {1}
|
||||
|
||||
}
|
||||
# End of tests of example code in fts3.html
|
||||
#-------------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user