]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Add test cases for examples recently added to documentation file fts3.html.
authordan <dan@noemail.net>
Mon, 30 Nov 2009 08:55:03 +0000 (08:55 +0000)
committerdan <dan@noemail.net>
Mon, 30 Nov 2009 08:55:03 +0000 (08:55 +0000)
FossilOrigin-Name: 498922cc356316a3ec59320529b685728e407746

manifest
manifest.uuid
test/e_fts3.test
test/fts3_common.tcl

index 909d7cf25fd7bbf96b5c4cecd387fdafa942fe6d..383980841b402f98bf6fc6b2207a91b67be9fb01 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,8 +1,5 @@
------BEGIN PGP SIGNED MESSAGE-----
-Hash: SHA1
-
-C Updates\sto\ssnippet()\sand\soffsets()\sfunctions\sof\sFTS3\sso\sthat\sthey\swork\nsanely\sfollowing\san\sOOM\sfault.
-D 2009-11-28T21:33:21
+C Add\stest\scases\sfor\sexamples\srecently\sadded\sto\sdocumentation\sfile\sfts3.html.
+D 2009-11-30T08:55:04
 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 488055f7c223e289ea341d55a7e1dd5281893b93
+F test/e_fts3.test 24bb398086eca6d8d3dab64d383d5bb2dd4ff681
 F test/enc.test e54531cd6bf941ee6760be041dff19a104c7acea
 F test/enc2.test 6d91a5286f59add0cfcbb2d0da913b76f2242398
 F test/enc3.test 5c550d59ff31dccdba5d1a02ae11c7047d77c041
@@ -380,7 +377,7 @@ F test/fts2q.test b2fbbe038b7a31a52a6079b215e71226d8c6a682
 F test/fts2r.test b154c30b63061d8725e320fba1a39e2201cadd5e
 F test/fts2token.test d8070b241a15ff13592a9ae4a8b7c171af6f445a
 F test/fts3.test f4f380d3717493605270dfa3b0fa893ea0afb18d
-F test/fts3_common.tcl cdc89bb78754d54b19d8a5dfabd14575742a5293
+F test/fts3_common.tcl 31935839b1b601a5955572cb4e8060513c96bde0
 F test/fts3aa.test 5327d4c1d9b6c61021696746cc9a6cdc5bf159c0
 F test/fts3ab.test 09aeaa162aee6513d9ff336b6932211008b9d1f9
 F test/fts3ac.test 356280144a2c92aa7b11474afadfe62a437fcd69
@@ -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 31eed4f8f95f0799d634eccbd9e09cb58172d250
-R 63b6d1158b26a83c6b254a0d208f841c
-U drh
-Z 8559238aab4fefe4430f422ac07d6956
------BEGIN PGP SIGNATURE-----
-Version: GnuPG v1.4.6 (GNU/Linux)
-
-iD8DBQFLEZckoxKgR168RlERAilJAJ9fOhH9A66qH4Y5YOtTa1Ji3y2FSACcC046
-fNgY4pufsjXCsUyJbj/lIyo=
-=K2mf
------END PGP SIGNATURE-----
+P b939a37a8ce296785a300e79ab9d3d87ad91343f
+R 07bf5d7ea8efdfde49b03310dbe8e9d5
+U dan
+Z 5540823be73c9695614535782a706576
index 689f72bae294ef53303d8ee3a28cc3786e6086c1..f97326b15557c83a8f28c5d654b9b4a3d59b5f3a 100644 (file)
@@ -1 +1 @@
-b939a37a8ce296785a300e79ab9d3d87ad91343f
\ No newline at end of file
+498922cc356316a3ec59320529b685728e407746
\ No newline at end of file
index be67ebb35635b26af440d26df083fd0f3dfe6e3b..0c23d225bb13ea0f41796e2ff4b6afa5971b8999 100644 (file)
@@ -104,5 +104,64 @@ ddl_test   1.7.3 {DROP TABLE data}
 
 ##########################################################################
 
+##########################################################################
+# Test the example in section 5 (custom tokenizers).
+#
+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'} {}
+
+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}
+
+##########################################################################
+# Test the examples in section 4 (auxillary functions).
+#
+ddl_test   3.1.1 { CREATE VIRTUAL TABLE mail USING fts3(subject, body) }
+
+write_test 3.1.2 mail_content { 
+  INSERT INTO mail VALUES(
+    'hello world', 'This message is a hello world message.');
+}
+write_test 3.1.3 mail_content { 
+  INSERT INTO mail VALUES(
+    'urgent: serious', 'This mail is seen as a more serious mail');
 }
+
+read_test 3.1.4 { 
+  SELECT offsets(mail) FROM mail WHERE mail MATCH 'world';
+} {{0 0 6 5 1 0 24 5}}
+read_test 3.1.5 { 
+  SELECT offsets(mail) FROM mail WHERE mail MATCH 'message'
+} {{1 0 5 7 1 0 30 7}}
+read_test 3.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() }
+
+write_test 3.2.2 text_content {
+  INSERT INTO text VALUES('
+    During 30 Nov-1 Dec, 2-3oC drops. Cool in the upper portion, minimum temperature 14-16oC and cool elsewhere, minimum temperature 17-20oC. Cold to very cold on mountaintops, minimum temperature 6-12oC. Northeasterly winds 15-30 km/hr. After that, temperature increases. Northeasterly winds 15-30 km/hr.
+  ');
+}
+
+read_test 3.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 {
+  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
+}
+
 finish_test
index a6de4ab26fb296539163eb44c5d6aa7c2b192c1b..f954f5c32b39da52dadf5d41a2d9f532b1a81507 100644 (file)
@@ -334,7 +334,7 @@ proc doPassiveTest {name sql catchres} {
       if {$::DO_MALLOC_TEST} {sqlite3_memdebug_fail $iFail -repeat $nRepeat}
 
       set res [catchsql $sql]
-      if {[lsearch $answers $res]>=0} {
+      if {[lsearch -exact $answers $res]>=0} {
         set res $str
       }
       do_test $name.$zName.$iFail [list set {} $res] $str