2 #pragma ident "%Z%%M% %I% %E% SMI"
6 # The author disclaims copyright to this source code. In place of
7 # a legal notice, here is a blessing:
9 # May you do good and not evil.
10 # May you find forgiveness for yourself and forgive others.
11 # May you share freely, never taking more than you give.
13 #***********************************************************************
14 # This file implements regression tests for SQLite library. The
15 # focus of this script is btree database backend
17 # This file focuses on testing the sqliteBtreeNext() and
18 # sqliteBtreePrevious() procedures and making sure they are able
19 # to step through an entire table from either direction.
21 # $Id: btree4rb.test,v 1.1 2003/04/20 23:45:23 drh Exp $
24 set testdir [file dirname $argv0]
25 source $testdir/tester.tcl
27 if {[info commands btree_open]!=""} {
29 # Open a test database.
31 set b1 [btree_open :memory:]
32 btree_begin_transaction $::b1
34 set data {abcdefghijklmnopqrstuvwxyz0123456789}
40 foreach N {10 100 1000} {
41 btree_clear_table $::b1 2
42 set ::c1 [btree_cursor $::b1 2 1]
43 do_test btree4rb-$N.1 {
44 for {set i 1} {$i<=$N} {incr i} {
45 btree_insert $::c1 [format k-%05d $i] $::data-$i
50 do_test btree4rb-$N.2 {
53 for {set i 2} {$i<=$N} {incr i} {
54 do_test btree-$N.3.$i.1 {
57 do_test btree-$N.3.$i.2 {
60 do_test btree-$N.3.$i.3 {
64 do_test btree4rb-$N.4 {
67 do_test btree4rb-$N.5 {
70 do_test btree4rb-$N.6 {
73 do_test btree4rb-$N.7 {
76 for {set i [expr {$N-1}]} {$i>=1} {incr i -1} {
77 do_test btree4rb-$N.8.$i.1 {
80 do_test btree4rb-$N.8.$i.2 {
83 do_test btree4rb-$N.8.$i.3 {
87 do_test btree4rb-$N.9 {
90 btree_close_cursor $::c1
96 } ;# end if( not mem: and has pager_open command );