xref: /sqlite-3.40.0/test/indexexpr2.test (revision c5e56b34)
1# 2017 April 11
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# This file implements regression tests for SQLite library.
12#
13
14set testdir [file dirname $argv0]
15source $testdir/tester.tcl
16set testprefix indexexpr2
17
18do_execsql_test 1 {
19  CREATE TABLE t1(a, b);
20  INSERT INTO t1 VALUES(1, 'one');
21  INSERT INTO t1 VALUES(2, 'two');
22  INSERT INTO t1 VALUES(3, 'three');
23
24  CREATE INDEX i1 ON t1(b || 'x');
25}
26
27do_execsql_test 1.1 {
28  SELECT 'TWOX' == (b || 'x') FROM t1 WHERE (b || 'x')>'onex'
29} {0 0}
30
31do_execsql_test 1.2 {
32  SELECT 'TWOX' == (b || 'x') COLLATE nocase  FROM t1 WHERE (b || 'x')>'onex'
33} {0 1}
34
35do_execsql_test 2.0 {
36  CREATE INDEX i2 ON t1(a+1);
37}
38
39do_execsql_test 2.1 {
40  SELECT a+1, quote(a+1) FROM t1 ORDER BY 1;
41} {2 2 3 3 4 4}
42
43finish_test
44
45