xref: /sqlite-3.40.0/test/filterfault.test (revision 00885742)
1*00885742Sdan# 2018 May 8
2*00885742Sdan#
3*00885742Sdan# The author disclaims copyright to this source code.  In place of
4*00885742Sdan# a legal notice, here is a blessing:
5*00885742Sdan#
6*00885742Sdan#    May you do good and not evil.
7*00885742Sdan#    May you find forgiveness for yourself and forgive others.
8*00885742Sdan#    May you share freely, never taking more than you give.
9*00885742Sdan#
10*00885742Sdan#***********************************************************************
11*00885742Sdan# This file implements regression tests for SQLite library.
12*00885742Sdan#
13*00885742Sdan
14*00885742Sdanset testdir [file dirname $argv0]
15*00885742Sdansource $testdir/tester.tcl
16*00885742Sdanset testprefix filterfault
17*00885742Sdan
18*00885742Sdanifcapable !windowfunc {
19*00885742Sdan  finish_test
20*00885742Sdan  return
21*00885742Sdan}
22*00885742Sdan
23*00885742Sdando_execsql_test 1.0 {
24*00885742Sdan  CREATE TABLE t1(a, b, c, d);
25*00885742Sdan  INSERT INTO t1 VALUES(1, 2, 3, 4);
26*00885742Sdan  INSERT INTO t1 VALUES(5, 6, 7, 8);
27*00885742Sdan  INSERT INTO t1 VALUES(9, 10, 11, 12);
28*00885742Sdan}
29*00885742Sdanfaultsim_save_and_close
30*00885742Sdan
31*00885742Sdando_faultsim_test 1 -faults oom-t* -prep {
32*00885742Sdan  faultsim_restore_and_reopen
33*00885742Sdan} -body {
34*00885742Sdan  execsql {
35*00885742Sdan    SELECT sum(a) FILTER (WHERE b<5),
36*00885742Sdan           count() FILTER (WHERE d!=c)
37*00885742Sdan      FROM t1 GROUP BY c ORDER BY 1;
38*00885742Sdan  }
39*00885742Sdan} -test {
40*00885742Sdan  faultsim_test_result {0 {{} 1 {} 1 1 1}}
41*00885742Sdan}
42*00885742Sdan
43*00885742Sdan
44*00885742Sdanfinish_test
45