1# 2016 June 17 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 15set testdir [file dirname $argv0] 16source $testdir/tester.tcl 17source $testdir/malloc_common.tcl 18set ::testprefix rowvaluefault 19 20do_execsql_test 1.0 { 21 CREATE TABLE xyz(one, two, thr, fou); 22 INSERT INTO xyz VALUES('A', 'A', 'A', 1); 23 INSERT INTO xyz VALUES('B', 'B', 'B', 2); 24 INSERT INTO xyz VALUES('C', 'C', 'C', 3); 25 INSERT INTO xyz VALUES('D', 'D', 'D', 4); 26 27 CREATE UNIQUE INDEX xyz_one_two ON xyz(one, two); 28} 29 30do_faultsim_test 1 -faults oom* -body { 31 execsql { SELECT fou FROM xyz WHERE (one, two, thr) = ('B', 'B', 'B') } 32} -test { 33 faultsim_test_result {0 2} 34} 35 36do_faultsim_test 2 -faults oom* -body { 37 execsql { SELECT fou FROM xyz WHERE (two, thr) IS ('C', 'C') } 38} -test { 39 faultsim_test_result {0 3} 40} 41 42do_faultsim_test 3 -faults oom* -body { 43 execsql { SELECT fou FROM xyz WHERE (one, two, thr) > ('B', 'B', 'B') } 44} -test { 45 faultsim_test_result {0 {3 4}} 46} 47 48do_faultsim_test 4 -faults oom* -body { 49 execsql { SELECT fou FROM xyz WHERE (one, two) IN (SELECT one, two FROM xyz) } 50} -test { 51 faultsim_test_result {0 {1 2 3 4}} 52} 53 54do_faultsim_test 5 -faults oom* -body { 55 execsql { 56 SELECT fou FROM xyz 57 WHERE (one, two, thr) IN (SELECT one, two, thr FROM xyz) 58 } 59} -test { 60 faultsim_test_result {0 {1 2 3 4}} 61} 62 63do_faultsim_test 6 -faults oom* -body { 64 execsql { 65 SELECT fou FROM xyz 66 WHERE (one, two, thr) BETWEEN ('B', 'B', 'B') AND ('C', 'C', 'C') } 67} -test { 68 faultsim_test_result {0 {2 3}} 69} 70 71do_faultsim_test 7 -faults oom* -body { 72 execsql { 73 SELECT fou FROM xyz 74 WHERE (one, two, thr) IN ( ('a','b','c'), ('A','A','A'), (1,2,3) ); 75 } 76} -test { 77 faultsim_test_result {0 1} 78} 79 80do_faultsim_test 8 -faults oom* -body { 81 execsql { 82 SELECT fou FROM xyz 83 WHERE (two, one) IN ( ('a','b','c'), ('A','A','A'), (1,2,3) ); 84 } 85} -test { 86 faultsim_test_result {1 {IN(...) element has 3 terms - expected 2}} 87} 88 89finish_test 90