summaryrefslogtreecommitdiffstats
path: root/test/fts3f.test
diff options
context:
space:
mode:
Diffstat (limited to 'test/fts3f.test')
-rw-r--r--test/fts3f.test57
1 files changed, 57 insertions, 0 deletions
diff --git a/test/fts3f.test b/test/fts3f.test
new file mode 100644
index 0000000..d9a57cb
--- /dev/null
+++ b/test/fts3f.test
@@ -0,0 +1,57 @@
+# 2006 September 9
+#
+# The author disclaims copyright to this source code. In place of
+# a legal notice, here is a blessing:
+#
+# May you do good and not evil.
+# May you find forgiveness for yourself and forgive others.
+# May you share freely, never taking more than you give.
+#
+#*************************************************************************
+# This file implements regression tests for SQLite library. The
+# focus of this script is testing the FTS3 module.
+#
+# $Id: fts3aa.test,v 1.1 2007/08/20 17:38:42 shess Exp $
+#
+
+set testdir [file dirname $argv0]
+source $testdir/tester.tcl
+set testprefix fts3f
+
+# If SQLITE_ENABLE_FTS3 is defined, omit this file.
+ifcapable !fts3 {
+ finish_test
+ return
+}
+
+do_execsql_test 1.0 {
+ CREATE VIRTUAL TABLE ft USING fts3(x);
+ BEGIN;
+ INSERT INTO ft VALUES('a one'), ('b one'), ('c one');
+}
+
+do_test 1.1 {
+ set ret [list]
+ db eval { SELECT docid FROM ft WHERE ft MATCH 'one' } {
+ if { $docid==2 } {
+ db eval COMMIT
+ }
+ lappend ret $docid
+ }
+ set ret
+} {1 2 3}
+
+do_execsql_test 1.2 {
+ BEGIN;
+ INSERT INTO ft VALUES('a one'), ('b one'), ('c one');
+}
+
+do_execsql_test 1.3 {
+ SELECT docid, optimize(ft) FROM ft WHERE ft MATCH 'one'
+} {
+ 1 {Index optimized} 2 {Index already optimal} 3 {Index already optimal}
+ 4 {Index already optimal}
+ 5 {Index already optimal} 6 {Index already optimal}
+}
+
+finish_test