os/persistentdata/persistentstorage/sqlite3api/TEST/TclScript/format4.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/format4.test	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,65 @@
     1.4 +# 2005 December 29
     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 the new serial_type
    1.17 +# values of 8 (integer 0) and 9 (integer 1) work correctly.
    1.18 +#
    1.19 +
    1.20 +set testdir [file dirname $argv0]
    1.21 +source $testdir/tester.tcl
    1.22 +
    1.23 +db eval {PRAGMA legacy_file_format=OFF}
    1.24 +
    1.25 +# The size of the database depends on whether or not autovacuum
    1.26 +# is enabled.
    1.27 +#
    1.28 +ifcapable autovacuum {
    1.29 +  if {[db one {PRAGMA auto_vacuum}]} {
    1.30 +    set small 3072
    1.31 +    set large 5120
    1.32 +  } else {
    1.33 +    set small 2048
    1.34 +    set large 4096
    1.35 +  }
    1.36 +} else {
    1.37 +  set small 2048
    1.38 +  set large 4096
    1.39 +}
    1.40 +
    1.41 +do_test format4-1.1 {
    1.42 +  execsql {
    1.43 +    CREATE TABLE t1(x0,x1,x2,x3,x4,x5,x6,x7,x8,x9);
    1.44 +    INSERT INTO t1 VALUES(0,0,0,0,0,0,0,0,0,0);
    1.45 +    INSERT INTO t1 SELECT * FROM t1;
    1.46 +    INSERT INTO t1 SELECT * FROM t1;
    1.47 +    INSERT INTO t1 SELECT * FROM t1;
    1.48 +    INSERT INTO t1 SELECT * FROM t1;
    1.49 +    INSERT INTO t1 SELECT * FROM t1;
    1.50 +    INSERT INTO t1 SELECT * FROM t1;
    1.51 +  }
    1.52 +  file size test.db
    1.53 +} $small
    1.54 +do_test format4-1.2 {
    1.55 +  execsql {
    1.56 +    UPDATE t1 SET x0=1, x1=1, x2=1, x3=1, x4=1, x5=1, x6=1, x7=1, x8=1, x9=1
    1.57 +  }
    1.58 +  file size test.db
    1.59 +} $small
    1.60 +do_test format4-1.3 {
    1.61 +  execsql {
    1.62 +    UPDATE t1 SET x0=2, x1=2, x2=2, x3=2, x4=2, x5=2, x6=2, x7=2, x8=2, x9=2
    1.63 +  }
    1.64 +  file size test.db
    1.65 +} $large
    1.66 +
    1.67 +
    1.68 +finish_test