0
0
mirror of https://github.com/sqlite/sqlite.git synced 2024-11-25 08:59:33 +01:00
sqlite/test/tkt-8454a207b9.test

74 lines
1.8 KiB
Plaintext

# 2010 September 30
#
# 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.
#
#***********************************************************************
#
# This file implements regression tests for SQLite library. Specifically,
# it tests that ticket [8454a207b9fd2243c4c6b7a73f67ea0315717c1a]. Verify
# that a negative default value on an added text column actually comes
# out negative.
#
set testdir [file dirname $argv0]
source $testdir/tester.tcl
# If SQLITE_OMIT_ALTERTABLE is defined, omit this file.
ifcapable !altertable {
finish_test
return
}
do_test tkt-8454a207b9.1 {
db eval {
CREATE TABLE t1(a);
INSERT INTO t1 VALUES(1);
ALTER TABLE t1 ADD COLUMN b TEXT DEFAULT -123.0;
SELECT b, typeof(b) FROM t1;
}
} {-123.0 text}
do_test tkt-8454a207b9.2 {
db eval {
ALTER TABLE t1 ADD COLUMN c TEXT DEFAULT -123.5;
SELECT c, typeof(c) FROM t1;
}
} {-123.5 text}
do_test tkt-8454a207b9.3 {
db eval {
ALTER TABLE t1 ADD COLUMN d TEXT DEFAULT -'hello';
SELECT d, typeof(d) FROM t1;
}
} {0 text}
do_test tkt-8454a207b9.4 {
db eval {
ALTER TABLE t1 ADD COLUMN e DEFAULT -123.0;
SELECT e, typeof(e) FROM t1;
}
} {-123.0 real}
do_test tkt-8454a207b9.5 {
db eval {
ALTER TABLE t1 ADD COLUMN f DEFAULT -123.5;
SELECT f, typeof(f) FROM t1;
}
} {-123.5 real}
do_test tkt-8454a207b9.6 {
db eval {
ALTER TABLE t1 ADD COLUMN g DEFAULT -9223372036854775808;
SELECT g, typeof(g) FROM t1;
}
} {-9223372036854775808 integer}
do_test tkt-8454a207b9.7 {
db eval {
ALTER TABLE t1 ADD COLUMN h DEFAULT 9223372036854775807;
SELECT h, typeof(h) FROM t1;
}
} {9223372036854775807 integer}
finish_test