diff options
author | dan miller | 2007-10-20 02:49:29 +0000 |
---|---|---|
committer | dan miller | 2007-10-20 02:49:29 +0000 |
commit | e36d23a85ebff914d74bb541558c2b6082b78edb (patch) | |
tree | 54b58fdf162e78af64055282a6035c8d2443389d /libraries/sqlite/unix/sqlite-3.5.1/test/incrblob_err.test | |
parent | * Fixed an issue whereby avatar chat distances were being calculated against ... (diff) | |
download | opensim-SC-e36d23a85ebff914d74bb541558c2b6082b78edb.zip opensim-SC-e36d23a85ebff914d74bb541558c2b6082b78edb.tar.gz opensim-SC-e36d23a85ebff914d74bb541558c2b6082b78edb.tar.bz2 opensim-SC-e36d23a85ebff914d74bb541558c2b6082b78edb.tar.xz |
sqlite source (unix build) added to libraries
Diffstat (limited to 'libraries/sqlite/unix/sqlite-3.5.1/test/incrblob_err.test')
-rw-r--r-- | libraries/sqlite/unix/sqlite-3.5.1/test/incrblob_err.test | 102 |
1 files changed, 102 insertions, 0 deletions
diff --git a/libraries/sqlite/unix/sqlite-3.5.1/test/incrblob_err.test b/libraries/sqlite/unix/sqlite-3.5.1/test/incrblob_err.test new file mode 100644 index 0000000..397b291 --- /dev/null +++ b/libraries/sqlite/unix/sqlite-3.5.1/test/incrblob_err.test | |||
@@ -0,0 +1,102 @@ | |||
1 | # 2007 May 1 | ||
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 | # $Id: incrblob_err.test,v 1.8 2007/09/12 17:01:45 danielk1977 Exp $ | ||
13 | # | ||
14 | |||
15 | set testdir [file dirname $argv0] | ||
16 | source $testdir/tester.tcl | ||
17 | |||
18 | ifcapable {!incrblob || !memdebug || !tclvar} { | ||
19 | finish_test | ||
20 | return | ||
21 | } | ||
22 | |||
23 | source $testdir/malloc_common.tcl | ||
24 | |||
25 | set ::fd [open [info script]] | ||
26 | set ::data [read $::fd] | ||
27 | close $::fd | ||
28 | |||
29 | do_malloc_test 1 -tclprep { | ||
30 | set bytes [file size [info script]] | ||
31 | execsql { | ||
32 | CREATE TABLE blobs(k, v BLOB); | ||
33 | INSERT INTO blobs VALUES(1, zeroblob($::bytes)); | ||
34 | } | ||
35 | } -tclbody { | ||
36 | set ::blob [db incrblob blobs v 1] | ||
37 | set rc [catch {puts -nonewline $::blob $::data}] | ||
38 | if {$rc} { error "out of memory" } | ||
39 | } | ||
40 | |||
41 | do_malloc_test 2 -tclprep { | ||
42 | execsql { | ||
43 | CREATE TABLE blobs(k, v BLOB); | ||
44 | INSERT INTO blobs VALUES(1, $::data); | ||
45 | } | ||
46 | } -tclbody { | ||
47 | set ::blob [db incrblob blobs v 1] | ||
48 | set rc [catch {set ::r [read $::blob]}] | ||
49 | if {$rc} { | ||
50 | error "out of memory" | ||
51 | } elseif {$::r ne $::data} { | ||
52 | error "Bad data read..." | ||
53 | } | ||
54 | } | ||
55 | |||
56 | do_malloc_test 3 -tclprep { | ||
57 | execsql { | ||
58 | CREATE TABLE blobs(k, v BLOB); | ||
59 | INSERT INTO blobs VALUES(1, $::data); | ||
60 | } | ||
61 | } -tclbody { | ||
62 | set ::blob [db incrblob blobs v 1] | ||
63 | set rc [catch {set ::r [read $::blob]}] | ||
64 | if {$rc} { | ||
65 | error "out of memory" | ||
66 | } elseif {$::r ne $::data} { | ||
67 | error "Bad data read..." | ||
68 | } | ||
69 | set rc [catch {close $::blob}] | ||
70 | if {$rc} { | ||
71 | error "out of memory" | ||
72 | } | ||
73 | } | ||
74 | |||
75 | do_ioerr_test incrblob_err-4 -cksum 1 -sqlprep { | ||
76 | CREATE TABLE blobs(k, v BLOB); | ||
77 | INSERT INTO blobs VALUES(1, $::data); | ||
78 | } -tclbody { | ||
79 | set ::blob [db incrblob blobs v 1] | ||
80 | read $::blob | ||
81 | } | ||
82 | |||
83 | do_ioerr_test incrblob_err-5 -cksum 1 -sqlprep { | ||
84 | CREATE TABLE blobs(k, v BLOB); | ||
85 | INSERT INTO blobs VALUES(1, zeroblob(length(CAST($::data AS BLOB)))); | ||
86 | } -tclbody { | ||
87 | set ::blob [db incrblob blobs v 1] | ||
88 | puts -nonewline $::blob $::data | ||
89 | close $::blob | ||
90 | } | ||
91 | |||
92 | do_ioerr_test incrblob_err-6 -cksum 1 -sqlprep { | ||
93 | CREATE TABLE blobs(k, v BLOB); | ||
94 | INSERT INTO blobs VALUES(1, $::data || $::data || $::data); | ||
95 | } -tclbody { | ||
96 | set ::blob [db incrblob blobs v 1] | ||
97 | seek $::blob -20 end | ||
98 | puts -nonewline $::blob "12345678900987654321" | ||
99 | close $::blob | ||
100 | } | ||
101 | |||
102 | finish_test | ||