Debian Codegraph @

test/existsfault.test

raw
1 # 2024 May 25
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 #
12
13 set testdir [file dirname $argv0]
14 source $testdir/tester.tcl
15 source $testdir/lock_common.tcl
16 source $testdir/malloc_common.tcl
17 set testprefix existsfault
18
19 db close
20 sqlite3_shutdown
21 sqlite3_config_lookaside 0 0
22 sqlite3_initialize
23 autoinstall_test_functions
24 sqlite3 db test.db
25
26 do_execsql_test 1.0 {
27 CREATE TABLE x1(a, b);
28 INSERT INTO x1 VALUES(1, 2), (3, 4), (5, 6);
29 CREATE UNIQUE INDEX x1a ON x1(a);
30 CREATE INDEX x1b ON x1(b);
31
32 CREATE TABLE x2(x, y);
33 INSERT INTO x2 VALUES(1, 2), (3, 4), (5, 6);
34 }
35
36 do_faultsim_test 1 -faults oom* -prep {
37 sqlite3 db test.db
38 execsql { SELECT * FROM sqlite_schema }
39 } -body {
40 execsql {
41 SELECT count(*) FROM x2 WHERE EXISTS (SELECT 1 FROM x1 WHERE a=x) AND y!=11
42 }
43 } -test {
44 faultsim_test_result {0 3}
45 }
46
47 finish_test
48
49