diff options
Diffstat (limited to 'libraries/sqlite/unix/sqlite-3.5.1/test/tkt1667.test')
-rw-r--r-- | libraries/sqlite/unix/sqlite-3.5.1/test/tkt1667.test | 85 |
1 files changed, 85 insertions, 0 deletions
diff --git a/libraries/sqlite/unix/sqlite-3.5.1/test/tkt1667.test b/libraries/sqlite/unix/sqlite-3.5.1/test/tkt1667.test new file mode 100644 index 0000000..31b698c --- /dev/null +++ b/libraries/sqlite/unix/sqlite-3.5.1/test/tkt1667.test | |||
@@ -0,0 +1,85 @@ | |||
1 | # 2006 February 10 | ||
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. | ||
12 | # | ||
13 | # This file implements tests to verify that ticket #1667 has been | ||
14 | # fixed. | ||
15 | # | ||
16 | # | ||
17 | # $Id: tkt1667.test,v 1.2 2006/06/20 11:01:09 danielk1977 Exp $ | ||
18 | |||
19 | set testdir [file dirname $argv0] | ||
20 | source $testdir/tester.tcl | ||
21 | |||
22 | ifcapable !autovacuum||!tclvar { | ||
23 | finish_test | ||
24 | return | ||
25 | } | ||
26 | |||
27 | db close | ||
28 | file delete -force test.db test.db-journal | ||
29 | |||
30 | # Set the pending byte offset such that the page it is on is | ||
31 | # the first autovacuum pointer map page in the file (assume a page | ||
32 | # size of 1024). | ||
33 | |||
34 | set first_ptrmap_page [expr 1024/5 + 3] | ||
35 | set sqlite_pending_byte [expr 1024 * ($first_ptrmap_page-1)] | ||
36 | |||
37 | sqlite db test.db | ||
38 | |||
39 | do_test tkt1667-1 { | ||
40 | execsql { | ||
41 | PRAGMA auto_vacuum = 1; | ||
42 | BEGIN; | ||
43 | CREATE TABLE t1(a, b); | ||
44 | } | ||
45 | for {set i 0} {$i < 500} {incr i} { | ||
46 | execsql { | ||
47 | INSERT INTO t1 VALUES($i, randstr(1000, 2000)) | ||
48 | } | ||
49 | } | ||
50 | execsql { | ||
51 | COMMIT; | ||
52 | } | ||
53 | } {} | ||
54 | for {set i 0} {$i < 500} {incr i} { | ||
55 | do_test tkt1667-2.$i.1 { | ||
56 | execsql { | ||
57 | DELETE FROM t1 WHERE a = $i; | ||
58 | } | ||
59 | } {} | ||
60 | integrity_check tkt1667-2.$i.2 | ||
61 | } | ||
62 | |||
63 | do_test tkt1667-3 { | ||
64 | execsql { | ||
65 | BEGIN; | ||
66 | } | ||
67 | for {set i 0} {$i < 500} {incr i} { | ||
68 | execsql { | ||
69 | INSERT INTO t1 VALUES($i, randstr(1000, 2000)) | ||
70 | } | ||
71 | } | ||
72 | execsql { | ||
73 | COMMIT; | ||
74 | } | ||
75 | } {} | ||
76 | do_test tkt1667-4.1 { | ||
77 | execsql { | ||
78 | DELETE FROM t1; | ||
79 | } | ||
80 | } {} | ||
81 | integrity_check tkt1667-4.2 | ||
82 | |||
83 | finish_test | ||
84 | |||
85 | |||