sqlite
[Ported from github.com/sqlite/sqlite] Fix bugs in and improve the interface to the ".check" command of the CLI.
Brought by drakestapleton
sqlite / test / filterfault.test
| 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 | |
| 14 | set testdir [file dirname $argv0] |
| 15 | source $testdir/tester.tcl |
| 16 | set testprefix filterfault |
| 17 | |
| 18 | ifcapable !windowfunc { |
| 19 | finish_test |
| 20 | return |
| 21 | } |
| 22 | |
| 23 | do_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 | } |
| 29 | faultsim_save_and_close |
| 30 | |
| 31 | do_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 | |
| 44 | finish_test |