xref: /sqlite-3.40.0/test/whereD.test (revision bfca6a40)
1# 2012 August 24
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.  The
12# focus of this file is testing that an index may be used as a covering
13# index when there are OR expressions in the WHERE clause.
14#
15
16
17set testdir [file dirname $argv0]
18source $testdir/tester.tcl
19set ::testprefix whereD
20
21do_execsql_test 1.1 {
22  CREATE TABLE t(i,j,k);
23  CREATE INDEX i ON t(i,j,k);
24
25  INSERT INTO t VALUES(3, 3, 'three');
26  INSERT INTO t VALUES(2, 2, 'two');
27  INSERT INTO t VALUES(1, 1, 'one');
28  INSERT INTO t VALUES(4, 4, 'four');
29}
30
31do_execsql_test 1.2 {
32  SELECT k FROM t WHERE (i=1 AND j=1) OR (i=2 AND j=2);
33} {one two}
34
35finish_test
36
37