]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Test to force edge cases in query logic. Basically, exercise code to
authorshess <shess@noemail.net>
Wed, 25 Oct 2006 20:27:39 +0000 (20:27 +0000)
committershess <shess@noemail.net>
Wed, 25 Oct 2006 20:27:39 +0000 (20:27 +0000)
handle lack of hits correctly. (CVS 3485)

FossilOrigin-Name: 2cb59033662f25677169e2e63b871fb0a4c10c21

manifest
manifest.uuid
test/fts2g.test [new file with mode: 0644]

index 19f8e6a8819f278d3950fa021932100ab27cda30..a267a81892a7f86db120fadf990f9a74f6540803 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Don't\sstore\sempty\ssegments.\s\sWhen\sinserting\sempty\sstrings,\sthe\scode\nwas\swriting\sout\sa\ssegment\smade\sup\sof\sa\ssingle\sleaf\snode\scontaining\sthe\n\\0\sheader.\s\sLeafReader\sassumed\sthat\sleaf\snodes\salways\scontained\sat\nleast\sone\sterm,\sso\sassertions\swould\sfail.\n\nWhile\sit\swould\sbe\spossible\sto\ssupport\sreading\sand\smerging\sempty\nsegments,\sthere's\sno\sreason\sto\sdo\sso.\s\sWhile\sthis\schange\scould\shave\nbeen\sdone\sin\swriteZeroSegment(),\sI\sput\sit\sin\sleafWriterFlush()\sso\sthat\nit\swould\swork\sright\sif\ssegmentMerge()\screated\san\sempty\ssegment,\swhich\ncould\shappen\swith\sfuture\schanges\sto\show\sdeleted\sdocuments\sare\shandled.\s(CVS\s3484)
-D 2006-10-25T05:21:55
+C Test\sto\sforce\sedge\scases\sin\squery\slogic.\s\sBasically,\sexercise\scode\sto\nhandle\slack\sof\shits\scorrectly.\s(CVS\s3485)
+D 2006-10-25T20:27:40
 F Makefile.in 4379c909d46b38b8c5db3533084601621d4f14b2
 F Makefile.linux-gcc 2d8574d1ba75f129aba2019f0b959db380a90935
 F README 9c4e2d6706bdcc3efdd773ce752a8cdab4f90028
@@ -212,6 +212,7 @@ F test/fts2c.test ffb5a35230ac72c4354535c547965ce6824537c0
 F test/fts2d.test b7eaa671ca9a16997f3e5b158ee777ae21052b0b
 F test/fts2e.test 2da13dbc2d009105f42196845c1e1ce136c03d38
 F test/fts2f.test b5f2dde48199d79e859f59d3d857c17dd62a0129
+F test/fts2g.test c69a8ab43ec77d123976ba6cf9422d647ae63032
 F test/func.test 0ed54b5aeaad319f68016c033acfebef56f5874a
 F test/hook.test 7e7645fd9a033f79cce8fdff151e32715e7ec50a
 F test/in.test 369cb2aa1eab02296b4ec470732fe8c131260b1d
@@ -418,7 +419,7 @@ F www/tclsqlite.tcl bb0d1357328a42b1993d78573e587c6dcbc964b9
 F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0
 F www/version3.tcl 890248cf7b70e60c383b0e84d77d5132b3ead42b
 F www/whentouse.tcl 97e2b5cd296f7d8057e11f44427dea8a4c2db513
-P 2806c3415841b98d52163fa672a747d0a47ffd41
-R 5cdccaf3295b3f3b1078e6d0239b59c8
+P fed79beec7da24a26ae94494bdc0c98dd102bc06
+R 4db660d6bfc727b8865e6cec72d963b2
 U shess
-Z 9691b521636d92a41ca36d38cbd27e9e
+Z 0a6f719e83679a9d06c1c47ad51ed8b2
index 2336b4d90f681bed03152258013c19ad6fb8c5ce..dcaa3ee138258b0927fa6ba5e1b4ed285b4ee910 100644 (file)
@@ -1 +1 @@
-fed79beec7da24a26ae94494bdc0c98dd102bc06
\ No newline at end of file
+2cb59033662f25677169e2e63b871fb0a4c10c21
\ No newline at end of file
diff --git a/test/fts2g.test b/test/fts2g.test
new file mode 100644 (file)
index 0000000..8a60180
--- /dev/null
@@ -0,0 +1,77 @@
+# 2006 October 19
+#
+# The author disclaims copyright to this source code.
+#
+#*************************************************************************
+# This file implements regression tests for SQLite library.  The focus
+# of this script is testing handling of edge cases for various doclist
+# merging functions in the FTS2 module query logic.
+#
+# $Id: fts2g.test,v 1.1 2006/10/25 20:27:40 shess Exp $
+#
+
+set testdir [file dirname $argv0]
+source $testdir/tester.tcl
+
+# If SQLITE_ENABLE_FTS2 is defined, omit this file.
+ifcapable !fts2 {
+  finish_test
+  return
+}
+
+db eval {
+  CREATE VIRTUAL TABLE t1 USING fts2(content);
+  INSERT INTO t1 (rowid, content) VALUES(1, 'this is a test');
+}
+
+# No hits at all.  Returns empty doclists from termSelect().
+do_test fts2g-1.1 {
+  execsql {SELECT rowid FROM t1 WHERE t1 MATCH 'something'}
+} {}
+
+# Empty left in docListExceptMerge().
+do_test fts2g-1.2 {
+  execsql {SELECT rowid FROM t1 WHERE t1 MATCH '-this something'}
+} {}
+
+# Empty right in docListExceptMerge().
+do_test fts2g-1.3 {
+  execsql {SELECT rowid FROM t1 WHERE t1 MATCH 'this -something'}
+} {1}
+
+# Empty left in docListPhraseMerge().
+do_test fts2g-1.4 {
+  execsql {SELECT rowid FROM t1 WHERE t1 MATCH '"this something"'}
+} {}
+
+# Empty right in docListPhraseMerge().
+do_test fts2g-1.5 {
+  execsql {SELECT rowid FROM t1 WHERE t1 MATCH '"something is"'}
+} {}
+
+# Empty left in docListOrMerge().
+do_test fts2g-1.6 {
+  execsql {SELECT rowid FROM t1 WHERE t1 MATCH 'something OR this'}
+} {1}
+
+# Empty right in docListOrMerge().
+do_test fts2g-1.7 {
+  execsql {SELECT rowid FROM t1 WHERE t1 MATCH 'this OR something'}
+} {1}
+
+# Empty left in docListAndMerge().
+do_test fts2g-1.8 {
+  execsql {SELECT rowid FROM t1 WHERE t1 MATCH 'something this'}
+} {}
+
+# Empty right in docListAndMerge().
+do_test fts2g-1.9 {
+  execsql {SELECT rowid FROM t1 WHERE t1 MATCH 'this something'}
+} {}
+
+# No support for all-except queries.
+do_test fts2g-1.10 {
+  catchsql {SELECT rowid FROM t1 WHERE t1 MATCH '-this -something'}
+} {1 {SQL logic error or missing database}}
+
+finish_test