From 63847496f14c813a5d80efd5b7de0f1294ffe1e3 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sat, 13 Apr 2024 16:07:11 +0200 Subject: Adding upstream version 3.45.1. Signed-off-by: Daniel Baumann --- test/whereC.test | 70 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100644 test/whereC.test (limited to 'test/whereC.test') diff --git a/test/whereC.test b/test/whereC.test new file mode 100644 index 0000000..f172069 --- /dev/null +++ b/test/whereC.test @@ -0,0 +1,70 @@ +# 2011 November 16 +# +# The author disclaims copyright to this source code. In place of +# a legal notice, here is a blessing: +# +# May you do good and not evil. +# May you find forgiveness for yourself and forgive others. +# May you share freely, never taking more than you give. +# +#*********************************************************************** +# + +set testdir [file dirname $argv0] +source $testdir/tester.tcl +set testprefix whereC + +do_execsql_test 1.0 { + CREATE TABLE t1(i INTEGER PRIMARY KEY, a, b INTEGER); + + INSERT INTO t1 VALUES(1, 1, 1); + INSERT INTO t1 VALUES(2, 1, 1); + INSERT INTO t1 VALUES(3, 1, 2); + INSERT INTO t1 VALUES(4, 1, 2); + INSERT INTO t1 VALUES(5, 1, 2); + INSERT INTO t1 VALUES(6, 1, 3); + INSERT INTO t1 VALUES(7, 1, 3); + + INSERT INTO t1 VALUES(8, 2, 1); + INSERT INTO t1 VALUES(9, 2, 1); + INSERT INTO t1 VALUES(10, 2, 2); + INSERT INTO t1 VALUES(11, 2, 2); + INSERT INTO t1 VALUES(12, 2, 2); + INSERT INTO t1 VALUES(13, 2, 3); + INSERT INTO t1 VALUES(14, 2, 3); + + INSERT INTO t1 VALUES(15, 2, 1); + INSERT INTO t1 VALUES(16, 2, 1); + INSERT INTO t1 VALUES(17, 2, 2); + INSERT INTO t1 VALUES(18, 2, 2); + INSERT INTO t1 VALUES(19, 2, 2); + INSERT INTO t1 VALUES(20, 2, 3); + INSERT INTO t1 VALUES(21, 2, 3); + + CREATE INDEX i1 ON t1(a, b); +} + +foreach {tn sql res} { + 1 "SELECT i FROM t1 WHERE a=1 AND b=2 AND i>3" {4 5} + 2 "SELECT i FROM t1 WHERE rowid='12'" {12} + 3 "SELECT i FROM t1 WHERE a=1 AND b='2'" {3 4 5} + 4 "SELECT i FROM t1 WHERE a=1 AND b='2' AND i>'3'" {4 5} + 5 "SELECT i FROM t1 WHERE a=1 AND b='2' AND i<5" {3 4} + 6 "SELECT i FROM t1 WHERE a=2 AND b=2 AND i<12" {10 11} + 7 "SELECT i FROM t1 WHERE a IN(1, 2) AND b=2 AND i<11" {3 4 5 10} + 8 "SELECT i FROM t1 WHERE a=2 AND b=2 AND i BETWEEN 10 AND 12" {10 11 12} + 9 "SELECT i FROM t1 WHERE a=2 AND b=2 AND i BETWEEN 11 AND 12" {11 12} + 10 "SELECT i FROM t1 WHERE a=2 AND b=2 AND i BETWEEN 10 AND 11" {10 11} + 11 "SELECT i FROM t1 WHERE a=2 AND b=2 AND i BETWEEN 12 AND 10" {} + 12 "SELECT i FROM t1 WHERE a=2 AND b=2 AND i=NULL" {} + 14 "SELECT i FROM t1 WHERE a=1 AND b='2' AND i<4.5" {3 4} + 15 "SELECT i FROM t1 WHERE rowid IS '12'" {12} +} { + do_execsql_test 1.$tn.1 $sql $res + do_execsql_test 1.$tn.2 "$sql ORDER BY i ASC" [lsort -integer -inc $res] + do_execsql_test 1.$tn.3 "$sql ORDER BY i DESC" [lsort -integer -dec $res] +} + + +finish_test -- cgit v1.2.3