sqlite
[Ported from github.com/sqlite/sqlite] Fix bugs in and improve the interface to the ".check" command of the CLI.
Brought by drakestapleton
| 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 | |
| 13 | set testdir [file dirname $argv0] |
| 14 | source $testdir/tester.tcl |
| 15 | source $testdir/fts3_common.tcl |
| 16 | set ::testprefix fts4min |
| 17 | |
| 18 | # If SQLITE_ENABLE_FTS3 is defined, omit this file. |
| 19 | ifcapable !fts3 { |
| 20 | finish_test |
| 21 | return |
| 22 | } |
| 23 | |
| 24 | #------------------------------------------------------------------ |
| 25 | do_execsql_test 0.0 { |
| 26 | CREATE TABLE t1(a NOT NULL, b); |
| 27 | CREATE INDEX i1 ON t1(a); |
| 28 | } |
| 29 | |
| 30 | do_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 | |
| 37 | do_eqp_test 1.1.1 { |
| 38 | SELECT max(rowid) FROM ft |
| 39 | } {VIRTUAL TABLE INDEX 0:DESC} |
| 40 | |
| 41 | do_eqp_test 1.1.2 { |
| 42 | SELECT min(rowid) FROM ft |
| 43 | } {VIRTUAL TABLE INDEX 0:ASC} |
| 44 | |
| 45 | do_execsql_test 1.2.1 { |
| 46 | SELECT max(rowid) FROM ft |
| 47 | } {44} |
| 48 | |
| 49 | do_execsql_test 1.2.2 { |
| 50 | SELECT min(rowid) FROM ft |
| 51 | } {11} |
| 52 | |
| 53 | finish_test |