Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Cleanup and simplify the tests for ticket [a7d04fb111] and make them work without assuming a particular time zone. |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
448185cbf9bbbe126146645b0e20f615 |
User & Date: | mistachkin 2016-06-22 03:13:48.149 |
Context
2016-06-22
| ||
08:52 | Enhance the batch build tool to support building only the interop assembly (and static or normal). check-in: 3ba1cb8a96 user: mistachkin tags: trunk | |
03:13 | Cleanup and simplify the tests for ticket [a7d04fb111] and make them work without assuming a particular time zone. check-in: 448185cbf9 user: mistachkin tags: trunk | |
2016-06-21
| ||
21:52 | Add DateTime helper procedure to the test suite infrastructure. check-in: 9e4970c6e2 user: mistachkin tags: trunk | |
Changes
Changes to Tests/tkt-a7d04fb111.eagle.
︙ | ︙ | |||
16 17 18 19 20 21 22 | ############################################################################### package require System.Data.SQLite.Test runSQLiteTestPrologue ############################################################################### | | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > < < < < < < < < < < | | | | | | < < < < < < < < < < | | | | | | < < < < < < < < < < | | | | | > | < < < < < < < < < < | | | | | > | < < < < < < < < < < | | | | | > | < < < < < < < < < < | | | | | | > | < < < < < < < < < < | | | | | > | < < < < < < < < < < | | | | | > | < < < < < < < < < < | | | | | > | < < < < < < < < < < | | | | | | | | > | 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 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 | ############################################################################### package require System.Data.SQLite.Test runSQLiteTestPrologue ############################################################################### set rawValue(0) "2015-02-18 00:00:00.0000000" ############################################################################### set ticksValue(0) [getDateTimeTicks $rawValue(0)] set ticksValue(1) [getDateTimeTicks $rawValue(0) false] set ticksValue(2) [getDateTimeTicks $rawValue(0) true] ############################################################################### set instanceValue(0) [object create -alias DateTime $ticksValue(0)] set instanceValue(1) [object create -alias DateTime $ticksValue(1) Utc] set instanceValue(2) [object create -alias DateTime $ticksValue(2) Local] ############################################################################### set iso8601Value(0) [$instanceValue(0) ToString [getDateTimeFormat]] set iso8601Value(1) [$instanceValue(1) ToString [getDateTimeFormat]] set iso8601Value(2) [$instanceValue(2) ToString [getDateTimeFormat false]] ############################################################################### set julianDayValue(0) [object invoke System.Data.SQLite.SQLiteConvert \ ToJulianDay $instanceValue(0)] set julianDayValue(1) [object invoke System.Data.SQLite.SQLiteConvert \ ToJulianDay $instanceValue(1)] set julianDayValue(2) [object invoke System.Data.SQLite.SQLiteConvert \ ToJulianDay $instanceValue(2)] ############################################################################### set unixEpochValue(0) [object invoke System.Data.SQLite.SQLiteConvert \ ToUnixEpoch $instanceValue(0)] set unixEpochValue(1) [object invoke System.Data.SQLite.SQLiteConvert \ ToUnixEpoch $instanceValue(1)] set unixEpochValue(2) [object invoke System.Data.SQLite.SQLiteConvert \ ToUnixEpoch $instanceValue(2)] ############################################################################### set invariantCultureValue(0) [object invoke System.Data.SQLite.SQLiteConvert \ ToString $instanceValue(0) InvariantCulture Unspecified null] set invariantCultureValue(1) [object invoke System.Data.SQLite.SQLiteConvert \ ToString $instanceValue(1) InvariantCulture Utc null] set invariantCultureValue(2) [object invoke System.Data.SQLite.SQLiteConvert \ ToString $instanceValue(2) InvariantCulture Local null] ############################################################################### runTest {test tkt-a7d04fb111-1.1 {Bind DateTime Utc Ticks} -setup { setupDb [set fileName tkt-a7d04fb111-1.1.db] "" Ticks Utc \ BindDateTimeWithKind } -body { lappend result [sql execute -execute scalar $db "SELECT ?;" \ [list param1 DateTime $instanceValue(0)]] lappend result [sql execute -execute scalar $db "SELECT ?;" \ [list param1 DateTime $instanceValue(1)]] lappend result [sql execute -execute scalar $db "SELECT ?;" \ [list param1 DateTime $instanceValue(2)]] lappend result [expr {[lindex $result 0] == [lindex $result 1]}] lappend result [expr {[lindex $result 0] == [lindex $result 2]}] lappend result [expr {[lindex $result 1] == [lindex $result 2]}] } -cleanup { cleanupDb $fileName unset -nocomplain result db fileName } -constraints {eagle command.object monoBug28 monoBug42 command.sql\ compile.DATA SQLite System.Data.SQLite} -result [subst -nocommands \ -nobackslashes {$ticksValue(0) $ticksValue(1) $ticksValue(1) True True True}]} ############################################################################### runTest {test tkt-a7d04fb111-1.2 {Bind DateTime Local Ticks} -setup { setupDb [set fileName tkt-a7d04fb111-1.2.db] "" Ticks Local \ BindDateTimeWithKind } -body { lappend result [sql execute -execute scalar $db "SELECT ?;" \ [list param1 DateTime $instanceValue(0)]] lappend result [sql execute -execute scalar $db "SELECT ?;" \ [list param1 DateTime $instanceValue(1)]] lappend result [sql execute -execute scalar $db "SELECT ?;" \ [list param1 DateTime $instanceValue(2)]] lappend result [expr {[lindex $result 0] == [lindex $result 1]}] lappend result [expr {[lindex $result 0] == [lindex $result 2]}] lappend result [expr {[lindex $result 1] == [lindex $result 2]}] } -cleanup { cleanupDb $fileName unset -nocomplain result db fileName } -constraints {eagle command.object monoBug28 monoBug42 command.sql\ compile.DATA SQLite System.Data.SQLite} -result [subst -nocommands \ -nobackslashes {$ticksValue(0) $ticksValue(2) $ticksValue(2) False False True}]} ############################################################################### runTest {test tkt-a7d04fb111-1.3 {Bind DateTime Utc ISO8601} -setup { setupDb [set fileName tkt-a7d04fb111-1.3.db] "" ISO8601 Utc \ BindDateTimeWithKind } -body { lappend result [sql execute -execute scalar $db "SELECT ?;" \ [list param1 DateTime $instanceValue(0)]] lappend result [sql execute -execute scalar $db "SELECT ?;" \ [list param1 DateTime $instanceValue(1)]] lappend result [sql execute -execute scalar $db "SELECT ?;" \ [list param1 DateTime $instanceValue(2)]] lappend result [expr {[lindex $result 0] eq [lindex $result 1]}] lappend result [expr {[lindex $result 0] eq [lindex $result 2]}] lappend result [expr {[lindex $result 1] eq [lindex $result 2]}] } -cleanup { cleanupDb $fileName unset -nocomplain result db fileName } -constraints {eagle command.object monoBug28 monoBug42 command.sql\ compile.DATA SQLite System.Data.SQLite} -result [subst -nocommands \ -nobackslashes {{$iso8601Value(1)} {$iso8601Value(1)} {$iso8601Value(1)} True\ True True}]} ############################################################################### runTest {test tkt-a7d04fb111-1.4 {Bind DateTime Local ISO8601} -setup { setupDb [set fileName tkt-a7d04fb111-1.4.db] "" ISO8601 Local \ BindDateTimeWithKind } -body { lappend result [sql execute -execute scalar $db "SELECT ?;" \ [list param1 DateTime $instanceValue(0)]] lappend result [sql execute -execute scalar $db "SELECT ?;" \ [list param1 DateTime $instanceValue(1)]] lappend result [sql execute -execute scalar $db "SELECT ?;" \ [list param1 DateTime $instanceValue(2)]] lappend result [expr {[lindex $result 0] eq [lindex $result 1]}] lappend result [expr {[lindex $result 0] eq [lindex $result 2]}] lappend result [expr {[lindex $result 1] eq [lindex $result 2]}] } -cleanup { cleanupDb $fileName unset -nocomplain result db fileName } -constraints {eagle command.object monoBug28 monoBug42 command.sql\ compile.DATA SQLite System.Data.SQLite} -result [subst -nocommands \ -nobackslashes {{$iso8601Value(0)} {$iso8601Value(2)} {$iso8601Value(2)} False\ False True}]} ############################################################################### runTest {test tkt-a7d04fb111-1.5 {Bind DateTime Utc JulianDay} -setup { setupDb [set fileName tkt-a7d04fb111-1.5.db] "" JulianDay Utc \ BindDateTimeWithKind } -body { lappend result [sql execute -execute scalar $db "SELECT ?;" \ [list param1 DateTime $instanceValue(0)]] lappend result [sql execute -execute scalar $db "SELECT ?;" \ [list param1 DateTime $instanceValue(1)]] lappend result [expr {round2([sql execute -execute scalar $db "SELECT ?;" \ [list param1 DateTime $instanceValue(2)]], 2)}] lappend result [expr {[lindex $result 0] == [lindex $result 1]}] lappend result [expr {[lindex $result 0] == [lindex $result 2]}] lappend result [expr {[lindex $result 1] == [lindex $result 2]}] } -cleanup { cleanupDb $fileName unset -nocomplain result db fileName } -constraints {eagle command.object monoBug28 monoBug42 command.sql\ compile.DATA SQLite System.Data.SQLite} -result [subst -nocommands \ -nobackslashes {$julianDayValue(0) $julianDayValue(1) $julianDayValue(1) True\ True True}]} ############################################################################### runTest {test tkt-a7d04fb111-1.6 {Bind DateTime Local JulianDay} -setup { setupDb [set fileName tkt-a7d04fb111-1.6.db] "" JulianDay Local \ BindDateTimeWithKind } -body { lappend result [sql execute -execute scalar $db "SELECT ?;" \ [list param1 DateTime $instanceValue(0)]] lappend result [sql execute -execute scalar $db "SELECT ?;" \ [list param1 DateTime $instanceValue(1)]] lappend result [sql execute -execute scalar $db "SELECT ?;" \ [list param1 DateTime $instanceValue(2)]] lappend result [expr {[lindex $result 0] == [lindex $result 1]}] lappend result [expr {[lindex $result 0] == [lindex $result 2]}] lappend result [expr {[lindex $result 1] == [lindex $result 2]}] } -cleanup { cleanupDb $fileName unset -nocomplain result db fileName } -constraints {eagle command.object monoBug28 monoBug42 command.sql\ compile.DATA SQLite System.Data.SQLite} -result [subst -nocommands \ -nobackslashes {$julianDayValue(0) $julianDayValue(2) $julianDayValue(2) False\ False True}]} ############################################################################### runTest {test tkt-a7d04fb111-1.7 {Bind DateTime Utc UnixEpoch} -setup { setupDb [set fileName tkt-a7d04fb111-1.7.db] "" UnixEpoch Utc \ BindDateTimeWithKind } -body { lappend result [sql execute -execute scalar $db "SELECT ?;" \ [list param1 DateTime $instanceValue(0)]] lappend result [sql execute -execute scalar $db "SELECT ?;" \ [list param1 DateTime $instanceValue(1)]] lappend result [sql execute -execute scalar $db "SELECT ?;" \ [list param1 DateTime $instanceValue(2)]] lappend result [expr {[lindex $result 0] == [lindex $result 1]}] lappend result [expr {[lindex $result 0] == [lindex $result 2]}] lappend result [expr {[lindex $result 1] == [lindex $result 2]}] } -cleanup { cleanupDb $fileName unset -nocomplain result db fileName } -constraints {eagle command.object monoBug28 monoBug42 command.sql\ compile.DATA SQLite System.Data.SQLite} -result [subst -nocommands \ -nobackslashes {$unixEpochValue(0) $unixEpochValue(1) $unixEpochValue(1) True\ True True}]} ############################################################################### runTest {test tkt-a7d04fb111-1.8 {Bind DateTime Local UnixEpoch} -setup { setupDb [set fileName tkt-a7d04fb111-1.8.db] "" UnixEpoch Local \ BindDateTimeWithKind } -body { lappend result [sql execute -execute scalar $db "SELECT ?;" \ [list param1 DateTime $instanceValue(0)]] lappend result [sql execute -execute scalar $db "SELECT ?;" \ [list param1 DateTime $instanceValue(1)]] lappend result [sql execute -execute scalar $db "SELECT ?;" \ [list param1 DateTime $instanceValue(2)]] lappend result [expr {[lindex $result 0] == [lindex $result 1]}] lappend result [expr {[lindex $result 0] == [lindex $result 2]}] lappend result [expr {[lindex $result 1] == [lindex $result 2]}] } -cleanup { cleanupDb $fileName unset -nocomplain result db fileName } -constraints {eagle command.object monoBug28 monoBug42 command.sql\ compile.DATA SQLite System.Data.SQLite} -result [subst -nocommands \ -nobackslashes {$unixEpochValue(0) $unixEpochValue(2) $unixEpochValue(2) False\ False True}]} ############################################################################### runTest {test tkt-a7d04fb111-1.9 {Bind DateTime Utc Invariant} -setup { setupDb [set fileName tkt-a7d04fb111-1.9.db] "" InvariantCulture Utc \ BindDateTimeWithKind } -body { lappend result [sql execute -execute scalar $db "SELECT ?;" \ [list param1 DateTime $instanceValue(0)]] lappend result [sql execute -execute scalar $db "SELECT ?;" \ [list param1 DateTime $instanceValue(1)]] lappend result [sql execute -execute scalar $db "SELECT ?;" \ [list param1 DateTime $instanceValue(2)]] lappend result [expr {[lindex $result 0] eq [lindex $result 1]}] lappend result [expr {[lindex $result 0] eq [lindex $result 2]}] lappend result [expr {[lindex $result 1] eq [lindex $result 2]}] } -cleanup { cleanupDb $fileName unset -nocomplain result db fileName } -constraints {eagle command.object monoBug28 monoBug42 command.sql\ compile.DATA SQLite System.Data.SQLite} -result [subst -nocommands \ -nobackslashes {$invariantCultureValue(0) $invariantCultureValue(1)\ $invariantCultureValue(1) False False True}]} ############################################################################### runTest {test tkt-a7d04fb111-1.10 {Bind DateTime Local Invariant} -setup { setupDb [set fileName tkt-a7d04fb111-1.10.db] "" InvariantCulture Local \ BindDateTimeWithKind } -body { lappend result [sql execute -execute scalar $db "SELECT ?;" \ [list param1 DateTime $instanceValue(0)]] lappend result [sql execute -execute scalar $db "SELECT ?;" \ [list param1 DateTime $instanceValue(1)]] lappend result [sql execute -execute scalar $db "SELECT ?;" \ [list param1 DateTime $instanceValue(2)]] lappend result [expr {[lindex $result 0] eq [lindex $result 1]}] lappend result [expr {[lindex $result 0] eq [lindex $result 2]}] lappend result [expr {[lindex $result 1] eq [lindex $result 2]}] } -cleanup { cleanupDb $fileName unset -nocomplain result db fileName } -constraints {eagle command.object monoBug28 monoBug42 command.sql\ compile.DATA SQLite System.Data.SQLite} -result [subst -nocommands \ -nobackslashes {$invariantCultureValue(0) $invariantCultureValue(2)\ $invariantCultureValue(2) False False True}]} ############################################################################### unset -nocomplain invariantCultureValue unixEpochValue julianDayValue \ iso8601Value instanceValue ticksValue rawValue ############################################################################### runSQLiteTestEpilogue runTestEpilogue |
Changes to lib/System.Data.SQLite/common.eagle.
︙ | ︙ | |||
1802 1803 1804 1805 1806 1807 1808 | tputs $channel no\n } } else { tputs $channel error\n } } | | > | | 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 | tputs $channel no\n } } else { tputs $channel error\n } } proc getDateTimeFormat { {timeZone true} } { # # NOTE: This procedure simply returns the "default" DateTime format used # by the test suite. # if {[info exists ::datetime_format] && \ [string length $::datetime_format] > 0} then { # # NOTE: Return the manually overridden value for the DateTime format. # return $::datetime_format } else { # # NOTE: Return an ISO8601 DateTime format compatible with SQLite, # System.Data.SQLite, and suitable for round-tripping with the # DateTime class of the framework. If this value is changed, # various tests may fail. # return [appendArgs \ "yyyy-MM-dd HH:mm:ss.FFFFFFF" [expr {$timeZone ? "K" : ""}]] } } proc getDateTimeTicks { value {local ""} {default ""} } { if {[string length $value] == 0} then { return $default } |
︙ | ︙ |