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/tkt2332.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/tkt2332.test')
-rw-r--r-- | libraries/sqlite/unix/sqlite-3.5.1/test/tkt2332.test | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/libraries/sqlite/unix/sqlite-3.5.1/test/tkt2332.test b/libraries/sqlite/unix/sqlite-3.5.1/test/tkt2332.test new file mode 100644 index 0000000..2d09dda --- /dev/null +++ b/libraries/sqlite/unix/sqlite-3.5.1/test/tkt2332.test | |||
@@ -0,0 +1,67 @@ | |||
1 | # 2007 May 3 | ||
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: tkt2332.test,v 1.4 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||!tclvar { | ||
19 | finish_test | ||
20 | return | ||
21 | } | ||
22 | |||
23 | do_test tkt2332.1 { | ||
24 | execsql { | ||
25 | CREATE TABLE blobs (k INTEGER PRIMARY KEY, v BLOB); | ||
26 | PRAGMA cache_size = 100; | ||
27 | } | ||
28 | } {} | ||
29 | |||
30 | set ::iKey 1 | ||
31 | foreach Len [list 10000 100000 1000000] { | ||
32 | do_test tkt2332.$Len.1 { | ||
33 | set val "[expr rand()][expr rand()][expr rand()][expr rand()][expr rand()]" | ||
34 | set ::blobstr [string range \ | ||
35 | [string repeat $val [expr ($Len/[string length $val])+1]] 0 [expr $Len-1] | ||
36 | ] | ||
37 | |||
38 | db eval { INSERT INTO blobs VALUES($::iKey, zeroblob($Len)) } | ||
39 | } {} | ||
40 | |||
41 | do_test tkt2332.$Len.2 { | ||
42 | execsql { | ||
43 | SELECT length(v) FROM blobs WHERE k = $::iKey; | ||
44 | } | ||
45 | } $Len | ||
46 | |||
47 | do_test tkt2332.$Len.3 { | ||
48 | set ::fd [db incrblob blobs v $::iKey] | ||
49 | puts -nonewline $::fd $::blobstr | ||
50 | close $::fd | ||
51 | } {} | ||
52 | |||
53 | do_test tkt2332.$Len.4 { | ||
54 | execsql { SELECT length(v) FROM blobs WHERE k = $::iKey; } | ||
55 | } $Len | ||
56 | |||
57 | do_test tkt2332.$Len.5 { | ||
58 | lindex [execsql {SELECT v FROM blobs WHERE k = $::iKey}] 0 | ||
59 | } $::blobstr | ||
60 | |||
61 | incr ::iKey | ||
62 | } | ||
63 | |||
64 | # Free memory: | ||
65 | unset ::blobstr | ||
66 | |||
67 | finish_test | ||