Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(577)

Unified Diff: third_party/sqlite/sqlite-src-3070603/test/fts2g.test

Issue 949043002: Add //third_party/sqlite to dirs_to_snapshot, remove net_sql.patch (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/sqlite/sqlite-src-3070603/test/fts2g.test
diff --git a/third_party/sqlite/sqlite-src-3070603/test/fts2g.test b/third_party/sqlite/sqlite-src-3070603/test/fts2g.test
new file mode 100644
index 0000000000000000000000000000000000000000..4cffb91fc7f1f4359e4c2339b0f4f4a672b75a13
--- /dev/null
+++ b/third_party/sqlite/sqlite-src-3070603/test/fts2g.test
@@ -0,0 +1,93 @@
+# 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.3 2007/11/16 00:23:08 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');
+ INSERT INTO t1 (rowid, content) VALUES(2, 'also 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}}
+
+# Test that docListOrMerge() correctly handles reaching the end of one
+# doclist before it reaches the end of the other.
+do_test fts2g-1.11 {
+ execsql {SELECT rowid FROM t1 WHERE t1 MATCH 'this OR also'}
+} {1 2}
+do_test fts2g-1.12 {
+ execsql {SELECT rowid FROM t1 WHERE t1 MATCH 'also OR this'}
+} {1 2}
+
+# Empty left and right in docListOrMerge(). Each term matches neither
+# row, and when combined there was an assertion failure.
+do_test fts2g-1.13 {
+ execsql {SELECT rowid FROM t1 WHERE t1 MATCH 'something OR nothing'}
+} {}
+
+finish_test
« no previous file with comments | « third_party/sqlite/sqlite-src-3070603/test/fts2f.test ('k') | third_party/sqlite/sqlite-src-3070603/test/fts2h.test » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698