xref: /sqlite-3.40.0/test/selectC.test (revision ec8d2427)
1# 2008 September 16
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# $Id: selectC.test,v 1.1 2008/09/16 15:09:54 drh Exp $
14
15set testdir [file dirname $argv0]
16source $testdir/tester.tcl
17
18do_test selectC-1.1 {
19  execsql {
20    CREATE TABLE t1(a, b, c);
21    INSERT INTO t1 VALUES(1,'aaa','bbb');
22    INSERT INTO t1 SELECT * FROM t1;
23    INSERT INTO t1 VALUES(2,'ccc','ddd');
24
25    SELECT DISTINCT a AS x, b||c AS y
26      FROM t1
27     WHERE y IN ('aaabbb','xxx');
28  }
29} {1 aaabbb}
30do_test selectC-1.2 {
31  execsql {
32    SELECT DISTINCT a AS x, b||c AS y
33      FROM t1
34     WHERE b||c IN ('aaabbb','xxx');
35  }
36} {1 aaabbb}
37do_test selectC-1.3 {
38  execsql {
39    SELECT DISTINCT a AS x, b||c AS y
40      FROM t1
41     WHERE y='aaabbb'
42  }
43} {1 aaabbb}
44do_test selectC-1.4 {
45  execsql {
46    SELECT DISTINCT a AS x, b||c AS y
47      FROM t1
48     WHERE b||c='aaabbb'
49  }
50} {1 aaabbb}
51do_test selectC-1.5 {
52  execsql {
53    SELECT DISTINCT a AS x, b||c AS y
54      FROM t1
55     WHERE x=2
56  }
57} {2 cccddd}
58do_test selectC-1.6 {
59  execsql {
60    SELECT DISTINCT a AS x, b||c AS y
61      FROM t1
62     WHERE a=2
63  }
64} {2 cccddd}
65do_test selectC-1.7 {
66  execsql {
67    SELECT DISTINCT a AS x, b||c AS y
68      FROM t1
69     WHERE +y='aaabbb'
70  }
71} {1 aaabbb}
72
73finish_test
74