1 # 2010 June 09 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 14 set testdir [file dirname $argv0] 15 source $testdir/tester.tcl 16 17 do_test tkt-f973c7ac3-1.0 { 18 execsql { 19 CREATE TABLE t(c1 INTEGER, c2 INTEGER); 20 INSERT INTO t VALUES(5, 5); 21 INSERT INTO t VALUES(5, 4); 22 } 23 } {} 24 25 foreach {tn sql} { 26 1 "" 27 2 "CREATE INDEX i1 ON t(c1, c2)" 28 } { 29 30 execsql $sql 31 32 do_test tkt-f973c7ac3-1.$tn.1 { 33 execsql { 34 SELECT * FROM t WHERE c1 = 5 AND c2>0 AND c2<='2' ORDER BY c2 DESC 35 } 36 } {} 37 do_test tkt-f973c7ac3-1.$tn.2 { 38 execsql { 39 SELECT * FROM t WHERE c1 = 5 AND c2>0 AND c2<=5 ORDER BY c2 DESC 40 } 41 } {5 5 5 4} 42 do_test tkt-f973c7ac3-1.$tn.3 { 43 execsql { 44 SELECT * FROM t WHERE c1 = 5 AND c2>0 AND c2<='5' ORDER BY c2 DESC 45 } 46 } {5 5 5 4} 47 do_test tkt-f973c7ac3-1.$tn.4 { 48 execsql { 49 SELECT * FROM t WHERE c1 = 5 AND c2>'0' AND c2<=5 ORDER BY c2 DESC 50 } 51 } {5 5 5 4} 52 do_test tkt-f973c7ac3-1.$tn.5 { 53 execsql { 54 SELECT * FROM t WHERE c1 = 5 AND c2>'0' AND c2<='5' ORDER BY c2 DESC 55 } 56 } {5 5 5 4} 57 58 do_test tkt-f973c7ac3-1.$tn.6 { 59 execsql { 60 SELECT * FROM t WHERE c1 = 5 AND c2>0 AND c2<='2' ORDER BY c2 ASC 61 } 62 } {} 63 do_test tkt-f973c7ac3-1.$tn.7 { 64 execsql { 65 SELECT * FROM t WHERE c1 = 5 AND c2>0 AND c2<=5 ORDER BY c2 ASC 66 } 67 } {5 4 5 5} 68 do_test tkt-f973c7ac3-1.$tn.8 { 69 execsql { 70 SELECT * FROM t WHERE c1 = 5 AND c2>0 AND c2<='5' ORDER BY c2 ASC 71 } 72 } {5 4 5 5} 73 do_test tkt-f973c7ac3-1.$tn.9 { 74 execsql { 75 SELECT * FROM t WHERE c1 = 5 AND c2>'0' AND c2<=5 ORDER BY c2 ASC 76 } 77 } {5 4 5 5} 78 do_test tkt-f973c7ac3-1.$tn.10 { 79 execsql { 80 SELECT * FROM t WHERE c1 = 5 AND c2>'0' AND c2<='5' ORDER BY c2 ASC 81 } 82 } {5 4 5 5} 83 } 84 85 86 finish_test 87 88