]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Add new test file fts5vocab2.test.
authordan <dan@noemail.net>
Sat, 12 Aug 2017 18:31:31 +0000 (18:31 +0000)
committerdan <dan@noemail.net>
Sat, 12 Aug 2017 18:31:31 +0000 (18:31 +0000)
FossilOrigin-Name: 02174842c353bfaa747019cb3dcdee5bca6551d0a06d83fc1ac6d4569e16bc34

ext/fts5/test/fts5vocab2.test [new file with mode: 0644]
manifest
manifest.uuid

diff --git a/ext/fts5/test/fts5vocab2.test b/ext/fts5/test/fts5vocab2.test
new file mode 100644 (file)
index 0000000..4a0a1f4
--- /dev/null
@@ -0,0 +1,209 @@
+# 2017 August 10
+#
+# 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.
+#
+#***********************************************************************
+#
+# The tests in this file focus on testing the fts5vocab module.
+#
+
+source [file join [file dirname [info script]] fts5_common.tcl]
+set testprefix fts5vocab
+
+# If SQLITE_ENABLE_FTS5 is defined, omit this file.
+ifcapable !fts5 {
+  finish_test
+  return
+}
+
+do_execsql_test 1.0 {
+  CREATE VIRTUAL TABLE t1 USING fts5(a, b);
+  CREATE VIRTUAL TABLE v1 USING fts5vocab(t1, instance);
+
+  INSERT INTO t1 VALUES('one two', 'two three');
+  INSERT INTO t1 VALUES('three four', 'four five five five');
+}
+
+do_execsql_test 1.1 {
+  SELECT * FROM v1;
+} {
+  five  2 b 1
+  five  2 b 2
+  five  2 b 3
+  four  2 a 1
+  four  2 b 0
+  one   1 a 0
+  three 1 b 1
+  three 2 a 0
+  two   1 a 1
+  two   1 b 0
+}
+
+do_execsql_test 1.2 {
+  SELECT * FROM v1 WHERE term='three';
+} {
+  three 1 b 1
+  three 2 a 0
+}
+
+do_execsql_test 1.3 {
+  BEGIN;
+    DELETE FROM t1 WHERE rowid=2;
+    SELECT * FROM v1;
+  ROLLBACK;
+} {
+  one   1 a 0
+  three 1 b 1
+  two   1 a 1
+  two   1 b 0
+}
+
+do_execsql_test 1.4 {
+  BEGIN;
+    DELETE FROM t1 WHERE rowid=1;
+    SELECT * FROM v1;
+  ROLLBACK;
+} {
+  five  2 b 1
+  five  2 b 2
+  five  2 b 3
+  four  2 a 1
+  four  2 b 0
+  three 2 a 0
+}
+
+do_execsql_test 1.5 {
+  DELETE FROM t1;
+  SELECT * FROM v1;
+} {
+}
+
+#-------------------------------------------------------------------------
+#
+do_execsql_test 2.0 {
+  DROP TABLE IF EXISTS t1;
+  DROP TABLE IF EXISTS v1;
+
+  CREATE VIRTUAL TABLE t1 USING fts5(a, b, detail=column);
+  CREATE VIRTUAL TABLE v1 USING fts5vocab(t1, instance);
+
+  INSERT INTO t1 VALUES('one two', 'two three');
+  INSERT INTO t1 VALUES('three four', 'four five five five');
+}
+
+do_execsql_test 2.1 {
+  SELECT * FROM v1;
+} {
+  five  2 b {}
+  four  2 a {}
+  four  2 b {}
+  one   1 a {}
+  three 1 b {}
+  three 2 a {}
+  two   1 a {}
+  two   1 b {}
+}
+
+do_execsql_test 2.2 {
+  SELECT * FROM v1 WHERE term='three';
+} {
+  three 1 b {}
+  three 2 a {}
+}
+
+do_execsql_test 2.3 {
+  BEGIN;
+    DELETE FROM t1 WHERE rowid=2;
+    SELECT * FROM v1;
+  ROLLBACK;
+} {
+  one   1 a {}
+  three 1 b {}
+  two   1 a {}
+  two   1 b {}
+}
+
+do_execsql_test 2.4 {
+  BEGIN;
+    DELETE FROM t1 WHERE rowid=1;
+    SELECT * FROM v1;
+  ROLLBACK;
+} {
+  five  2 b {}
+  four  2 a {}
+  four  2 b {}
+  three 2 a {}
+}
+
+do_execsql_test 2.5 {
+  DELETE FROM t1;
+  SELECT * FROM v1;
+} {
+}
+
+#-------------------------------------------------------------------------
+#
+do_execsql_test 3.0 {
+  DROP TABLE IF EXISTS t1;
+  DROP TABLE IF EXISTS v1;
+
+  CREATE VIRTUAL TABLE t1 USING fts5(a, b, detail=none);
+  CREATE VIRTUAL TABLE v1 USING fts5vocab(t1, instance);
+
+  INSERT INTO t1 VALUES('one two', 'two three');
+  INSERT INTO t1 VALUES('three four', 'four five five five');
+}
+
+do_execsql_test 3.1 {
+  SELECT * FROM v1;
+} {
+  five  2 {} {}
+  four  2 {} {}
+  one   1 {} {}
+  three 1 {} {}
+  three 2 {} {}
+  two   1 {} {}
+}
+
+do_execsql_test 3.2 {
+  SELECT * FROM v1 WHERE term='three';
+} {
+  three 1 {} {}
+  three 2 {} {}
+}
+
+do_execsql_test 3.3 {
+  BEGIN;
+    DELETE FROM t1 WHERE rowid=2;
+    SELECT * FROM v1;
+  ROLLBACK;
+} {
+  one   1 {} {}
+  three 1 {} {}
+  two   1 {} {}
+}
+
+do_execsql_test 3.4 {
+  BEGIN;
+    DELETE FROM t1 WHERE rowid=1;
+    SELECT * FROM v1;
+  ROLLBACK;
+} {
+  five  2 {} {}
+  four  2 {} {}
+  three 2 {} {}
+}
+
+do_execsql_test 3.5 {
+  DELETE FROM t1;
+  SELECT * FROM v1;
+} {
+}
+
+finish_test
+
index 9a39ea574bb6e195a2daf55bbdfc674d4dbd5bf9..8fbd0a2dcdc7181afcb9228ee764a92f5faf4065 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Update\sthe\sspeed-check.sh\stest\sscript\sto\sappend\slog\soutput\sto\sthe\send\sof\sthe\ncout-NAME.txt\sfile.
-D 2017-08-12T02:16:34.150
+C Add\snew\stest\sfile\sfts5vocab2.test.
+D 2017-08-12T18:31:31.810
 F Makefile.in d9873c9925917cca9990ee24be17eb9613a668012c85a343aef7e5536ae266e8
 F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434
 F Makefile.msc 02b469e9dcd5b7ee63fc1fb05babc174260ee4cfa4e0ef2e48c3c6801567a016
@@ -201,6 +201,7 @@ F ext/fts5/test/fts5unindexed.test 9021af86a0fb9fc616f7a69a996db0116e7936d0db638
 F ext/fts5/test/fts5update.test 0737876e20e97a6a6abf45de19fc99315727bcee6a83fadcada1cc080b9aa8f0
 F ext/fts5/test/fts5version.test 99b81372630fbf359107c96580fa761e41cdfb1dafc9966e148629ca72efee71
 F ext/fts5/test/fts5vocab.test 2ba98bcef0fcab3e5fead8eaabd6c0efb7e57bfe707a5cfcc18572ca9b277360
+F ext/fts5/test/fts5vocab2.test 2beeec974a305a1d79b91426622cc922c87065874437d22b400de7438979959e
 F ext/fts5/tool/fts5speed.tcl b0056f91a55b2d1a3684ec05729de92b042e2f85
 F ext/fts5/tool/fts5txt2db.tcl 526a9979c963f1c54fd50976a05a502e533a4c59
 F ext/fts5/tool/loadfts5.tcl 95b03429ee6b138645703c6ca192c3ac96eaf093
@@ -1646,7 +1647,7 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93
 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
 F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
 F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
-P 6e52fa5fd79988a433bae0152ceae036edab4bb18d2b48ed04c1f53f141728b0
-R 772c60eb3b2c75ff30436857fe8c0a95
-U drh
-Z 259464aafd26637749328aadb6f43b1b
+P 14d262d6aa4e281dfe0490988f0c1965c4babf98038a1a96b9bb5772a61521a3
+R 458c6571aa20c315f2d6b3e7fbde0c5a
+U dan
+Z d58fa1886079f8c44974d3b28910f9ac
index 5c0e0690f9e05fea113e3135458087ece9ffa613..ab91f374e9607e2f25688833b2007528260d7822 100644 (file)
@@ -1 +1 @@
-14d262d6aa4e281dfe0490988f0c1965c4babf98038a1a96b9bb5772a61521a3
\ No newline at end of file
+02174842c353bfaa747019cb3dcdee5bca6551d0a06d83fc1ac6d4569e16bc34
\ No newline at end of file