1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/persistentdata/persistentstorage/sqlite3api/TEST/TclScript/tkt1667.test Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,83 @@
1.4 +# 2006 February 10
1.5 +#
1.6 +# The author disclaims copyright to this source code. In place of
1.7 +# a legal notice, here is a blessing:
1.8 +#
1.9 +# May you do good and not evil.
1.10 +# May you find forgiveness for yourself and forgive others.
1.11 +# May you share freely, never taking more than you give.
1.12 +#
1.13 +#***********************************************************************
1.14 +# This file implements regression tests for SQLite library.
1.15 +#
1.16 +# This file implements tests to verify that ticket #1667 has been
1.17 +# fixed.
1.18 +#
1.19 +#
1.20 +# $Id: tkt1667.test,v 1.3 2008/07/12 14:52:20 drh Exp $
1.21 +
1.22 +set testdir [file dirname $argv0]
1.23 +source $testdir/tester.tcl
1.24 +
1.25 +ifcapable !autovacuum||!tclvar {
1.26 + finish_test
1.27 + return
1.28 +}
1.29 +
1.30 +db close
1.31 +file delete -force test.db test.db-journal
1.32 +
1.33 +# Set the pending byte offset such that the page it is on is
1.34 +# the first autovacuum pointer map page in the file (assume a page
1.35 +# size of 1024).
1.36 +
1.37 +set first_ptrmap_page [expr 1024/5 + 3]
1.38 +set sqlite_pending_byte [expr 1024 * ($first_ptrmap_page-1)]
1.39 +
1.40 +sqlite db test.db
1.41 +
1.42 +do_test tkt1667-1 {
1.43 + execsql {
1.44 + PRAGMA auto_vacuum = 1;
1.45 + BEGIN;
1.46 + CREATE TABLE t1(a, b);
1.47 + }
1.48 + for {set i 0} {$i < 500} {incr i} {
1.49 + execsql {
1.50 + INSERT INTO t1 VALUES($i, randstr(1000, 2000))
1.51 + }
1.52 + }
1.53 + execsql {
1.54 + COMMIT;
1.55 + }
1.56 +} {}
1.57 +for {set i 0} {$i < 500} {incr i} {
1.58 + do_test tkt1667-2.$i.1 {
1.59 + execsql {
1.60 + DELETE FROM t1 WHERE a = $i;
1.61 + }
1.62 + } {}
1.63 + integrity_check tkt1667-2.$i.2
1.64 +}
1.65 +
1.66 +do_test tkt1667-3 {
1.67 + execsql {
1.68 + BEGIN;
1.69 + }
1.70 + for {set i 0} {$i < 500} {incr i} {
1.71 + execsql {
1.72 + INSERT INTO t1 VALUES($i, randstr(1000, 2000))
1.73 + }
1.74 + }
1.75 + execsql {
1.76 + COMMIT;
1.77 + }
1.78 +} {}
1.79 +do_test tkt1667-4.1 {
1.80 + execsql {
1.81 + DELETE FROM t1;
1.82 + }
1.83 +} {}
1.84 +integrity_check tkt1667-4.2
1.85 +
1.86 +finish_test