| OLD | NEW |
| 1 # 2007 May 02 | 1 # 2007 May 02 |
| 2 # | 2 # |
| 3 # The author disclaims copyright to this source code. In place of | 3 # The author disclaims copyright to this source code. In place of |
| 4 # a legal notice, here is a blessing: | 4 # a legal notice, here is a blessing: |
| 5 # | 5 # |
| 6 # May you do good and not evil. | 6 # May you do good and not evil. |
| 7 # May you find forgiveness for yourself and forgive others. | 7 # May you find forgiveness for yourself and forgive others. |
| 8 # May you share freely, never taking more than you give. | 8 # May you share freely, never taking more than you give. |
| 9 # | 9 # |
| 10 #*********************************************************************** | 10 #*********************************************************************** |
| 11 # This file implements regression tests for SQLite library. The | 11 # This file implements regression tests for SQLite library. The |
| 12 # focus of this file is testing that it is OK to create new tables | 12 # focus of this file is testing that it is OK to create new tables |
| 13 # and indices while creating existing tables and indices. | 13 # and indices while creating existing tables and indices. |
| 14 # | 14 # |
| 15 # $Id: createtab.test,v 1.3 2007/09/12 17:01:45 danielk1977 Exp $ | 15 # $Id: createtab.test,v 1.3 2007/09/12 17:01:45 danielk1977 Exp $ |
| 16 | 16 |
| 17 set testdir [file dirname $argv0] | 17 set testdir [file dirname $argv0] |
| 18 source $testdir/tester.tcl | 18 source $testdir/tester.tcl |
| 19 | 19 |
| 20 ifcapable autovacuum { | 20 ifcapable autovacuum { |
| 21 set upperBound 2 | 21 set upperBound 2 |
| 22 } else { | 22 } else { |
| 23 set upperBound 0 | 23 set upperBound 0 |
| 24 } | 24 } |
| 25 | 25 |
| 26 # Run these tests for all possible values of autovacuum. | 26 # Run these tests for all possible values of autovacuum. |
| 27 # | 27 # |
| 28 for {set av 0} {$av<=$upperBound} {incr av} { | 28 for {set av 0} {$av<=$upperBound} {incr av} { |
| 29 db close | 29 db close |
| 30 file delete -force test.db test.db-journal | 30 forcedelete test.db test.db-journal |
| 31 sqlite3 db test.db | 31 sqlite3 db test.db |
| 32 | 32 |
| 33 # Create a table that spans multiple pages. It is important | 33 # Create a table that spans multiple pages. It is important |
| 34 # that part of the database be in pages beyond the root page. | 34 # that part of the database be in pages beyond the root page. |
| 35 # | 35 # |
| 36 do_test createtab-$av.1 { | 36 do_test createtab-$av.1 { |
| 37 execsql "PRAGMA auto_vacuum=$av" | 37 execsql "PRAGMA auto_vacuum=$av" |
| 38 execsql { | 38 execsql { |
| 39 PRAGMA page_size=1024; | 39 PRAGMA page_size=1024; |
| 40 CREATE TABLE t1(x INTEGER PRIMARY KEY, y); | 40 CREATE TABLE t1(x INTEGER PRIMARY KEY, y); |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 137 do_test createtab-$av.32 { | 137 do_test createtab-$av.32 { |
| 138 execsql { | 138 execsql { |
| 139 SELECT name FROM sqlite_master WHERE type='table' ORDER BY 1 | 139 SELECT name FROM sqlite_master WHERE type='table' ORDER BY 1 |
| 140 } | 140 } |
| 141 } {t1 t2 t3 t4} | 141 } {t1 t2 t3 t4} |
| 142 integrity_check createtab-$av.40 | 142 integrity_check createtab-$av.40 |
| 143 | 143 |
| 144 } | 144 } |
| 145 | 145 |
| 146 finish_test | 146 finish_test |
| OLD | NEW |