Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Add more tests for the in-memory database. (CVS 925) |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
11cab41c4f02cdddc4fd3f57555573ac |
User & Date: | drh 2003-04-20 23:45:23.000 |
Context
2003-04-21
| ||
18:48 | Add support for TEMPORARY triggers. Such triggers can write temporary or permanent tables. (CVS 926) (check-in: 58ddd587b0 user: drh tags: trunk) | |
2003-04-20
| ||
23:45 | Add more tests for the in-memory database. (CVS 925) (check-in: 11cab41c4f user: drh tags: trunk) | |
17:29 | Added tests for the in-memory database backend. Also updated some comments in other modules. (CVS 924) (check-in: fb89adf4d1 user: drh tags: trunk) | |
Changes
Added test/btree3rb.test.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 | # 2001 November 22 # # The author disclaims copyright to this source code. In place of # a legal notice, here is a blessing: # # May you do good and not evil. # May you find forgiveness for yourself and forgive others. # May you share freely, never taking more than you give. # #*********************************************************************** # This file implements regression tests for SQLite library. The # focus of this script is btree database backend # # In particular, this file tests a small part of the Delete logic # for the BTree backend. When a row is deleted from a table, the # cursor is suppose to be left pointing at either the previous or # next entry in that table. If the cursor is left pointing at the # next entry, then the next Next operation is ignored. So the # sequence of operations (Delete, Next) should always leave the # cursor pointing at the first entry past the one that was deleted. # This test is designed to verify that behavior. # # $Id: btree3rb.test,v 1.1 2003/04/20 23:45:23 drh Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl if {[info commands btree_open]!=""} { # Open a test database. # set b1 [btree_open :memory:] btree_begin_transaction $::b1 # Insert a few one records # set data {abcdefghijklmnopqrstuvwxyz0123456789} append data $data append data $data append data $data append data $data for {set k 2} {$k<=20} {incr k} { for {set j 1} {$j<=$k} {incr j} { set jkey [format %02d $j] btree_clear_table $::b1 2 set ::c1 [btree_cursor $::b1 2 1] for {set i 1} {$i<=$k} {incr i} { set key [format %02d $i] do_test btree3rb-$k.$j.1.$i { btree_insert $::c1 $::key $::data } {} # btree_tree_dump $::b1 2 } do_test btree3rb-$k.$j.2 { btree_move_to $::c1 $::jkey btree_key $::c1 } $::jkey do_test btree3rb-$k.$j.3 { btree_delete $::c1 } {} if {$j<$k} { do_test btree3rb-$k.$j.4 { btree_next $::c1 btree_key $::c1 } [format %02d [expr $j+1]] } if {$j>1} { do_test btree3rb-$k.$j.5 { btree_prev $::c1 btree_key $::c1 } [format %02d [expr $j-1]] } btree_close_cursor $::c1 } } btree_rollback $::b1 #btree_pager_ref_dump $::b1 btree_close $::b1 } ;# end if( not mem: and has pager_open command ); finish_test |
Added test/btree4rb.test.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 | # 2002 December 03 # # The author disclaims copyright to this source code. In place of # a legal notice, here is a blessing: # # May you do good and not evil. # May you find forgiveness for yourself and forgive others. # May you share freely, never taking more than you give. # #*********************************************************************** # This file implements regression tests for SQLite library. The # focus of this script is btree database backend # # This file focuses on testing the sqliteBtreeNext() and # sqliteBtreePrevious() procedures and making sure they are able # to step through an entire table from either direction. # # $Id: btree4rb.test,v 1.1 2003/04/20 23:45:23 drh Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl if {[info commands btree_open]!=""} { # Open a test database. # set b1 [btree_open :memory:] btree_begin_transaction $::b1 set data {abcdefghijklmnopqrstuvwxyz0123456789} append data $data append data $data append data $data append data $data foreach N {10 100 1000} { btree_clear_table $::b1 2 set ::c1 [btree_cursor $::b1 2 1] do_test btree4rb-$N.1 { for {set i 1} {$i<=$N} {incr i} { btree_insert $::c1 [format k-%05d $i] $::data-$i } btree_first $::c1 btree_key $::c1 } {k-00001} do_test btree4rb-$N.2 { btree_data $::c1 } $::data-1 for {set i 2} {$i<=$N} {incr i} { do_test btree-$N.3.$i.1 { btree_next $::c1 } 0 do_test btree-$N.3.$i.2 { btree_key $::c1 } [format k-%05d $i] do_test btree-$N.3.$i.3 { btree_data $::c1 } $::data-$i } do_test btree4rb-$N.4 { btree_next $::c1 } 1 do_test btree4rb-$N.5 { btree_last $::c1 } 0 do_test btree4rb-$N.6 { btree_key $::c1 } [format k-%05d $N] do_test btree4rb-$N.7 { btree_data $::c1 } $::data-$N for {set i [expr {$N-1}]} {$i>=1} {incr i -1} { do_test btree4rb-$N.8.$i.1 { btree_prev $::c1 } 0 do_test btree4rb-$N.8.$i.2 { btree_key $::c1 } [format k-%05d $i] do_test btree4rb-$N.8.$i.3 { btree_data $::c1 } $::data-$i } do_test btree4rb-$N.9 { btree_prev $::c1 } 1 btree_close_cursor $::c1 } btree_rollback $::b1 btree_close $::b1 } ;# end if( not mem: and has pager_open command ); finish_test |
Changes to test/memdb.test.
1 2 3 4 5 6 7 8 9 10 11 12 13 | # 2001 September 15 # # The author disclaims copyright to this source code. In place of # a legal notice, here is a blessing: # # May you do good and not evil. # May you find forgiveness for yourself and forgive others. # May you share freely, never taking more than you give. # #*********************************************************************** # This file implements regression tests for SQLite library. The # focus of this script is in-memory database backend. # | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | # 2001 September 15 # # The author disclaims copyright to this source code. In place of # a legal notice, here is a blessing: # # May you do good and not evil. # May you find forgiveness for yourself and forgive others. # May you share freely, never taking more than you give. # #*********************************************************************** # This file implements regression tests for SQLite library. The # focus of this script is in-memory database backend. # # $Id: memdb.test,v 1.2 2003/04/20 23:45:23 drh Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl # In the following sequence of tests, compute the MD5 sum of the content # of a table, make lots of modifications to that table, then do a rollback. |
︙ | ︙ | |||
351 352 353 354 355 356 357 | do_test memdb-6.15 { execsql { DELETE FROM t5 WHERE x>0; SELECT * FROM t5; } } {} | | | > > > > > > > > > > > | > > > > > > > | | 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 | do_test memdb-6.15 { execsql { DELETE FROM t5 WHERE x>0; SELECT * FROM t5; } } {} do_test memdb-7.1 { execsql { CREATE TABLE t6(x); INSERT INTO t6 VALUES(1); INSERT INTO t6 SELECT x+1 FROM t6; INSERT INTO t6 SELECT x+2 FROM t6; INSERT INTO t6 SELECT x+4 FROM t6; INSERT INTO t6 SELECT x+8 FROM t6; INSERT INTO t6 SELECT x+16 FROM t6; INSERT INTO t6 SELECT x+32 FROM t6; INSERT INTO t6 SELECT x+64 FROM t6; INSERT INTO t6 SELECT x+128 FROM t6; SELECT count(*) FROM (SELECT DISTINCT x FROM t6); } } {256} for {set i 1} {$i<=256} {incr i} { do_test memdb-7.2.$i { execsql "DELETE FROM t6 WHERE x=\ (SELECT x FROM t6 ORDER BY random() LIMIT 1)" execsql {SELECT count(*) FROM t6} } [expr {256-$i}] } finish_test |