Have the intck extension better handle corruption at the b-tree layer.
[sqlite.git] / ext / intck / intck_common.tcl
blobf00a465b3c8cb7559daa7d35e76ff85f1fe7b137
1 # 2024 Feb 18
3 # The author disclaims copyright to this source code. In place of
4 # a legal notice, here is a blessing:
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.
10 #***********************************************************************
13 if {![info exists testdir]} {
14 set testdir [file join [file dirname [info script]] .. .. test]
16 source $testdir/tester.tcl
18 proc do_intck {db {bSuspend 0}} {
19 set ic [sqlite3_intck $db main]
21 set ret [list]
22 while {"SQLITE_OK"==[$ic step]} {
23 set msg [$ic message]
24 if {$msg!=""} {
25 lappend ret $msg
27 if {$bSuspend} { $ic suspend }
30 set err [$ic error]
31 if {[lindex $err 0]!="SQLITE_OK"} {
32 error $err
34 $ic close
36 return $ret
39 proc intck_sql {db tbl} {
40 set ic [sqlite3_intck $db main]
41 set sql [$ic test_sql $tbl]
42 $ic close
43 return $sql
46 proc do_intck_test {tn expect} {
47 uplevel [list do_test $tn.a [list do_intck db] [list {*}$expect]]
48 uplevel [list do_test $tn.b [list do_intck db 1] [list {*}$expect]]