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 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 } {{} null} | 144 } {{} null} |
145 sqlite3_finalize $::STMT | 145 sqlite3_finalize $::STMT |
146 | 146 |
147 # SQLite always converts NaN into NULL so it is not possible to write | 147 # SQLite always converts NaN into NULL so it is not possible to write |
148 # a NaN value into the database file using SQLite. The following series | 148 # a NaN value into the database file using SQLite. The following series |
149 # of tests writes a normal floating point value (0.5) into the database, | 149 # of tests writes a normal floating point value (0.5) into the database, |
150 # then writes directly into the database file to change the 0.5 into NaN. | 150 # then writes directly into the database file to change the 0.5 into NaN. |
151 # Then it reads the value of the database to verify it is converted into | 151 # Then it reads the value of the database to verify it is converted into |
152 # NULL. | 152 # NULL. |
153 # | 153 # |
154 do_test nan-3.1 { | 154 if {![nonzero_reserved_bytes]} { |
155 db eval { | 155 do_test nan-3.1 { |
156 DELETE FROM t1; | 156 db eval { |
157 INSERT INTO t1 VALUES(0.5); | 157 DELETE FROM t1; |
158 PRAGMA auto_vacuum=OFF; | 158 INSERT INTO t1 VALUES(0.5); |
159 PRAGMA page_size=1024; | 159 PRAGMA auto_vacuum=OFF; |
160 VACUUM; | 160 PRAGMA page_size=1024; |
161 } | 161 VACUUM; |
162 hexio_read test.db 2040 8 | 162 } |
163 } {3FE0000000000000} | 163 hexio_read test.db 2040 8 |
164 do_test nan-3.2 { | 164 } {3FE0000000000000} |
165 db eval { | 165 do_test nan-3.2 { |
166 SELECT x, typeof(x) FROM t1 | 166 db eval { |
167 } | 167 SELECT x, typeof(x) FROM t1 |
168 } {0.5 real} | 168 } |
169 do_test nan-3.3 { | 169 } {0.5 real} |
170 db close | 170 do_test nan-3.3 { |
171 hexio_write test.db 2040 FFF8000000000000 | 171 db close |
172 sqlite3 db test.db | 172 hexio_write test.db 2040 FFF8000000000000 |
173 db eval {SELECT x, typeof(x) FROM t1} | 173 sqlite3 db test.db |
174 } {{} null} | 174 db eval {SELECT x, typeof(x) FROM t1} |
175 do_test nan-3.4 { | 175 } {{} null} |
176 db close | 176 do_test nan-3.4 { |
177 hexio_write test.db 2040 7FF8000000000000 | 177 db close |
178 sqlite3 db test.db | 178 hexio_write test.db 2040 7FF8000000000000 |
179 db eval {SELECT x, typeof(x) FROM t1} | 179 sqlite3 db test.db |
180 } {{} null} | 180 db eval {SELECT x, typeof(x) FROM t1} |
181 do_test nan-3.5 { | 181 } {{} null} |
182 db close | 182 do_test nan-3.5 { |
183 hexio_write test.db 2040 FFFFFFFFFFFFFFFF | 183 db close |
184 sqlite3 db test.db | 184 hexio_write test.db 2040 FFFFFFFFFFFFFFFF |
185 db eval {SELECT x, typeof(x) FROM t1} | 185 sqlite3 db test.db |
186 } {{} null} | 186 db eval {SELECT x, typeof(x) FROM t1} |
187 do_test nan-3.6 { | 187 } {{} null} |
188 db close | 188 do_test nan-3.6 { |
189 hexio_write test.db 2040 7FFFFFFFFFFFFFFF | 189 db close |
190 sqlite3 db test.db | 190 hexio_write test.db 2040 7FFFFFFFFFFFFFFF |
191 db eval {SELECT x, typeof(x) FROM t1} | 191 sqlite3 db test.db |
192 } {{} null} | 192 db eval {SELECT x, typeof(x) FROM t1} |
| 193 } {{} null} |
| 194 } |
193 | 195 |
194 # Verify that the sqlite3AtoF routine is able to handle extreme | 196 # Verify that the sqlite3AtoF routine is able to handle extreme |
195 # numbers. | 197 # numbers. |
196 # | 198 # |
197 do_test nan-4.1 { | 199 do_test nan-4.1 { |
198 db eval {DELETE FROM t1} | 200 db eval {DELETE FROM t1} |
199 db eval "INSERT INTO t1 VALUES([string repeat 9 307].0)" | 201 db eval "INSERT INTO t1 VALUES([string repeat 9 307].0)" |
200 db eval {SELECT x, typeof(x) FROM t1} | 202 db eval {SELECT x, typeof(x) FROM t1} |
201 } {1e+307 real} | 203 } {1e+307 real} |
202 do_test nan-4.2 { | 204 do_test nan-4.2 { |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
362 INSERT INTO t1 VALUES('2.5e-2147483650'); | 364 INSERT INTO t1 VALUES('2.5e-2147483650'); |
363 SELECT x, typeof(x) FROM t1; | 365 SELECT x, typeof(x) FROM t1; |
364 } | 366 } |
365 } {0.0 real} | 367 } {0.0 real} |
366 | 368 |
367 | 369 |
368 | 370 |
369 | 371 |
370 | 372 |
371 finish_test | 373 finish_test |
OLD | NEW |