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

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

Issue 901033002: Import SQLite 3.8.7.4. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Chromium changes to support SQLite 3.8.7.4. Created 5 years, 10 months 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
OLDNEW
1 # 2005 June 25 1 # 2005 June 25
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 216 matching lines...) Expand 10 before | Expand all | Expand 10 after
227 # ticket #2364. Use full percision integers if possible when casting 227 # ticket #2364. Use full percision integers if possible when casting
228 # to numeric. Do not fallback to real (and the corresponding 48-bit 228 # to numeric. Do not fallback to real (and the corresponding 48-bit
229 # mantissa) unless absolutely necessary. 229 # mantissa) unless absolutely necessary.
230 # 230 #
231 do_test cast-3.1 { 231 do_test cast-3.1 {
232 execsql {SELECT CAST(9223372036854774800 AS integer)} 232 execsql {SELECT CAST(9223372036854774800 AS integer)}
233 } 9223372036854774800 233 } 9223372036854774800
234 do_test cast-3.2 { 234 do_test cast-3.2 {
235 execsql {SELECT CAST(9223372036854774800 AS numeric)} 235 execsql {SELECT CAST(9223372036854774800 AS numeric)}
236 } 9223372036854774800 236 } 9223372036854774800
237 do_test cast-3.3 { 237 do_realnum_test cast-3.3 {
238 execsql {SELECT CAST(9223372036854774800 AS real)} 238 execsql {SELECT CAST(9223372036854774800 AS real)}
239 } 9.22337203685477e+18 239 } 9.22337203685477e+18
240 do_test cast-3.4 { 240 do_test cast-3.4 {
241 execsql {SELECT CAST(CAST(9223372036854774800 AS real) AS integer)} 241 execsql {SELECT CAST(CAST(9223372036854774800 AS real) AS integer)}
242 } 9223372036854774784 242 } 9223372036854774784
243 do_test cast-3.5 { 243 do_test cast-3.5 {
244 execsql {SELECT CAST(-9223372036854774800 AS integer)} 244 execsql {SELECT CAST(-9223372036854774800 AS integer)}
245 } -9223372036854774800 245 } -9223372036854774800
246 do_test cast-3.6 { 246 do_test cast-3.6 {
247 execsql {SELECT CAST(-9223372036854774800 AS numeric)} 247 execsql {SELECT CAST(-9223372036854774800 AS numeric)}
248 } -9223372036854774800 248 } -9223372036854774800
249 do_test cast-3.7 { 249 do_realnum_test cast-3.7 {
250 execsql {SELECT CAST(-9223372036854774800 AS real)} 250 execsql {SELECT CAST(-9223372036854774800 AS real)}
251 } -9.22337203685477e+18 251 } -9.22337203685477e+18
252 do_test cast-3.8 { 252 do_test cast-3.8 {
253 execsql {SELECT CAST(CAST(-9223372036854774800 AS real) AS integer)} 253 execsql {SELECT CAST(CAST(-9223372036854774800 AS real) AS integer)}
254 } -9223372036854774784 254 } -9223372036854774784
255 do_test cast-3.11 { 255 do_test cast-3.11 {
256 execsql {SELECT CAST('9223372036854774800' AS integer)} 256 execsql {SELECT CAST('9223372036854774800' AS integer)}
257 } 9223372036854774800 257 } 9223372036854774800
258 do_test cast-3.12 { 258 do_test cast-3.12 {
259 execsql {SELECT CAST('9223372036854774800' AS numeric)} 259 execsql {SELECT CAST('9223372036854774800' AS numeric)}
260 } 9223372036854774800 260 } 9223372036854774800
261 do_test cast-3.13 { 261 do_realnum_test cast-3.13 {
262 execsql {SELECT CAST('9223372036854774800' AS real)} 262 execsql {SELECT CAST('9223372036854774800' AS real)}
263 } 9.22337203685477e+18 263 } 9.22337203685477e+18
264 ifcapable long_double { 264 ifcapable long_double {
265 do_test cast-3.14 { 265 do_test cast-3.14 {
266 execsql {SELECT CAST(CAST('9223372036854774800' AS real) AS integer)} 266 execsql {SELECT CAST(CAST('9223372036854774800' AS real) AS integer)}
267 } 9223372036854774784 267 } 9223372036854774784
268 } 268 }
269 do_test cast-3.15 { 269 do_test cast-3.15 {
270 execsql {SELECT CAST('-9223372036854774800' AS integer)} 270 execsql {SELECT CAST('-9223372036854774800' AS integer)}
271 } -9223372036854774800 271 } -9223372036854774800
272 do_test cast-3.16 { 272 do_test cast-3.16 {
273 execsql {SELECT CAST('-9223372036854774800' AS numeric)} 273 execsql {SELECT CAST('-9223372036854774800' AS numeric)}
274 } -9223372036854774800 274 } -9223372036854774800
275 do_test cast-3.17 { 275 do_realnum_test cast-3.17 {
276 execsql {SELECT CAST('-9223372036854774800' AS real)} 276 execsql {SELECT CAST('-9223372036854774800' AS real)}
277 } -9.22337203685477e+18 277 } -9.22337203685477e+18
278 ifcapable long_double { 278 ifcapable long_double {
279 do_test cast-3.18 { 279 do_test cast-3.18 {
280 execsql {SELECT CAST(CAST('-9223372036854774800' AS real) AS integer)} 280 execsql {SELECT CAST(CAST('-9223372036854774800' AS real) AS integer)}
281 } -9223372036854774784 281 } -9223372036854774784
282 } 282 }
283 if {[db eval {PRAGMA encoding}]=="UTF-8"} { 283 if {[db eval {PRAGMA encoding}]=="UTF-8"} {
284 do_test cast-3.21 { 284 do_test cast-3.21 {
285 execsql {SELECT CAST(x'39323233333732303336383534373734383030' AS integer)} 285 execsql {SELECT CAST(x'39323233333732303336383534373734383030' AS integer)}
286 } 9223372036854774800 286 } 9223372036854774800
287 do_test cast-3.22 { 287 do_test cast-3.22 {
288 execsql {SELECT CAST(x'39323233333732303336383534373734383030' AS numeric)} 288 execsql {SELECT CAST(x'39323233333732303336383534373734383030' AS numeric)}
289 } 9223372036854774800 289 } 9223372036854774800
290 do_test cast-3.23 { 290 do_realnum_test cast-3.23 {
291 execsql {SELECT CAST(x'39323233333732303336383534373734383030' AS real)} 291 execsql {SELECT CAST(x'39323233333732303336383534373734383030' AS real)}
292 } 9.22337203685477e+18 292 } 9.22337203685477e+18
293 ifcapable long_double { 293 ifcapable long_double {
294 do_test cast-3.24 { 294 do_test cast-3.24 {
295 execsql { 295 execsql {
296 SELECT CAST(CAST(x'39323233333732303336383534373734383030' AS real) 296 SELECT CAST(CAST(x'39323233333732303336383534373734383030' AS real)
297 AS integer) 297 AS integer)
298 } 298 }
299 } 9223372036854774784 299 } 9223372036854774784
300 } 300 }
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
337 SELECT a, CAST(a AS integer), a FROM t1; 337 SELECT a, CAST(a AS integer), a FROM t1;
338 } 338 }
339 } {abc 0 abc} 339 } {abc 0 abc}
340 do_test cast-4.4 { 340 do_test cast-4.4 {
341 db eval { 341 db eval {
342 SELECT CAST(a AS integer), a, CAST(a AS real), a FROM t1; 342 SELECT CAST(a AS integer), a, CAST(a AS real), a FROM t1;
343 } 343 }
344 } {0 abc 0.0 abc} 344 } {0 abc 0.0 abc}
345 345
346 finish_test 346 finish_test
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698