sqlite
[Ported from github.com/sqlite/sqlite] Fix bugs in and improve the interface to the ".check" command of the CLI.
Brought by drakestapleton
sqlite / test / exprfault.test
| 1 | # 2021 April 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 | set testdir [file dirname $argv0] |
| 15 | source $testdir/tester.tcl |
| 16 | set testprefix exprfault |
| 17 | |
| 18 | do_execsql_test 1.0 { |
| 19 | CREATE TABLE t1(a); |
| 20 | CREATE TABLE t2(d); |
| 21 | } |
| 22 | faultsim_save_and_close |
| 23 | |
| 24 | do_faultsim_test 1.1 -faults oom* -prep { |
| 25 | faultsim_restore_and_reopen |
| 26 | } -body { |
| 27 | execsql { |
| 28 | SELECT a = ( SELECT d FROM (SELECT d FROM t2) ) FROM t1 |
| 29 | } |
| 30 | } -test { |
| 31 | faultsim_test_result {0 {}} |
| 32 | } |
| 33 | |
| 34 | do_faultsim_test 2 -faults oom* -prep { |
| 35 | faultsim_restore_and_reopen |
| 36 | } -body { |
| 37 | execsql { |
| 38 | SELECT hex ( unhex('ABCDEF') ); |
| 39 | } |
| 40 | } -test { |
| 41 | faultsim_test_result {0 ABCDEF} |
| 42 | } |
| 43 | |
| 44 | #------------------------------------------------------------------------- |
| 45 | reset_db |
| 46 | do_execsql_test 3.0 { |
| 47 | PRAGMA page_size=1024; |
| 48 | CREATE TABLE t1(a INTEGER PRIMARY KEY, b); |
| 49 | CREATE INDEX i1 ON t1( hex(b) ); |
| 50 | INSERT INTO t1 VALUES(10, randomblob(500)); |
| 51 | } |
| 52 | faultsim_save_and_close |
| 53 | |
| 54 | do_faultsim_test 3 -faults oom* -prep { |
| 55 | faultsim_restore_and_reopen |
| 56 | } -body { |
| 57 | execsql { |
| 58 | UPDATE t1 SET b=randomblob(500); |
| 59 | } |
| 60 | } -test { |
| 61 | faultsim_test_result {0 {}} |
| 62 | } |
| 63 | |
| 64 | |
| 65 | |
| 66 | finish_test |