sqlite/test/tkt3922.test
drh 94c3a2b16f Use caution to avoid integer overflow when doing real to integer affinity
operations.  Ticket #3922. (CVS 6776)

FossilOrigin-Name: 392559465d499f491907ef7f42d37a1a6c699511
2009-06-17 16:20:04 +00:00

61 lines
1.5 KiB
Plaintext

# 2009 June 17
#
# The author disclaims copyright to this source code. In place of
# a legal notice, here is a blessing:
#
# May you do good and not evil.
# May you find forgiveness for yourself and forgive others.
# May you share freely, never taking more than you give.
#
#***********************************************************************
#
# $Id: tkt3922.test,v 1.1 2009/06/17 16:20:04 drh Exp $
set testdir [file dirname $argv0]
source $testdir/tester.tcl
do_test tkt3922.1 {
execsql {
CREATE TABLE t1(a NUMBER);
INSERT INTO t1 VALUES('-9223372036854775808');
SELECT a, typeof(a) FROM t1;
}
} {-9223372036854775808 integer}
do_test tkt3922.2 {
execsql {
DELETE FROM t1;
INSERT INTO t1 VALUES('-9223372036854775809');
SELECT a, typeof(a) FROM t1;
}
} {-9.22337203685478e+18 real}
do_test tkt3922.3 {
execsql {
DELETE FROM t1;
INSERT INTO t1 VALUES('-9223372036854776832');
SELECT a, typeof(a) FROM t1;
}
} {-9.22337203685478e+18 real}
do_test tkt3922.4 {
execsql {
DELETE FROM t1;
INSERT INTO t1 VALUES('-9223372036854776833');
SELECT a, typeof(a) FROM t1;
}
} {-9.22337203685478e+18 real}
do_test tkt3922.5 {
execsql {
DELETE FROM t1;
INSERT INTO t1 VALUES('9223372036854775807');
SELECT a, typeof(a) FROM t1;
}
} {9223372036854775807 integer}
do_test tkt3922.6 {
execsql {
DELETE FROM t1;
INSERT INTO t1 VALUES('9223372036854775808');
SELECT a, typeof(a) FROM t1;
}
} {9.22337203685478e+18 real}
finish_test