File:  [ELWIX - Embedded LightWeight unIX -] / embedaddon / sqlite3 / test / shrink.test
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs - revision graph
Tue Feb 21 17:04:16 2012 UTC (12 years, 7 months ago) by misho
Branches: sqlite3, MAIN
CVS tags: v3_7_10, HEAD
sqlite3

    1: # 2011 November 16
    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 contains test cases for sqlite3_db_release_memory and
   13: # the PRAGMA shrink_memory statement.
   14: #
   15: 
   16: set testdir [file dirname $argv0]
   17: source $testdir/tester.tcl
   18: 
   19: unset -nocomplain baseline
   20: do_test shrink-1.1 {
   21:   db eval {
   22:     PRAGMA cache_size = 2000;
   23:     CREATE TABLE t1(x,y);
   24:     INSERT INTO t1 VALUES(randomblob(1000000),1);
   25:   }
   26:   set ::baseline sqlite3_memory_used
   27:   sqlite3_db_release_memory db
   28:   expr {$::baseline > [sqlite3_memory_used]+500000}
   29: } {1}
   30: do_test shrink-1.2 {
   31:   set baseline [sqlite3_memory_used]
   32:   db eval {
   33:     UPDATE t1 SET y=y+1;
   34:   }
   35:   expr {$::baseline+500000 < [sqlite3_memory_used]}
   36: } {1}
   37: do_test shrink-1.3 {
   38:   set baseline [sqlite3_memory_used]
   39:   db eval {PRAGMA shrink_memory}
   40:   expr {$::baseline > [sqlite3_memory_used]+500000}
   41: } {1}
   42: 
   43: finish_test

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>