~ubuntu-branches/ubuntu/karmic/gears/karmic

« back to all changes in this revision

Viewing changes to third_party/sqlite_google/test/tkt1667.test

  • Committer: Bazaar Package Importer
  • Author(s): Stefan Lesicnik
  • Date: 2009-04-30 19:15:25 UTC
  • Revision ID: james.westby@ubuntu.com-20090430191525-0790sb5wzg8ou0xb
Tags: upstream-0.5.21.0~svn3334+dfsg
ImportĀ upstreamĀ versionĀ 0.5.21.0~svn3334+dfsg

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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.3 2008/07/12 14:52:20 drh 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