xref: /sqlite-3.40.0/test/tkt3581.test (revision 94eb90c7)
1# 2008 January 13
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# This file implements tests to verify that ticket #3581 has been
14# fixed.
15#
16# $Id: tkt3581.test,v 1.1 2009/01/14 01:10:40 drh Exp $
17
18set testdir [file dirname $argv0]
19source $testdir/tester.tcl
20
21do_test tkt3581-1.1 {
22  db eval {
23    CREATE TABLE t1(a INTEGER PRIMARY KEY, b, c);
24    INSERT INTO t1 VALUES(0,544,846);
25    INSERT INTO t1 VALUES(1,345,51);
26    CREATE TABLE t2(a INTEGER PRIMARY KEY, b, c);
27    INSERT INTO t2 SELECT * FROM t1;
28    CREATE INDEX i2 on t2(c);
29  }
30} {}
31
32do_test tkt3581-1.2 {
33  db eval {
34    SELECT a FROM t1
35     WHERE (b > 45 AND c < 356)
36        OR b <= 733
37        OR b >= 557
38        OR (b >= 614 AND c < 251)
39     ORDER BY b;
40  }
41} {1 0}
42
43do_test tkt3581-1.3 {
44  db eval {
45    SELECT a FROM t2
46     WHERE (b > 45 AND c < 356)
47        OR b <= 733
48        OR b >= 557
49        OR (b >= 614 AND c < 251)
50     ORDER BY b;
51  }
52} {1 0}
53
54finish_test
55