Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Add tests for ticket [448d663d11]. Further refinements to unit testing infrastructure. |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
11f11f0c83ffaeb15860d89ca9029cf0 |
User & Date: | mistachkin 2011-07-05 04:40:13.366 |
Context
2011-07-05
| ||
06:07 | Fix for [448d663d11], with tests. Also fixes [2a0c90d7b0]. See also [08f3d3daf2]. check-in: 50b4844f0c user: mistachkin tags: trunk | |
04:40 | Add tests for ticket [448d663d11]. Further refinements to unit testing infrastructure. check-in: 11f11f0c83 user: mistachkin tags: trunk | |
01:03 | Update hashes for non-bundled downloads. check-in: 8dbc95c446 user: mistachkin tags: trunk | |
Changes
Changes to Tests/all.eagle.
︙ | ︙ | |||
13 14 15 16 17 18 19 20 21 22 23 24 25 26 | # ############################################################################### package require EagleLibrary package require EagleTest runTestPrologue ############################################################################### set no(prologue.eagle) true set no(epilogue.eagle) true # | > > > > > > > > > > | 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | # ############################################################################### package require EagleLibrary package require EagleTest runTestPrologue ############################################################################### # # NOTE: Pre-load the assembly and the necessary helper procedures now, so that # they do not count as being "leaked" (i.e. the test framework has no way # to know who procedures actually belong to). # source [file join $path common.eagle] loadAssembly System.Data.SQLite.dll ############################################################################### set no(prologue.eagle) true set no(epilogue.eagle) true # |
︙ | ︙ |
Changes to Tests/basic.eagle.
︙ | ︙ | |||
16 17 18 19 20 21 22 | source [file join $path common.eagle] loadAssembly System.Data.SQLite.dll ############################################################################### runTest {test basic-1.1 {SELECT scalar/reader, CREATE, INSERT} -setup { | | | 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | source [file join $path common.eagle] loadAssembly System.Data.SQLite.dll ############################################################################### runTest {test basic-1.1 {SELECT scalar/reader, CREATE, INSERT} -setup { setupDb [set fileName basic-1.1.db] } -body { set result [list] lappend result [sql execute -execute scalar $db \ "SELECT sqlite_source_id();"] sql execute $db "CREATE TABLE t1(x INTEGER PRIMARY KEY ASC, y, z);" |
︙ | ︙ |
Changes to Tests/common.eagle.
︙ | ︙ | |||
15 16 17 18 19 20 21 | if {[catch {set assembly \ [object load -loadtype File $fileName]}] == 0} then { # # NOTE: Now, add the necessary test constraint. # addConstraint [file rootname [file tail $fileName]] | | > > > > | | > > > | > > > > > > > | | | 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 | if {[catch {set assembly \ [object load -loadtype File $fileName]}] == 0} then { # # NOTE: Now, add the necessary test constraint. # addConstraint [file rootname [file tail $fileName]] # # NOTE: Return the full path of the loaded file. # return $fileName } return "" } proc setupDb {fileName {mode ""} {varName db}} { set fileName [file join [getTemporaryPath] $fileName] catch {file delete $fileName} upvar 1 $varName db set connection {Data Source=${fileName}} if {[string length $mode] > 0} then { append connection {;Journal Mode=${mode}} } set db [sql open -type SQLite [subst $connection]] } proc cleanupDb {fileName {varName db}} { upvar 1 $varName db catch {sql close $db} catch {file delete [file join [getTemporaryPath] $fileName]} } } |
Added Tests/nonWal.db.
cannot compute difference between binary files
Changes to Tests/tkt-2c630bffa7.eagle.
︙ | ︙ | |||
20 21 22 23 24 25 26 | ############################################################################### set y [list -1.79769e308 -3.40282e038 -1 0 1 3.40282e038 1.79769e308] ############################################################################### runTest {test tkt-2c630bffa7-1.1 {range of REAL type} -setup { | | | 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | ############################################################################### set y [list -1.79769e308 -3.40282e038 -1 0 1 3.40282e038 1.79769e308] ############################################################################### runTest {test tkt-2c630bffa7-1.1 {range of REAL type} -setup { setupDb [set fileName tkt-2c630bffa7-1.1.db] } -body { sql execute $db "CREATE TABLE t1(x INTEGER, y REAL);" for {set x 0} {$x < [llength $y]} {incr x} { sql execute $db \ "INSERT INTO t1 (x, y) VALUES($x, [lindex $y $x]);" } |
︙ | ︙ | |||
42 43 44 45 46 47 48 | } -constraints \ {eagle monoBug28 command.sql compile.DATA System.Data.SQLite} -result \ {0 -1.79769E+308 1 -3.40282E+38 2 -1 3 0 4 1 5 3.40282E+38 6 1.79769E+308}} ############################################################################### runTest {test tkt-2c630bffa7-1.2 {range of FLOAT type} -setup { | | | 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 | } -constraints \ {eagle monoBug28 command.sql compile.DATA System.Data.SQLite} -result \ {0 -1.79769E+308 1 -3.40282E+38 2 -1 3 0 4 1 5 3.40282E+38 6 1.79769E+308}} ############################################################################### runTest {test tkt-2c630bffa7-1.2 {range of FLOAT type} -setup { setupDb [set fileName tkt-2c630bffa7-1.2.db] } -body { sql execute $db "CREATE TABLE t2(x INTEGER, y FLOAT);" for {set x 0} {$x < [llength $y]} {incr x} { sql execute $db \ "INSERT INTO t2 (x, y) VALUES($x, [lindex $y $x]);" } |
︙ | ︙ | |||
64 65 66 67 68 69 70 | } -constraints \ {eagle monoBug28 command.sql compile.DATA System.Data.SQLite} -result \ {0 -1.79769E+308 1 -3.40282E+38 2 -1 3 0 4 1 5 3.40282E+38 6 1.79769E+308}} ############################################################################### runTest {test tkt-2c630bffa7-1.3 {range of DOUBLE type} -setup { | | | 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 | } -constraints \ {eagle monoBug28 command.sql compile.DATA System.Data.SQLite} -result \ {0 -1.79769E+308 1 -3.40282E+38 2 -1 3 0 4 1 5 3.40282E+38 6 1.79769E+308}} ############################################################################### runTest {test tkt-2c630bffa7-1.3 {range of DOUBLE type} -setup { setupDb [set fileName tkt-2c630bffa7-1.3.db] } -body { sql execute $db "CREATE TABLE t3(x INTEGER, y DOUBLE);" for {set x 0} {$x < [llength $y]} {incr x} { sql execute $db \ "INSERT INTO t3 (x, y) VALUES($x, [lindex $y $x]);" } |
︙ | ︙ |
Added Tests/tkt-448d663d11.eagle.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 | ############################################################################### # # tkt-448d663d11.eagle -- # # Written by Joe Mistachkin. # Released to the public domain, use at your own risk! # ############################################################################### package require EagleLibrary package require EagleTest runTestPrologue ############################################################################### source [file join $path common.eagle] loadAssembly System.Data.SQLite.dll ############################################################################### runTest {test tkt-448d663d11-1.1 {'Default' journal mode, new db} -body { setupDb [set fileName tkt-448d663d11-1.1.db] Default sql execute -execute scalar $db "PRAGMA journal_mode;" } -cleanup { cleanupDb $fileName unset -nocomplain db fileName } -constraints \ {eagle monoBug28 command.sql compile.DATA System.Data.SQLite} -result {delete}} ############################################################################### runTest {test tkt-448d663d11-1.2 {'Default' journal mode, WAL db} -body { set fileName tkt-448d663d11-1.2.db file copy -force [file join $path wal.db] \ [file join [getTemporaryPath] $fileName] setupDb $fileName Default sql execute -execute scalar $db "PRAGMA journal_mode;" } -cleanup { cleanupDb $fileName unset -nocomplain db fileName } -constraints \ {eagle monoBug28 command.sql compile.DATA System.Data.SQLite} -result {wal}} ############################################################################### runTest {test tkt-448d663d11-1.3 {'Default' journal mode, non-WAL db} -body { set fileName tkt-448d663d11-1.3.db file copy -force [file join $path nonWal.db] \ [file join [getTemporaryPath] $fileName] setupDb $fileName Default sql execute -execute scalar $db "PRAGMA journal_mode;" } -cleanup { cleanupDb $fileName unset -nocomplain db fileName } -constraints \ {eagle monoBug28 command.sql compile.DATA System.Data.SQLite} -result {delete}} ############################################################################### runTest {test tkt-448d663d11-1.4 {'Delete' journal mode, new db} -body { setupDb [set fileName tkt-448d663d11-1.4.db] Delete sql execute -execute scalar $db "PRAGMA journal_mode;" } -cleanup { cleanupDb $fileName unset -nocomplain db fileName } -constraints \ {eagle monoBug28 command.sql compile.DATA System.Data.SQLite} -result {delete}} ############################################################################### runTest {test tkt-448d663d11-1.5 {'Delete' journal mode, WAL db} -body { set fileName tkt-448d663d11-1.5.db file copy -force [file join $path wal.db] \ [file join [getTemporaryPath] $fileName] setupDb $fileName Delete sql execute -execute scalar $db "PRAGMA journal_mode;" } -cleanup { cleanupDb $fileName unset -nocomplain db fileName } -constraints \ {eagle monoBug28 command.sql compile.DATA System.Data.SQLite} -result {delete}} ############################################################################### runTest {test tkt-448d663d11-1.6 {'Delete' journal mode, non-WAL db} -body { set fileName tkt-448d663d11-1.6.db file copy -force [file join $path nonWal.db] \ [file join [getTemporaryPath] $fileName] setupDb $fileName Delete sql execute -execute scalar $db "PRAGMA journal_mode;" } -cleanup { cleanupDb $fileName unset -nocomplain db fileName } -constraints \ {eagle monoBug28 command.sql compile.DATA System.Data.SQLite} -result {delete}} ############################################################################### runTest {test tkt-448d663d11-1.7 {'Persist' journal mode, new db} -body { setupDb [set fileName tkt-448d663d11-1.7.db] Persist sql execute -execute scalar $db "PRAGMA journal_mode;" } -cleanup { cleanupDb $fileName unset -nocomplain db fileName } -constraints \ {eagle monoBug28 command.sql compile.DATA System.Data.SQLite} -result {persist}} ############################################################################### runTest {test tkt-448d663d11-1.8 {'Off' journal mode, new db} -body { setupDb [set fileName tkt-448d663d11-1.8.db] Off sql execute -execute scalar $db "PRAGMA journal_mode;" } -cleanup { cleanupDb $fileName unset -nocomplain db fileName } -constraints \ {eagle monoBug28 command.sql compile.DATA System.Data.SQLite} -result {off}} ############################################################################### runTest {test tkt-448d663d11-1.9 {'Truncate' journal mode, new db} -body { setupDb [set fileName tkt-448d663d11-1.9.db] Truncate sql execute -execute scalar $db "PRAGMA journal_mode;" } -cleanup { cleanupDb $fileName unset -nocomplain db fileName } -constraints \ {eagle monoBug28 command.sql compile.DATA System.Data.SQLite} -result {truncate}} ############################################################################### runTest {test tkt-448d663d11-1.10 {'Memory' journal mode, new db} -body { setupDb [set fileName tkt-448d663d11-1.10.db] Memory sql execute -execute scalar $db "PRAGMA journal_mode;" } -cleanup { cleanupDb $fileName unset -nocomplain db fileName } -constraints \ {eagle monoBug28 command.sql compile.DATA System.Data.SQLite} -result {memory}} ############################################################################### runTest {test tkt-448d663d11-1.11 {'Wal' journal mode, new db} -body { setupDb [set fileName tkt-448d663d11-1.11.db] Wal sql execute -execute scalar $db "PRAGMA journal_mode;" } -cleanup { cleanupDb $fileName unset -nocomplain db fileName } -constraints \ {eagle monoBug28 command.sql compile.DATA System.Data.SQLite} -result {wal}} ############################################################################### runTest {test tkt-448d663d11-1.12 {'Wal' journal mode, non-WAL db} -body { set fileName tkt-448d663d11-1.12.db file copy -force [file join $path nonWal.db] \ [file join [getTemporaryPath] $fileName] setupDb $fileName Wal sql execute -execute scalar $db "PRAGMA journal_mode;" } -cleanup { cleanupDb $fileName unset -nocomplain db fileName } -constraints \ {eagle monoBug28 command.sql compile.DATA System.Data.SQLite} -result {wal}} ############################################################################### runTest {test tkt-448d663d11-1.13 {'Wal' journal mode, WAL db} -body { set fileName tkt-448d663d11-1.13.db file copy -force [file join $path wal.db] \ [file join [getTemporaryPath] $fileName] setupDb $fileName Wal sql execute -execute scalar $db "PRAGMA journal_mode;" } -cleanup { cleanupDb $fileName unset -nocomplain db fileName } -constraints \ {eagle monoBug28 command.sql compile.DATA System.Data.SQLite} -result {wal}} ############################################################################### runTestEpilogue |
Added Tests/wal.db.
cannot compute difference between binary files