Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(53)

Side by Side Diff: third_party/sqlite/src/test/nan.test

Issue 5626002: Update sqlite to 3.7.3. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/third_party/sqlite/src
Patch Set: Remove misc change. Created 10 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « third_party/sqlite/src/test/misc5.test ('k') | third_party/sqlite/src/test/notify3.test » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #***********************************************************************
11 # 11 #
12 # Ticket #3060 12 # Ticket #3060
13 # 13 #
14 # Make sure IEEE floating point NaN values are handled properly. 14 # Make sure IEEE floating point NaN values are handled properly.
15 # SQLite should always convert NaN into NULL. 15 # SQLite should always convert NaN into NULL.
16 # 16 #
17 # Also verify that the decimal to IEEE754 binary conversion routines 17 # Also verify that the decimal to IEEE754 binary conversion routines
18 # correctly generate 0.0, +Inf, and -Inf as appropriate for numbers 18 # correctly generate 0.0, +Inf, and -Inf as appropriate for numbers
19 # out of range. 19 # out of range.
20 # 20 #
21 # $Id: nan.test,v 1.5 2008/09/18 11:30:13 danielk1977 Exp $ 21 # $Id: nan.test,v 1.5 2008/09/18 11:30:13 danielk1977 Exp $
22 # 22 #
23 23
24 set testdir [file dirname $argv0] 24 set testdir [file dirname $argv0]
25 source $testdir/tester.tcl 25 source $testdir/tester.tcl
26 26
27 # Do not use a codec for tests in this file, as the database file is
28 # manipulated directly using tcl scripts (using the [hexio_write] command).
29 #
30 do_not_use_codec
31
27 do_test nan-1.1.1 { 32 do_test nan-1.1.1 {
28 db eval { 33 db eval {
29 PRAGMA auto_vacuum=OFF; 34 PRAGMA auto_vacuum=OFF;
30 PRAGMA page_size=1024; 35 PRAGMA page_size=1024;
31 CREATE TABLE t1(x FLOAT); 36 CREATE TABLE t1(x FLOAT);
32 } 37 }
33 set ::STMT [sqlite3_prepare db "INSERT INTO t1 VALUES(?)" -1 TAIL] 38 set ::STMT [sqlite3_prepare db "INSERT INTO t1 VALUES(?)" -1 TAIL]
34 sqlite3_bind_double $::STMT 1 NaN 39 sqlite3_bind_double $::STMT 1 NaN
35 sqlite3_step $::STMT 40 sqlite3_step $::STMT
36 sqlite3_reset $::STMT 41 sqlite3_reset $::STMT
(...skipping 17 matching lines...) Expand all
54 sqlite3_step $::STMT 59 sqlite3_step $::STMT
55 sqlite3_reset $::STMT 60 sqlite3_reset $::STMT
56 db eval {SELECT x, typeof(x) FROM t1} 61 db eval {SELECT x, typeof(x) FROM t1}
57 } {{} null inf real -inf real {} null} 62 } {{} null inf real -inf real {} null}
58 do_test nan-1.1.5 { 63 do_test nan-1.1.5 {
59 sqlite3_bind_double $::STMT 1 NaN0 64 sqlite3_bind_double $::STMT 1 NaN0
60 sqlite3_step $::STMT 65 sqlite3_step $::STMT
61 sqlite3_reset $::STMT 66 sqlite3_reset $::STMT
62 db eval {SELECT x, typeof(x) FROM t1} 67 db eval {SELECT x, typeof(x) FROM t1}
63 } {{} null inf real -inf real {} null {} null} 68 } {{} null inf real -inf real {} null {} null}
64 do_test nan-1.1.5 { 69 do_test nan-1.1.6 {
65 sqlite3_bind_double $::STMT 1 -NaN0 70 sqlite3_bind_double $::STMT 1 -NaN0
66 sqlite3_step $::STMT 71 sqlite3_step $::STMT
67 sqlite3_reset $::STMT 72 sqlite3_reset $::STMT
68 db eval {SELECT x, typeof(x) FROM t1} 73 db eval {SELECT x, typeof(x) FROM t1}
69 } {{} null inf real -inf real {} null {} null {} null} 74 } {{} null inf real -inf real {} null {} null {} null}
70 do_test nan-1.1.6 { 75 do_test nan-1.1.7 {
71 db eval { 76 db eval {
72 UPDATE t1 SET x=x-x; 77 UPDATE t1 SET x=x-x;
73 SELECT x, typeof(x) FROM t1; 78 SELECT x, typeof(x) FROM t1;
74 } 79 }
75 } {{} null {} null {} null {} null {} null {} null} 80 } {{} null {} null {} null {} null {} null {} null}
76 } 81 }
77 82
78 # The following block of tests, nan-1.2.*, are the same as the nan-1.1.* 83 # The following block of tests, nan-1.2.*, are the same as the nan-1.1.*
79 # tests above, except that the SELECT queries used to validate data 84 # tests above, except that the SELECT queries used to validate data
80 # convert floating point values to text internally before returning them 85 # convert floating point values to text internally before returning them
(...skipping 27 matching lines...) Expand all
108 sqlite3_step $::STMT 113 sqlite3_step $::STMT
109 sqlite3_reset $::STMT 114 sqlite3_reset $::STMT
110 db eval {SELECT CAST(x AS text), typeof(x) FROM t1} 115 db eval {SELECT CAST(x AS text), typeof(x) FROM t1}
111 } {{} null Inf real -Inf real {} null} 116 } {{} null Inf real -Inf real {} null}
112 do_test nan-1.2.5 { 117 do_test nan-1.2.5 {
113 sqlite3_bind_double $::STMT 1 NaN0 118 sqlite3_bind_double $::STMT 1 NaN0
114 sqlite3_step $::STMT 119 sqlite3_step $::STMT
115 sqlite3_reset $::STMT 120 sqlite3_reset $::STMT
116 db eval {SELECT CAST(x AS text), typeof(x) FROM t1} 121 db eval {SELECT CAST(x AS text), typeof(x) FROM t1}
117 } {{} null Inf real -Inf real {} null {} null} 122 } {{} null Inf real -Inf real {} null {} null}
118 do_test nan-1.2.5 { 123 do_test nan-1.2.6 {
119 sqlite3_bind_double $::STMT 1 -NaN0 124 sqlite3_bind_double $::STMT 1 -NaN0
120 sqlite3_step $::STMT 125 sqlite3_step $::STMT
121 sqlite3_reset $::STMT 126 sqlite3_reset $::STMT
122 db eval {SELECT CAST(x AS text), typeof(x) FROM t1} 127 db eval {SELECT CAST(x AS text), typeof(x) FROM t1}
123 } {{} null Inf real -Inf real {} null {} null {} null} 128 } {{} null Inf real -Inf real {} null {} null {} null}
124 do_test nan-1.2.6 { 129 do_test nan-1.2.7 {
125 db eval { 130 db eval {
126 UPDATE t1 SET x=x-x; 131 UPDATE t1 SET x=x-x;
127 SELECT CAST(x AS text), typeof(x) FROM t1; 132 SELECT CAST(x AS text), typeof(x) FROM t1;
128 } 133 }
129 } {{} null {} null {} null {} null {} null {} null} 134 } {{} null {} null {} null {} null {} null {} null}
130 135
131 do_test nan-2.1 { 136 do_test nan-2.1 {
132 db eval { 137 db eval {
133 DELETE FROM T1; 138 DELETE FROM T1;
134 } 139 }
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
241 db eval {DELETE FROM t1} 246 db eval {DELETE FROM t1}
242 db eval "INSERT INTO t1 VALUES([string repeat 9 309].0)" 247 db eval "INSERT INTO t1 VALUES([string repeat 9 309].0)"
243 db eval {SELECT CAST(x AS text), typeof(x) FROM t1} 248 db eval {SELECT CAST(x AS text), typeof(x) FROM t1}
244 } {Inf real} 249 } {Inf real}
245 do_test nan-4.10 { 250 do_test nan-4.10 {
246 db eval {DELETE FROM t1} 251 db eval {DELETE FROM t1}
247 db eval "INSERT INTO t1 VALUES(-[string repeat 9 309].0)" 252 db eval "INSERT INTO t1 VALUES(-[string repeat 9 309].0)"
248 db eval {SELECT CAST(x AS text), typeof(x) FROM t1} 253 db eval {SELECT CAST(x AS text), typeof(x) FROM t1}
249 } {-Inf real} 254 } {-Inf real}
250 255
251 do_test nan-4.10 { 256 do_test nan-4.11 {
252 db eval {DELETE FROM t1} 257 db eval {DELETE FROM t1}
253 db eval "INSERT INTO t1 VALUES(1234.5[string repeat 0 10000]12345)" 258 db eval "INSERT INTO t1 VALUES(1234.5[string repeat 0 10000]12345)"
254 db eval {SELECT x, typeof(x) FROM t1} 259 db eval {SELECT x, typeof(x) FROM t1}
255 } {1234.5 real} 260 } {1234.5 real}
256 do_test nan-4.11 { 261 do_test nan-4.12 {
257 db eval {DELETE FROM t1} 262 db eval {DELETE FROM t1}
258 db eval "INSERT INTO t1 VALUES(-1234.5[string repeat 0 10000]12345)" 263 db eval "INSERT INTO t1 VALUES(-1234.5[string repeat 0 10000]12345)"
259 db eval {SELECT x, typeof(x) FROM t1} 264 db eval {SELECT x, typeof(x) FROM t1}
260 } {-1234.5 real} 265 } {-1234.5 real}
261 do_test nan-4.12 { 266 do_test nan-4.13 {
262 db eval {DELETE FROM t1} 267 db eval {DELETE FROM t1}
263 set small [string repeat 0 10000].[string repeat 0 324][string repeat 9 10000] 268 set small [string repeat 0 10000].[string repeat 0 324][string repeat 9 10000]
264 db eval "INSERT INTO t1 VALUES($small)" 269 db eval "INSERT INTO t1 VALUES($small)"
265 db eval {SELECT x, typeof(x) FROM t1} 270 db eval {SELECT x, typeof(x) FROM t1}
266 } {0.0 real} 271 } {0.0 real}
267 do_test nan-4.13 { 272 do_test nan-4.14 {
268 db eval {DELETE FROM t1} 273 db eval {DELETE FROM t1}
269 set small \ 274 set small \
270 -[string repeat 0 10000].[string repeat 0 324][string repeat 9 10000] 275 -[string repeat 0 10000].[string repeat 0 324][string repeat 9 10000]
271 db eval "INSERT INTO t1 VALUES($small)" 276 db eval "INSERT INTO t1 VALUES($small)"
272 db eval {SELECT x, typeof(x) FROM t1} 277 db eval {SELECT x, typeof(x) FROM t1}
273 } {0.0 real} 278 } {0.0 real}
274 279
275 # These tests test some really, really small floating point numbers. 280 # These tests test some really, really small floating point numbers.
276 # 281 #
277 if {$tcl_platform(platform) != "symbian"} { 282 if {$tcl_platform(platform) != "symbian"} {
278 # These two are not run on symbian because tcl has trouble converting 283 # These two are not run on symbian because tcl has trouble converting
279 # the very small numbers back to text form (probably due to a difference 284 # the very small numbers back to text form (probably due to a difference
280 # in the sprintf() implementation). 285 # in the sprintf() implementation).
281 # 286 #
282 do_test nan-4.14 { 287 do_test nan-4.15 {
283 db eval {DELETE FROM t1} 288 db eval {DELETE FROM t1}
284 set small \ 289 set small \
285 [string repeat 0 10000].[string repeat 0 323][string repeat 9 10000] 290 [string repeat 0 10000].[string repeat 0 323][string repeat 9 10000]
286 db eval "INSERT INTO t1 VALUES($small)" 291 db eval "INSERT INTO t1 VALUES($small)"
287 db eval {SELECT x, typeof(x) FROM t1} 292 db eval {SELECT x, typeof(x) FROM t1}
288 } {9.88131291682493e-324 real} 293 } {9.88131291682493e-324 real}
289 do_test nan-4.15 { 294 do_test nan-4.16 {
290 db eval {DELETE FROM t1} 295 db eval {DELETE FROM t1}
291 set small \ 296 set small \
292 -[string repeat 0 10000].[string repeat 0 323][string repeat 9 10000] 297 -[string repeat 0 10000].[string repeat 0 323][string repeat 9 10000]
293 db eval "INSERT INTO t1 VALUES($small)" 298 db eval "INSERT INTO t1 VALUES($small)"
294 db eval {SELECT x, typeof(x) FROM t1} 299 db eval {SELECT x, typeof(x) FROM t1}
295 } {-9.88131291682493e-324 real} 300 } {-9.88131291682493e-324 real}
296 } 301 }
297 do_test nan-4.16 { 302 do_test nan-4.17 {
298 db eval {DELETE FROM t1} 303 db eval {DELETE FROM t1}
299 set small [string repeat 0 10000].[string repeat 0 323][string repeat 9 10000] 304 set small [string repeat 0 10000].[string repeat 0 323][string repeat 9 10000]
300 db eval "INSERT INTO t1 VALUES($small)" 305 db eval "INSERT INTO t1 VALUES($small)"
301 db eval {SELECT CAST(x AS text), typeof(x) FROM t1} 306 db eval {SELECT CAST(x AS text), typeof(x) FROM t1}
302 } {9.88131291682493e-324 real} 307 } {9.88131291682493e-324 real}
303 do_test nan-4.17 { 308 do_test nan-4.18 {
304 db eval {DELETE FROM t1} 309 db eval {DELETE FROM t1}
305 set small \ 310 set small \
306 -[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]
307 db eval "INSERT INTO t1 VALUES($small)" 312 db eval "INSERT INTO t1 VALUES($small)"
308 db eval {SELECT CAST(x AS text), typeof(x) FROM t1} 313 db eval {SELECT CAST(x AS text), typeof(x) FROM t1}
309 } {-9.88131291682493e-324 real} 314 } {-9.88131291682493e-324 real}
310 315
311 do_test nan-4.20 { 316 do_test nan-4.20 {
312 db eval {DELETE FROM t1} 317 db eval {DELETE FROM t1}
313 set big [string repeat 9 10000].0e-9000 318 set big [string repeat 9 10000].0e-9000
314 db eval "INSERT INTO t1 VALUES($big)" 319 db eval "INSERT INTO t1 VALUES($big)"
315 db eval {SELECT x, typeof(x) FROM t1} 320 db eval {SELECT x, typeof(x) FROM t1}
316 } {inf real} 321 } {inf real}
317 322
318 323
319 324
320 finish_test 325 finish_test
OLDNEW
« no previous file with comments | « third_party/sqlite/src/test/misc5.test ('k') | third_party/sqlite/src/test/notify3.test » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698