xref: /sqlite-3.40.0/test/checkfault.test (revision 8b65e591)
1*8b65e591Sdan# 2019 July 17
2*8b65e591Sdan#
3*8b65e591Sdan# The author disclaims copyright to this source code.  In place of
4*8b65e591Sdan# a legal notice, here is a blessing:
5*8b65e591Sdan#
6*8b65e591Sdan#    May you do good and not evil.
7*8b65e591Sdan#    May you find forgiveness for yourself and forgive others.
8*8b65e591Sdan#    May you share freely, never taking more than you give.
9*8b65e591Sdan#
10*8b65e591Sdan#***********************************************************************
11*8b65e591Sdan#
12*8b65e591Sdan# This file contains fault-injection test cases for the
13*8b65e591Sdan# sqlite3_db_cacheflush API.
14*8b65e591Sdan#
15*8b65e591Sdan
16*8b65e591Sdanset testdir [file dirname $argv0]
17*8b65e591Sdansource $testdir/tester.tcl
18*8b65e591Sdanset testprefix cffault
19*8b65e591Sdansource $testdir/malloc_common.tcl
20*8b65e591Sdan
21*8b65e591Sdando_execsql_test 1.0 {
22*8b65e591Sdan  CREATE TABLE t1 (Col0 CHECK(1 COLLATE BINARY BETWEEN 1 AND 1) ) ;
23*8b65e591Sdan  CREATE TABLE t2(b, a CHECK(
24*8b65e591Sdan      CASE 'abc' COLLATE nocase WHEN a THEN 1 ELSE 0 END)
25*8b65e591Sdan  );
26*8b65e591Sdan}
27*8b65e591Sdan
28*8b65e591Sdando_faultsim_test 1.1 -faults oom* -body {
29*8b65e591Sdan  execsql { INSERT INTO t1 VALUES ('ABCDEFG') }
30*8b65e591Sdan} -test {
31*8b65e591Sdan  faultsim_test_result {0 {}}
32*8b65e591Sdan}
33*8b65e591Sdan
34*8b65e591Sdando_faultsim_test 1.2 -faults oom* -body {
35*8b65e591Sdan  execsql { INSERT INTO t2(a) VALUES('abc') }
36*8b65e591Sdan} -test {
37*8b65e591Sdan  faultsim_test_result {0 {}}
38*8b65e591Sdan}
39*8b65e591Sdan
40*8b65e591Sdan
41*8b65e591Sdanfinish_test
42