| 1 |
# 2013 November 22 |
| 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 |
# This file implements regression tests for SQLite library. The |
| 12 |
# focus of this script is the Win32 heap implementation. |
| 13 |
# |
| 14 |
|
| 15 |
if {$tcl_platform(platform) ne "windows"} return |
| 16 |
|
| 17 |
set testdir [file dirname $argv0] |
| 18 |
source $testdir/tester.tcl |
| 19 |
|
| 20 |
ifcapable !win32malloc { |
| 21 |
finish_test |
| 22 |
return |
| 23 |
} |
| 24 |
|
| 25 |
set testprefix win32heap |
| 26 |
|
| 27 |
do_test 1.1 { |
| 28 |
catch {db close} |
| 29 |
sqlite3_shutdown |
| 30 |
sqlite3_config_heap_size 1048576 |
| 31 |
sqlite3_initialize |
| 32 |
} {SQLITE_OK} |
| 33 |
|
| 34 |
do_test 1.2 { |
| 35 |
sqlite3 db test.db |
| 36 |
catchsql { |
| 37 |
CREATE TABLE t1(x); |
| 38 |
} |
| 39 |
} {0 {}} |
| 40 |
|
| 41 |
do_test 1.3 { |
| 42 |
catchsql { |
| 43 |
INSERT INTO t1 (x) VALUES(RANDOMBLOB(1048576)); |
| 44 |
} |
| 45 |
} {1 {out of memory}} |
| 46 |
|
| 47 |
do_test 1.4 { |
| 48 |
catchsql { |
| 49 |
SELECT COUNT(*) FROM t1; |
| 50 |
} |
| 51 |
} {0 0} |
| 52 |
|
| 53 |
do_test 1.5 { |
| 54 |
catch {db close} |
| 55 |
sqlite3_shutdown |
| 56 |
sqlite3_config_heap_size 0 |
| 57 |
sqlite3_initialize |
| 58 |
} {SQLITE_OK} |
| 59 |
|
| 60 |
do_test 1.6 { |
| 61 |
sqlite3 db test.db |
| 62 |
catchsql { |
| 63 |
INSERT INTO t1 (x) VALUES(RANDOMBLOB(1048576)); |
| 64 |
} |
| 65 |
} {0 {}} |
| 66 |
|
| 67 |
do_test 1.7 { |
| 68 |
catchsql { |
| 69 |
SELECT COUNT(*) FROM t1; |
| 70 |
} |
| 71 |
} {0 1} |
| 72 |
|
| 73 |
finish_test |