dan | 78f9bb6 | 2016-08-02 20:45:56 +0000 | [diff] [blame] | 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 | |
| 15 | set testdir [file dirname $argv0] |
| 16 | source $testdir/tester.tcl |
| 17 | source $testdir/malloc_common.tcl |
| 18 | set ::testprefix rowvaluefault |
| 19 | |
| 20 | do_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 | |
| 30 | do_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 | |
| 36 | do_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 | |
| 42 | do_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 | |
| 48 | do_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 | |
| 54 | do_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 | |
| 63 | do_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 | |
| 71 | finish_test |