xref: /sqlite-3.40.0/test/filterfault.test (revision b0c4ef71)
1# 2018 May 8
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
14set testdir [file dirname $argv0]
15source $testdir/tester.tcl
16set testprefix filterfault
17
18ifcapable !windowfunc {
19  finish_test
20  return
21}
22
23do_execsql_test 1.0 {
24  CREATE TABLE t1(a, b, c, d);
25  INSERT INTO t1 VALUES(1, 2, 3, 4);
26  INSERT INTO t1 VALUES(5, 6, 7, 8);
27  INSERT INTO t1 VALUES(9, 10, 11, 12);
28}
29faultsim_save_and_close
30
31do_faultsim_test 1 -faults oom-t* -prep {
32  faultsim_restore_and_reopen
33} -body {
34  execsql {
35    SELECT sum(a) FILTER (WHERE b<5),
36           count() FILTER (WHERE d!=c)
37      FROM t1 GROUP BY c ORDER BY 1;
38  }
39} -test {
40  faultsim_test_result {0 {{} 1 {} 1 1 1}}
41}
42
43
44finish_test
45