interplane.Get Omega
Read in your language

sqlite

[Ported from github.com/sqlite/sqlite] Fix bugs in and improve the interface to the ".check" command of the CLI.

Brought by drakestapleton

branch master Branches Tags History

sqlite / test / existsfault.test

49 lines · 1135 bytes Raw Blame History
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
13set testdir [file dirname $argv0]
14source $testdir/tester.tcl
15source $testdir/lock_common.tcl
16source $testdir/malloc_common.tcl
17set testprefix existsfault
18
19db close
20sqlite3_shutdown
21sqlite3_config_lookaside 0 0
22sqlite3_initialize
23autoinstall_test_functions
24sqlite3 db test.db
25
26do_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
36do_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
47finish_test
48
49