diff options
author | Hans-Christoph Steiner <hans@eds.org> | 2012-09-20 18:34:38 -0400 |
---|---|---|
committer | Hans-Christoph Steiner <hans@eds.org> | 2012-09-20 18:34:38 -0400 |
commit | 487e15dc239ccdb3344d1c99ce120e872bab4a74 (patch) | |
tree | c986d492f6092ca7b4401d91515f74daed17fae2 /test/shrink.test | |
parent | 7bb481fda9ecb134804b49c2ce77ca28f7eea583 (diff) |
Imported Upstream version 2.0.6
Diffstat (limited to 'test/shrink.test')
-rw-r--r-- | test/shrink.test | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/test/shrink.test b/test/shrink.test new file mode 100644 index 0000000..e03ebee --- /dev/null +++ b/test/shrink.test @@ -0,0 +1,43 @@ +# 2011 November 16 +# +# The author disclaims copyright to this source code. In place of +# a legal notice, here is a blessing: +# +# May you do good and not evil. +# May you find forgiveness for yourself and forgive others. +# May you share freely, never taking more than you give. +# +#*********************************************************************** +# +# This file contains test cases for sqlite3_db_release_memory and +# the PRAGMA shrink_memory statement. +# + +set testdir [file dirname $argv0] +source $testdir/tester.tcl + +unset -nocomplain baseline +do_test shrink-1.1 { + db eval { + PRAGMA cache_size = 2000; + CREATE TABLE t1(x,y); + INSERT INTO t1 VALUES(randomblob(1000000),1); + } + set ::baseline sqlite3_memory_used + sqlite3_db_release_memory db + expr {$::baseline > [sqlite3_memory_used]+500000} +} {1} +do_test shrink-1.2 { + set baseline [sqlite3_memory_used] + db eval { + UPDATE t1 SET y=y+1; + } + expr {$::baseline+500000 < [sqlite3_memory_used]} +} {1} +do_test shrink-1.3 { + set baseline [sqlite3_memory_used] + db eval {PRAGMA shrink_memory} + expr {$::baseline > [sqlite3_memory_used]+500000} +} {1} + +finish_test |