interplane.Get Omega
Read in your language

sqlite

[Ported from github.com/sqlite/sqlite] Fix bugs in and improve the interface to the ".check" command of the CLI.

Brought by drakestapleton

branch master Branches Tags History

sqlite / ext / fts5 / test / fts5aux2.test

71 lines · 1530 bytes Raw Blame History
1# 2024 June 24
2#
3# The author disclaims copyright to this source code. In place of
4# a legal notice, here is a blessing:
5#
6# May you do good and not evil.
7# May you find forgiveness for yourself and forgive others.
8# May you share freely, never taking more than you give.
9#
10#***********************************************************************
11#
12# Tests focusing on the auxiliary function APIs.
13#
14
15source [file join [file dirname [info script]] fts5_common.tcl]
16set testprefix fts5aux
17
18# If SQLITE_ENABLE_FTS5 is not defined, omit this file.
19ifcapable !fts5 {
20 finish_test
21 return
22}
23
24do_execsql_test 1.0 {
25 CREATE VIRTUAL TABLE x1 USING fts5(a, b);
26 INSERT INTO x1 VALUES('a b', 'c d');
27 INSERT INTO x1 VALUES('d e', 'a b');
28 INSERT INTO x1 VALUES('a b', 'e f');
29 INSERT INTO x1 VALUES('d e', 'c d');
30}
31
32fts5_aux_test_functions db
33do_execsql_test 1.1 {
34 SELECT fts5_test_all(x1) FROM x1 WHERE rowid=2
35} [list [list {*}{
36 columnsize {2 2}
37 columntext {{d e} {a b}}
38 columntotalsize {8 8}
39 poslist {}
40 tokenize {{d e} {a b}}
41 rowcount 4
42}]]
43
44do_execsql_test 1.2 {
45 SELECT fts5_test_columntext(x1) FROM x1
46} {
47 {{a b} {c d}}
48 {{d e} {a b}}
49 {{a b} {e f}}
50 {{d e} {c d}}
51}
52
53do_execsql_test 1.3 {
54 SELECT fts5_test_rowid(x1) FROM x1
55} {
56 1 2 3 4
57}
58do_execsql_test 1.4 {
59 SELECT fts5_test_phrasecount(x1) FROM x1
60} {
61 0 0 0 0
62}
63do_catchsql_test 1.5 {
64 SELECT fts5_queryphrase(x1, 0) FROM x1
65} {1 SQLITE_RANGE}
66do_execsql_test 1.6 {
67 SELECT fts5_test_rowcount(x1) FROM x1
68} {4 4 4 4}
69
70
71finish_test