2N/A#pragma ident "%Z%%M% %I% %E% SMI"
2N/A# The author disclaims copyright to this source code. In place of
2N/A# a legal notice, here is a blessing:
2N/A# May you do good and not evil.
2N/A# May you find forgiveness for yourself and forgive others.
2N/A# May you share freely, never taking more than you give.
2N/A#***********************************************************************
2N/A# This file implements regression tests for SQLite library. The
2N/A# focus of this script is btree database backend
2N/A# This file focuses on testing the sqliteBtreeNext() and
2N/A# sqliteBtreePrevious() procedures and making sure they are able
2N/A# to step through an entire table from either direction.
2N/Aset testdir [file dirname $argv0]
2N/Aif {[info commands btree_open]!=""} {
2N/A# Open a test database.
2N/Aset b1 [btree_open :memory:]
2N/Abtree_begin_transaction $::b1
2N/Aset data {abcdefghijklmnopqrstuvwxyz0123456789}
2N/Aforeach N {10 100 1000} {
2N/A btree_clear_table $::b1 2
2N/A set ::c1 [btree_cursor $::b1 2 1]
2N/A do_test btree4rb-$N.1 {
2N/A for {set i 1} {$i<=$N} {incr i} {
2N/A btree_insert $::c1 [format k-%05d $i] $::data-$i
2N/A do_test btree4rb-$N.2 {
2N/A for {set i 2} {$i<=$N} {incr i} {
2N/A do_test btree-$N.3.$i.1 {
2N/A do_test btree-$N.3.$i.2 {
2N/A } [format k-%05d $i]
2N/A do_test btree-$N.3.$i.3 {
2N/A do_test btree4rb-$N.4 {
2N/A do_test btree4rb-$N.5 {
2N/A do_test btree4rb-$N.6 {
2N/A } [format k-%05d $N]
2N/A do_test btree4rb-$N.7 {
2N/A for {set i [expr {$N-1}]} {$i>=1} {incr i -1} {
2N/A do_test btree4rb-$N.8.$i.1 {
2N/A do_test btree4rb-$N.8.$i.2 {
2N/A } [format k-%05d $i]
2N/A do_test btree4rb-$N.8.$i.3 {
2N/A do_test btree4rb-$N.9 {
2N/A btree_close_cursor $::c1
2N/A} ;# end if( not mem: and has pager_open command );