summaryrefslogtreecommitdiffstats
path: root/ext/fts5/test/fts5doclist.test
blob: 08b773f6f52fd18aaa9f00b2c3d57eeadbf954a3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
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