summaryrefslogtreecommitdiff
path: root/test/fts2m.test
diff options
context:
space:
mode:
authorCy Schubert <cy@FreeBSD.org>2022-01-05 19:24:29 +0000
committerCy Schubert <cy@FreeBSD.org>2022-01-05 19:24:29 +0000
commit9b0b0740be1f3d3751d366f3bb2952090a9dc505 (patch)
tree596fd97301bf8c0581936cf70bf5f2d58bdb6b80 /test/fts2m.test
parent0511e356f5e2106928ee352ee974d1470c860a9a (diff)
Diffstat (limited to 'test/fts2m.test')
-rw-r--r--test/fts2m.test65
1 files changed, 65 insertions, 0 deletions
diff --git a/test/fts2m.test b/test/fts2m.test
new file mode 100644
index 000000000000..6552637a62ce
--- /dev/null
+++ b/test/fts2m.test
@@ -0,0 +1,65 @@
+# 2007 April 9
+#
+# The author disclaims copyright to this source code.
+#
+#*************************************************************************
+# This file implements regression tests for SQLite library. fts2
+# DELETE handling assumed all fields were non-null. This was not
+# the intention at all.
+#
+# $Id: fts2m.test,v 1.1 2007/04/09 20:45:42 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(col_a, col_b);
+
+ INSERT INTO t1(rowid, col_a, col_b) VALUES(1, 'testing', 'testing');
+ INSERT INTO t1(rowid, col_a, col_b) VALUES(2, 'only a', null);
+ INSERT INTO t1(rowid, col_a, col_b) VALUES(3, null, 'only b');
+ INSERT INTO t1(rowid, col_a, col_b) VALUES(4, null, null);
+}
+
+do_test fts2m-1.0 {
+ execsql {
+ SELECT COUNT(col_a), COUNT(col_b), COUNT(*) FROM t1;
+ }
+} {2 2 4}
+
+do_test fts2m-1.1 {
+ execsql {
+ DELETE FROM t1 WHERE rowid = 1;
+ SELECT COUNT(col_a), COUNT(col_b), COUNT(*) FROM t1;
+ }
+} {1 1 3}
+
+do_test fts2m-1.2 {
+ execsql {
+ DELETE FROM t1 WHERE rowid = 2;
+ SELECT COUNT(col_a), COUNT(col_b), COUNT(*) FROM t1;
+ }
+} {0 1 2}
+
+do_test fts2m-1.3 {
+ execsql {
+ DELETE FROM t1 WHERE rowid = 3;
+ SELECT COUNT(col_a), COUNT(col_b), COUNT(*) FROM t1;
+ }
+} {0 0 1}
+
+do_test fts2m-1.4 {
+ execsql {
+ DELETE FROM t1 WHERE rowid = 4;
+ SELECT COUNT(col_a), COUNT(col_b), COUNT(*) FROM t1;
+ }
+} {0 0 0}
+
+finish_test