xref: /sqlite-3.40.0/test/format4.test (revision 66c48907)
1e19d5940Sdrh# 2005 December 29
2e19d5940Sdrh#
3e19d5940Sdrh# The author disclaims copyright to this source code.  In place of
4e19d5940Sdrh# a legal notice, here is a blessing:
5e19d5940Sdrh#
6e19d5940Sdrh#    May you do good and not evil.
7e19d5940Sdrh#    May you find forgiveness for yourself and forgive others.
8e19d5940Sdrh#    May you share freely, never taking more than you give.
9e19d5940Sdrh#
10e19d5940Sdrh#***********************************************************************
11e19d5940Sdrh# This file implements regression tests for SQLite library.
12e19d5940Sdrh#
13e19d5940Sdrh# This file implements tests to verify that the new serial_type
14e19d5940Sdrh# values of 8 (integer 0) and 9 (integer 1) work correctly.
15e19d5940Sdrh#
16e19d5940Sdrh
17e19d5940Sdrhset testdir [file dirname $argv0]
18e19d5940Sdrhsource $testdir/tester.tcl
19e19d5940Sdrh
20*66c48907Sdrh#db eval {PRAGMA legacy_file_format=OFF}
21*66c48907Sdrhsqlite3_db_config db LEGACY_FILE_FORMAT 0
22ff91c454Sdrh
233765df48Sdrh# The size of the database depends on whether or not autovacuum
243765df48Sdrh# is enabled.
253765df48Sdrh#
26847d3ab4Sdrhifcapable autovacuum {
273765df48Sdrh  if {[db one {PRAGMA auto_vacuum}]} {
283765df48Sdrh    set small 3072
293765df48Sdrh    set large 5120
303765df48Sdrh  } else {
313765df48Sdrh    set small 2048
323765df48Sdrh    set large 4096
333765df48Sdrh  }
34847d3ab4Sdrh} else {
35847d3ab4Sdrh  set small 2048
36847d3ab4Sdrh  set large 4096
37847d3ab4Sdrh}
383765df48Sdrh
39e19d5940Sdrhdo_test format4-1.1 {
40e19d5940Sdrh  execsql {
41e19d5940Sdrh    CREATE TABLE t1(x0,x1,x2,x3,x4,x5,x6,x7,x8,x9);
42e19d5940Sdrh    INSERT INTO t1 VALUES(0,0,0,0,0,0,0,0,0,0);
43e19d5940Sdrh    INSERT INTO t1 SELECT * FROM t1;
44e19d5940Sdrh    INSERT INTO t1 SELECT * FROM t1;
45e19d5940Sdrh    INSERT INTO t1 SELECT * FROM t1;
46e19d5940Sdrh    INSERT INTO t1 SELECT * FROM t1;
47e19d5940Sdrh    INSERT INTO t1 SELECT * FROM t1;
48e19d5940Sdrh    INSERT INTO t1 SELECT * FROM t1;
49e19d5940Sdrh  }
50e19d5940Sdrh  file size test.db
513765df48Sdrh} $small
52e19d5940Sdrhdo_test format4-1.2 {
53e19d5940Sdrh  execsql {
54e19d5940Sdrh    UPDATE t1 SET x0=1, x1=1, x2=1, x3=1, x4=1, x5=1, x6=1, x7=1, x8=1, x9=1
55e19d5940Sdrh  }
56e19d5940Sdrh  file size test.db
573765df48Sdrh} $small
58e19d5940Sdrhdo_test format4-1.3 {
59e19d5940Sdrh  execsql {
60e19d5940Sdrh    UPDATE t1 SET x0=2, x1=2, x2=2, x3=2, x4=2, x5=2, x6=2, x7=2, x8=2, x9=2
61e19d5940Sdrh  }
62e19d5940Sdrh  file size test.db
633765df48Sdrh} $large
64e19d5940Sdrh
65e19d5940Sdrh
66e19d5940Sdrhfinish_test
67