gitlab.com/CoiaPrant/sqlite3@v1.19.1/testdata/tcl/shortread1.test (about)

     1  # 2007 Sep 13
     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  #
    12  # This file attempts to duplicate an error scenario seen on a
    13  # customer system using version 3.2.2.  The problem appears to
    14  # have been fixed (perhaps by accident) with check-in [3503].
    15  # These tests will prevent an accidental recurrance.
    16  #
    17  # $Id: shortread1.test,v 1.1 2007/09/14 01:48:12 drh Exp $
    18  #
    19  
    20  set testdir [file dirname $argv0]
    21  source $testdir/tester.tcl
    22  
    23  do_test shortread1-1.1 {
    24    execsql {
    25      CREATE TABLE t1(a TEXT);
    26      BEGIN;
    27      INSERT INTO t1 VALUES(hex(randomblob(5000)));
    28      INSERT INTO t1 VALUES(hex(randomblob(100)));
    29      PRAGMA freelist_count;
    30    }
    31  } {0}
    32  do_test shortread1-1.2 {
    33    execsql {
    34      DELETE FROM t1 WHERE rowid=1;
    35      PRAGMA freelist_count;
    36    }
    37  } {11}
    38  do_test shortread1-1.3 {
    39    sqlite3_release_memory [expr {1024*9}]
    40    execsql {
    41      INSERT INTO t1 VALUES(hex(randomblob(5000)));
    42      PRAGMA freelist_count;
    43    }
    44  } {0}
    45  do_test shortread1-1.4 {
    46    execsql {
    47      COMMIT;
    48      SELECT count(*) FROM t1;
    49    }
    50  } {2}
    51  
    52  finish_test