# 2010 June 15
#
# The author disclaims copyright to this source code.  In place of
# a legal notice, here is a blessing:
#
#    May you do good and not evil.
#    May you find forgiveness for yourself and forgive others.
#    May you share freely, never taking more than you give.
#
#***********************************************************************
#

set testdir [file dirname $argv0]
source $testdir/tester.tcl
source $testdir/malloc_common.tcl
set ::testprefix fault1

db close

proc open_test_db {} { 
  sqlite4 db test.db
  btenv testenv
  testenv attach db
  trace add command db delete del_testenv
}

proc del_testenv {args} { 
  testenv delete
}

do_faultsim_test 2.0 -prep {
  forcedelete test.db test.db-wal
  open_test_db
} -body {
  execsql {
    CREATE TABLE t1(x,y);
    INSERT INTO t1 VALUES('abc', 'def');
    SELECT * FROM t1;
  }
} -test {
  faultsim_test_result {0 {abc def}}
  db close
}

finish_test

