xref: /sqlite-3.40.0/test/fts4min.test (revision 67e2bb92)
1# 2020 February 27
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
13set testdir [file dirname $argv0]
14source $testdir/tester.tcl
15source $testdir/fts3_common.tcl
16set ::testprefix fts4min
17
18# If SQLITE_ENABLE_FTS3 is defined, omit this file.
19ifcapable !fts3 {
20  finish_test
21  return
22}
23
24#------------------------------------------------------------------
25do_execsql_test 0.0 {
26  CREATE TABLE t1(a NOT NULL, b);
27  CREATE INDEX i1 ON t1(a);
28}
29
30do_execsql_test 1.0 {
31  CREATE VIRTUAL TABLE ft USING fts3(c);
32  INSERT INTO ft(docid, c) VALUES(22, 'hello world');
33  INSERT INTO ft(docid, c) VALUES(44, 'hello world');
34  INSERT INTO ft(docid, c) VALUES(11, 'hello world');
35}
36
37do_eqp_test 1.1.1 {
38  SELECT max(rowid) FROM ft
39} {VIRTUAL TABLE INDEX 0:DESC}
40
41do_eqp_test 1.1.2 {
42  SELECT min(rowid) FROM ft
43} {VIRTUAL TABLE INDEX 0:ASC}
44
45do_execsql_test 1.2.1 {
46  SELECT max(rowid) FROM ft
47} {44}
48
49do_execsql_test 1.2.2 {
50  SELECT min(rowid) FROM ft
51} {11}
52
53finish_test
54