summaryrefslogtreecommitdiffstats
path: root/ext/fts5/test/fts5doclist.test
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-05 17:28:19 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-05 17:28:19 +0000
commit18657a960e125336f704ea058e25c27bd3900dcb (patch)
tree17b438b680ed45a996d7b59951e6aa34023783f2 /ext/fts5/test/fts5doclist.test
parentInitial commit. (diff)
downloadsqlite3-18657a960e125336f704ea058e25c27bd3900dcb.tar.xz
sqlite3-18657a960e125336f704ea058e25c27bd3900dcb.zip
Adding upstream version 3.40.1.upstream/3.40.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'ext/fts5/test/fts5doclist.test')
-rw-r--r--ext/fts5/test/fts5doclist.test67
1 files changed, 67 insertions, 0 deletions
diff --git a/ext/fts5/test/fts5doclist.test b/ext/fts5/test/fts5doclist.test
new file mode 100644
index 0000000..08b773f
--- /dev/null
+++ b/ext/fts5/test/fts5doclist.test
@@ -0,0 +1,67 @@
+# 2015 April 21
+#
+# 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 test is focused on edge cases in the doclist format.
+#
+
+source [file join [file dirname [info script]] fts5_common.tcl]
+set testprefix fts5doclist
+
+# If SQLITE_ENABLE_FTS5 is defined, omit this file.
+ifcapable !fts5 {
+ finish_test
+ return
+}
+
+
+#-------------------------------------------------------------------------
+# Create a table with 1000 columns. Then add some large documents to it.
+# All text is in the right most column of the table.
+#
+do_test 1.0 {
+ set cols [list]
+ for {set i 0} {$i < 900} {incr i} { lappend cols "x$i" }
+ execsql "CREATE VIRTUAL TABLE ccc USING fts5([join $cols ,])"
+} {}
+
+db func rnddoc fts5_rnddoc
+do_execsql_test 1.1 {
+ WITH ii(i) AS (SELECT 1 UNION SELECT i+1 FROM ii WHERE i<100)
+ INSERT INTO ccc(x899) SELECT rnddoc(500) FROM ii;
+}
+
+do_execsql_test 1.2 {
+ INSERT INTO ccc(ccc) VALUES('integrity-check');
+}
+
+#-------------------------------------------------------------------------
+#
+reset_db
+do_execsql_test 2.1 {
+ CREATE VIRTUAL TABLE tx USING fts5(x);
+}
+
+set doc [string repeat "abc " 5000]
+do_execsql_test 2.2 {
+ BEGIN;
+ INSERT INTO tx(rowid, x) VALUES(-9000000000000000000, $doc);
+ INSERT INTO tx(rowid, x) VALUES(9000000000000000000, $doc);
+ COMMIT;
+}
+
+do_execsql_test 2.3 {
+ SELECT rowid FROM tx('abc');
+} {
+ -9000000000000000000
+ 9000000000000000000
+}
+
+finish_test