os/persistentdata/persistentstorage/sqlite3api/TEST/TclScript/shortread1.test
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/persistentdata/persistentstorage/sqlite3api/TEST/TclScript/shortread1.test	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,52 @@
     1.4 +# 2007 Sep 13
     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 +#
    1.15 +# This file attempts to duplicate an error scenario seen on a
    1.16 +# customer system using version 3.2.2.  The problem appears to
    1.17 +# have been fixed (perhaps by accident) with check-in [3503].
    1.18 +# These tests will prevent an accidental recurrance.
    1.19 +#
    1.20 +# $Id: shortread1.test,v 1.1 2007/09/14 01:48:12 drh Exp $
    1.21 +#
    1.22 +
    1.23 +set testdir [file dirname $argv0]
    1.24 +source $testdir/tester.tcl
    1.25 +
    1.26 +do_test shortread1-1.1 {
    1.27 +  execsql {
    1.28 +    CREATE TABLE t1(a TEXT);
    1.29 +    BEGIN;
    1.30 +    INSERT INTO t1 VALUES(hex(randomblob(5000)));
    1.31 +    INSERT INTO t1 VALUES(hex(randomblob(100)));
    1.32 +    PRAGMA freelist_count;
    1.33 +  }
    1.34 +} {0}
    1.35 +do_test shortread1-1.2 {
    1.36 +  execsql {
    1.37 +    DELETE FROM t1 WHERE rowid=1;
    1.38 +    PRAGMA freelist_count;
    1.39 +  }
    1.40 +} {11}
    1.41 +do_test shortread1-1.3 {
    1.42 +  sqlite3_release_memory [expr {1024*9}]
    1.43 +  execsql {
    1.44 +    INSERT INTO t1 VALUES(hex(randomblob(5000)));
    1.45 +    PRAGMA freelist_count;
    1.46 +  }
    1.47 +} {0}
    1.48 +do_test shortread1-1.4 {
    1.49 +  execsql {
    1.50 +    COMMIT;
    1.51 +    SELECT count(*) FROM t1;
    1.52 +  }
    1.53 +} {2}
    1.54 +
    1.55 +finish_test