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