OLD | NEW |
1 # 2008 April 28 | 1 # 2008 April 28 |
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 #*********************************************************************** |
(...skipping 24 matching lines...) Expand all Loading... |
35 PRAGMA page_size=1024; | 35 PRAGMA page_size=1024; |
36 CREATE TABLE t1(x FLOAT); | 36 CREATE TABLE t1(x FLOAT); |
37 } | 37 } |
38 set ::STMT [sqlite3_prepare db "INSERT INTO t1 VALUES(?)" -1 TAIL] | 38 set ::STMT [sqlite3_prepare db "INSERT INTO t1 VALUES(?)" -1 TAIL] |
39 sqlite3_bind_double $::STMT 1 NaN | 39 sqlite3_bind_double $::STMT 1 NaN |
40 sqlite3_step $::STMT | 40 sqlite3_step $::STMT |
41 sqlite3_reset $::STMT | 41 sqlite3_reset $::STMT |
42 db eval {SELECT x, typeof(x) FROM t1} | 42 db eval {SELECT x, typeof(x) FROM t1} |
43 } {{} null} | 43 } {{} null} |
44 if {$tcl_platform(platform) != "symbian"} { | 44 if {$tcl_platform(platform) != "symbian"} { |
45 do_test nan-1.1.2 { | 45 do_realnum_test nan-1.1.2 { |
46 sqlite3_bind_double $::STMT 1 +Inf | 46 sqlite3_bind_double $::STMT 1 +Inf |
47 sqlite3_step $::STMT | 47 sqlite3_step $::STMT |
48 sqlite3_reset $::STMT | 48 sqlite3_reset $::STMT |
49 db eval {SELECT x, typeof(x) FROM t1} | 49 db eval {SELECT x, typeof(x) FROM t1} |
50 } {{} null inf real} | 50 } {{} null inf real} |
51 do_test nan-1.1.3 { | 51 do_realnum_test nan-1.1.3 { |
52 sqlite3_bind_double $::STMT 1 -Inf | 52 sqlite3_bind_double $::STMT 1 -Inf |
53 sqlite3_step $::STMT | 53 sqlite3_step $::STMT |
54 sqlite3_reset $::STMT | 54 sqlite3_reset $::STMT |
55 db eval {SELECT x, typeof(x) FROM t1} | 55 db eval {SELECT x, typeof(x) FROM t1} |
56 } {{} null inf real -inf real} | 56 } {{} null inf real -inf real} |
57 do_test nan-1.1.4 { | 57 do_realnum_test nan-1.1.4 { |
58 sqlite3_bind_double $::STMT 1 -NaN | 58 sqlite3_bind_double $::STMT 1 -NaN |
59 sqlite3_step $::STMT | 59 sqlite3_step $::STMT |
60 sqlite3_reset $::STMT | 60 sqlite3_reset $::STMT |
61 db eval {SELECT x, typeof(x) FROM t1} | 61 db eval {SELECT x, typeof(x) FROM t1} |
62 } {{} null inf real -inf real {} null} | 62 } {{} null inf real -inf real {} null} |
63 do_test nan-1.1.5 { | 63 do_realnum_test nan-1.1.5 { |
64 sqlite3_bind_double $::STMT 1 NaN0 | 64 sqlite3_bind_double $::STMT 1 NaN0 |
65 sqlite3_step $::STMT | 65 sqlite3_step $::STMT |
66 sqlite3_reset $::STMT | 66 sqlite3_reset $::STMT |
67 db eval {SELECT x, typeof(x) FROM t1} | 67 db eval {SELECT x, typeof(x) FROM t1} |
68 } {{} null inf real -inf real {} null {} null} | 68 } {{} null inf real -inf real {} null {} null} |
69 do_test nan-1.1.6 { | 69 do_realnum_test nan-1.1.6 { |
70 sqlite3_bind_double $::STMT 1 -NaN0 | 70 sqlite3_bind_double $::STMT 1 -NaN0 |
71 sqlite3_step $::STMT | 71 sqlite3_step $::STMT |
72 sqlite3_reset $::STMT | 72 sqlite3_reset $::STMT |
73 db eval {SELECT x, typeof(x) FROM t1} | 73 db eval {SELECT x, typeof(x) FROM t1} |
74 } {{} null inf real -inf real {} null {} null {} null} | 74 } {{} null inf real -inf real {} null {} null {} null} |
75 do_test nan-1.1.7 { | 75 do_test nan-1.1.7 { |
76 db eval { | 76 db eval { |
77 UPDATE t1 SET x=x-x; | 77 UPDATE t1 SET x=x-x; |
78 SELECT x, typeof(x) FROM t1; | 78 SELECT x, typeof(x) FROM t1; |
79 } | 79 } |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
224 db eval {DELETE FROM t1} | 224 db eval {DELETE FROM t1} |
225 set big [string repeat 0 10000][string repeat 9 308].[string repeat 0 10000] | 225 set big [string repeat 0 10000][string repeat 9 308].[string repeat 0 10000] |
226 db eval "INSERT INTO t1 VALUES($big)" | 226 db eval "INSERT INTO t1 VALUES($big)" |
227 db eval {SELECT x, typeof(x) FROM t1} | 227 db eval {SELECT x, typeof(x) FROM t1} |
228 } {1e+308 real} | 228 } {1e+308 real} |
229 | 229 |
230 if {$tcl_platform(platform) != "symbian"} { | 230 if {$tcl_platform(platform) != "symbian"} { |
231 # Do not run these tests on Symbian, as the Tcl port doesn't like to | 231 # Do not run these tests on Symbian, as the Tcl port doesn't like to |
232 # convert from floating point value "-inf" to a string. | 232 # convert from floating point value "-inf" to a string. |
233 # | 233 # |
234 do_test nan-4.7 { | 234 do_realnum_test nan-4.7 { |
235 db eval {DELETE FROM t1} | 235 db eval {DELETE FROM t1} |
236 db eval "INSERT INTO t1 VALUES([string repeat 9 309].0)" | 236 db eval "INSERT INTO t1 VALUES([string repeat 9 309].0)" |
237 db eval {SELECT x, typeof(x) FROM t1} | 237 db eval {SELECT x, typeof(x) FROM t1} |
238 } {inf real} | 238 } {inf real} |
239 do_test nan-4.8 { | 239 do_realnum_test nan-4.8 { |
240 db eval {DELETE FROM t1} | 240 db eval {DELETE FROM t1} |
241 db eval "INSERT INTO t1 VALUES(-[string repeat 9 309].0)" | 241 db eval "INSERT INTO t1 VALUES(-[string repeat 9 309].0)" |
242 db eval {SELECT x, typeof(x) FROM t1} | 242 db eval {SELECT x, typeof(x) FROM t1} |
243 } {-inf real} | 243 } {-inf real} |
244 } | 244 } |
245 do_test nan-4.9 { | 245 do_test nan-4.9 { |
246 db eval {DELETE FROM t1} | 246 db eval {DELETE FROM t1} |
247 db eval "INSERT INTO t1 VALUES([string repeat 9 309].0)" | 247 db eval "INSERT INTO t1 VALUES([string repeat 9 309].0)" |
248 db eval {SELECT CAST(x AS text), typeof(x) FROM t1} | 248 db eval {SELECT CAST(x AS text), typeof(x) FROM t1} |
249 } {Inf real} | 249 } {Inf real} |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
306 db eval {SELECT CAST(x AS text), typeof(x) FROM t1} | 306 db eval {SELECT CAST(x AS text), typeof(x) FROM t1} |
307 } {9.88131291682493e-324 real} | 307 } {9.88131291682493e-324 real} |
308 do_test nan-4.18 { | 308 do_test nan-4.18 { |
309 db eval {DELETE FROM t1} | 309 db eval {DELETE FROM t1} |
310 set small \ | 310 set small \ |
311 -[string repeat 0 10000].[string repeat 0 323][string repeat 9 10000] | 311 -[string repeat 0 10000].[string repeat 0 323][string repeat 9 10000] |
312 db eval "INSERT INTO t1 VALUES($small)" | 312 db eval "INSERT INTO t1 VALUES($small)" |
313 db eval {SELECT CAST(x AS text), typeof(x) FROM t1} | 313 db eval {SELECT CAST(x AS text), typeof(x) FROM t1} |
314 } {-9.88131291682493e-324 real} | 314 } {-9.88131291682493e-324 real} |
315 | 315 |
316 do_test nan-4.20 { | 316 do_realnum_test nan-4.20 { |
317 db eval {DELETE FROM t1} | 317 db eval {DELETE FROM t1} |
318 set big [string repeat 9 10000].0e-9000 | 318 set big [string repeat 9 10000].0e-9000 |
319 db eval "INSERT INTO t1 VALUES($big)" | 319 db eval "INSERT INTO t1 VALUES($big)" |
320 db eval {SELECT x, typeof(x) FROM t1} | 320 db eval {SELECT x, typeof(x) FROM t1} |
321 } {inf real} | 321 } {inf real} |
322 | 322 |
| 323 do_realnum_test nan-4.30 { |
| 324 db eval { |
| 325 DELETE FROM t1; |
| 326 INSERT INTO t1 VALUES('2.5e+9999'); |
| 327 SELECT x, typeof(x) FROM t1; |
| 328 } |
| 329 } {inf real} |
| 330 do_realnum_test nan-4.31 { |
| 331 db eval { |
| 332 DELETE FROM t1; |
| 333 INSERT INTO t1 VALUES('2.5e+10000'); |
| 334 SELECT x, typeof(x) FROM t1; |
| 335 } |
| 336 } {inf real} |
| 337 |
| 338 do_realnum_test nan-4.32 { |
| 339 db eval { |
| 340 DELETE FROM t1; |
| 341 INSERT INTO t1 VALUES('2.5e-9999'); |
| 342 SELECT x, typeof(x) FROM t1; |
| 343 } |
| 344 } {0.0 real} |
| 345 do_realnum_test nan-4.33 { |
| 346 db eval { |
| 347 DELETE FROM t1; |
| 348 INSERT INTO t1 VALUES('2.5e-10000'); |
| 349 SELECT x, typeof(x) FROM t1; |
| 350 } |
| 351 } {0.0 real} |
| 352 do_realnum_test nan-4.34 { |
| 353 db eval { |
| 354 DELETE FROM t1; |
| 355 INSERT INTO t1 VALUES('2.5e2147483650'); |
| 356 SELECT x, typeof(x) FROM t1; |
| 357 } |
| 358 } {inf real} |
| 359 do_realnum_test nan-4.35 { |
| 360 db eval { |
| 361 DELETE FROM t1; |
| 362 INSERT INTO t1 VALUES('2.5e-2147483650'); |
| 363 SELECT x, typeof(x) FROM t1; |
| 364 } |
| 365 } {0.0 real} |
| 366 |
| 367 |
| 368 |
323 | 369 |
324 | 370 |
325 finish_test | 371 finish_test |
OLD | NEW |