[sql] Import reference version of SQLite 3.7.6.3.
[chromium-blink-merge.git] / third_party / sqlite / sqlite-src-3070603 / test / tkt-8454a207b9.test
blob88a8614f8285a3cb11d1eff637891fa49257cbaa
1 # 2010 September 30
3 # The author disclaims copyright to this source code.  In place of
4 # a legal notice, here is a blessing:
6 #    May you do good and not evil.
7 #    May you find forgiveness for yourself and forgive others.
8 #    May you share freely, never taking more than you give.
10 #***********************************************************************
12 # This file implements regression tests for SQLite library. Specifically,
13 # it tests that ticket [8454a207b9fd2243c4c6b7a73f67ea0315717c1a].  Verify
14 # that a negative default value on an added text column actually comes
15 # out negative.
18 set testdir [file dirname $argv0]
19 source $testdir/tester.tcl
21 do_test tkt-8454a207b9.1 {
22   db eval {
23     CREATE TABLE t1(a);
24     INSERT INTO t1 VALUES(1);
25     ALTER TABLE t1 ADD COLUMN b TEXT DEFAULT -123.0;
26     SELECT b, typeof(b) FROM t1;
27   }
28 } {-123.0 text}
29 do_test tkt-8454a207b9.2 {
30   db eval {
31     ALTER TABLE t1 ADD COLUMN c TEXT DEFAULT -123.5;
32     SELECT c, typeof(c) FROM t1;
33   }
34 } {-123.5 text}
35 do_test tkt-8454a207b9.3 {
36   db eval {
37     ALTER TABLE t1 ADD COLUMN d TEXT DEFAULT -'hello';
38     SELECT d, typeof(d) FROM t1;
39   }
40 } {0 text}
41 do_test tkt-8454a207b9.4 {
42   db eval {
43     ALTER TABLE t1 ADD COLUMN e DEFAULT -123.0;
44     SELECT e, typeof(e) FROM t1;
45   }
46 } {-123 integer}
47 do_test tkt-8454a207b9.5 {
48   db eval {
49     ALTER TABLE t1 ADD COLUMN f DEFAULT -123.5;
50     SELECT f, typeof(f) FROM t1;
51   }
52 } {-123.5 real}
53 do_test tkt-8454a207b9.6 {
54   db eval {
55     ALTER TABLE t1 ADD COLUMN g DEFAULT -9223372036854775808;
56     SELECT g, typeof(g) FROM t1;
57   }
58 } {-9223372036854775808 integer}
59 do_test tkt-8454a207b9.7 {
60   db eval {
61     ALTER TABLE t1 ADD COLUMN h DEFAULT 9223372036854775807;
62     SELECT h, typeof(h) FROM t1;
63   }
64 } {9223372036854775807 integer}
67 finish_test