The first assert() added in [0ebc65481f4a3e79] is not necessarily true in a
[sqlite.git] / test / mem5.test
blob6365f1c64b290da445b3f5cb08bf785decfa7921
1 # 2011 March 9
3 # The author disclaims copyright to this source code.  In place of
4 # a legal notice, here is a blessing:
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.
10 #***********************************************************************
12 # This file contains tests of the mem5 allocation subsystem.
15 set testdir [file dirname $argv0]
16 source $testdir/tester.tcl
18 ifcapable !mem5 {
19   finish_test
20   return
23 # The tests in this file configure the lookaside allocator after a 
24 # connection is opened. This will not work if there is any "presql"
25 # configured (SQL run within the [sqlite3] wrapper in tester.tcl).
26 if {[info exists ::G(perm:presql)]} {
27   finish_test
28   return
31 do_test mem5-1.1 {
32   catch {db close}
33   sqlite3_shutdown
34   sqlite3_config_heap 25000000 0
35   sqlite3_config_lookaside 0 0
36   sqlite3_initialize
37 } {SQLITE_OK}
39 # try with min request size = 2^30
40 do_test mem5-1.2 {
41   catch {db close}
42   sqlite3_shutdown
43   sqlite3_config_heap 1 1073741824
44   sqlite3_config_lookaside 0 0
45   sqlite3_initialize
46 } {SQLITE_NOMEM}
48 # try with min request size = 2^30+1
49 # previously this was causing the memsys5Log() func to infinitely loop.
50 do_test mem5-1.3 {
51   catch {db close}
52   sqlite3_shutdown
53   sqlite3_config_heap 1 1073741825
54   sqlite3_config_lookaside 0 0
55   sqlite3_initialize
56 } {SQLITE_NOMEM}
58 do_test mem5-1.4 {
59   catch {db close}
60   sqlite3_shutdown
61   sqlite3_config_heap 0 0
62   sqlite3_config_lookaside 0 0
63   sqlite3_initialize
64 } {SQLITE_OK}
66 finish_test