mirror of
https://github.com/sqlite/sqlite.git
synced 2025-07-29 08:01:23 +03:00
Update the typeof() operator to respect manifest types. (CVS 1450)
FossilOrigin-Name: 162cf42e33691f4c9ec3a25abcaa2bdcdca2b5e0
This commit is contained in:
@ -11,7 +11,7 @@
|
||||
# This file implements regression tests for SQLite library. The
|
||||
# focus of this script testing the sqlite_bind API.
|
||||
#
|
||||
# $Id: bind.test,v 1.6 2004/05/21 10:08:55 danielk1977 Exp $
|
||||
# $Id: bind.test,v 1.7 2004/05/24 12:55:55 danielk1977 Exp $
|
||||
#
|
||||
|
||||
set testdir [file dirname $argv0]
|
||||
@ -92,8 +92,8 @@ do_test bind-2.3 {
|
||||
execsql {SELECT rowid, * FROM t1}
|
||||
} {1 123 456 789 2 123 -2000000000 2000000000}
|
||||
do_test bind-2.4 {
|
||||
execsql {SELECT classof(a), classof(b), classof(c) FROM t1}
|
||||
} {INTEGER INTEGER INTEGER INTEGER INTEGER INTEGER}
|
||||
execsql {SELECT typeof(a), typeof(b), typeof(c) FROM t1}
|
||||
} {integer integer integer integer integer integer}
|
||||
do_test bind-2.5 {
|
||||
execsql {
|
||||
DELETE FROM t1;
|
||||
@ -110,8 +110,8 @@ do_test bind-3.1 {
|
||||
execsql {SELECT rowid, * FROM t1}
|
||||
} {1 32 -2000000000000 2000000000000}
|
||||
do_test bind-3.2 {
|
||||
execsql {SELECT classof(a), classof(b), classof(c) FROM t1}
|
||||
} {INTEGER INTEGER INTEGER}
|
||||
execsql {SELECT typeof(a), typeof(b), typeof(c) FROM t1}
|
||||
} {integer integer integer}
|
||||
do_test bind-3.3 {
|
||||
execsql {
|
||||
DELETE FROM t1;
|
||||
@ -128,8 +128,8 @@ do_test bind-4.1 {
|
||||
execsql {SELECT rowid, * FROM t1}
|
||||
} {1 1234.1234 1e-05 123456789}
|
||||
do_test bind-4.2 {
|
||||
execsql {SELECT classof(a), classof(b), classof(c) FROM t1}
|
||||
} {REAL REAL REAL}
|
||||
execsql {SELECT typeof(a), typeof(b), typeof(c) FROM t1}
|
||||
} {real real real}
|
||||
do_test bind-4.3 {
|
||||
execsql {
|
||||
DELETE FROM t1;
|
||||
@ -146,8 +146,8 @@ do_test bind-5.1 {
|
||||
execsql {SELECT rowid, * FROM t1}
|
||||
} {1 {} {} {}}
|
||||
do_test bind-5.2 {
|
||||
execsql {SELECT classof(a), classof(b), classof(c) FROM t1}
|
||||
} {NULL NULL NULL}
|
||||
execsql {SELECT typeof(a), typeof(b), typeof(c) FROM t1}
|
||||
} {null null null}
|
||||
do_test bind-5.3 {
|
||||
execsql {
|
||||
DELETE FROM t1;
|
||||
@ -164,8 +164,8 @@ do_test bind-6.1 {
|
||||
execsql {SELECT rowid, * FROM t1}
|
||||
} {1 hello . world}
|
||||
do_test bind-6.2 {
|
||||
execsql {SELECT classof(a), classof(b), classof(c) FROM t1}
|
||||
} {TEXT TEXT TEXT}
|
||||
execsql {SELECT typeof(a), typeof(b), typeof(c) FROM t1}
|
||||
} {text text text}
|
||||
do_test bind-6.3 {
|
||||
execsql {
|
||||
DELETE FROM t1;
|
||||
@ -182,8 +182,8 @@ do_test bind-7.1 {
|
||||
execsql {SELECT rowid, * FROM t1}
|
||||
} {1 hello {} world}
|
||||
do_test bind-7.2 {
|
||||
execsql {SELECT classof(a), classof(b), classof(c) FROM t1}
|
||||
} {TEXT TEXT TEXT}
|
||||
execsql {SELECT typeof(a), typeof(b), typeof(c) FROM t1}
|
||||
} {text text text}
|
||||
do_test bind-7.3 {
|
||||
execsql {
|
||||
DELETE FROM t1;
|
||||
|
@ -11,7 +11,7 @@
|
||||
# This file implements regression tests for SQLite library. The
|
||||
# focus of this file is testing the CREATE TABLE statement.
|
||||
#
|
||||
# $Id: table.test,v 1.23 2004/05/19 21:09:32 drh Exp $
|
||||
# $Id: table.test,v 1.24 2004/05/24 12:55:55 danielk1977 Exp $
|
||||
|
||||
set testdir [file dirname $argv0]
|
||||
source $testdir/tester.tcl
|
||||
@ -473,7 +473,8 @@ do_test table-10.13 {
|
||||
} {1 {unknown column "x" in foreign key definition}}
|
||||
|
||||
|
||||
# Test for the "typeof" function.
|
||||
# Test for the "typeof" function. More tests for the
|
||||
# typeof() function are found in bind.test and types.test.
|
||||
#
|
||||
do_test table-11.1 {
|
||||
execsql {
|
||||
@ -492,12 +493,12 @@ do_test table-11.1 {
|
||||
typeof(e), typeof(f), typeof(g), typeof(h)
|
||||
FROM t7 LIMIT 1;
|
||||
}
|
||||
} {numeric numeric text text text numeric text numeric}
|
||||
} {integer null null null null null null null}
|
||||
do_test table-11.2 {
|
||||
execsql {
|
||||
SELECT typeof(a+b), typeof(a||b), typeof(c+d), typeof(c||d)
|
||||
FROM t7 LIMIT 1;
|
||||
}
|
||||
} {numeric text numeric text}
|
||||
} {null null null null}
|
||||
|
||||
finish_test
|
||||
|
@ -12,7 +12,7 @@
|
||||
# it tests that the different storage classes (integer, real, text etc.)
|
||||
# all work correctly.
|
||||
#
|
||||
# $Id: types.test,v 1.5 2004/05/20 12:41:20 drh Exp $
|
||||
# $Id: types.test,v 1.6 2004/05/24 12:55:55 danielk1977 Exp $
|
||||
|
||||
set testdir [file dirname $argv0]
|
||||
source $testdir/tester.tcl
|
||||
@ -52,14 +52,14 @@ do_test types-1.1.0 {
|
||||
# literal were inserted into a column with affinity INTEGER, NUMERIC, TEXT
|
||||
# or NONE, respectively.
|
||||
set values {
|
||||
{ 5.0 INTEGER REAL TEXT REAL }
|
||||
{ 5 INTEGER INTEGER TEXT INTEGER }
|
||||
{ '5.0' INTEGER REAL TEXT TEXT }
|
||||
{ '-5.0' INTEGER REAL TEXT TEXT }
|
||||
{ '-5.0' INTEGER REAL TEXT TEXT }
|
||||
{ '5' INTEGER INTEGER TEXT TEXT }
|
||||
{ 'abc' TEXT TEXT TEXT TEXT }
|
||||
{ NULL NULL NULL NULL NULL }
|
||||
{ 5.0 integer real text real }
|
||||
{ 5 integer integer text integer }
|
||||
{ '5.0' integer real text text }
|
||||
{ '-5.0' integer real text text }
|
||||
{ '-5.0' integer real text text }
|
||||
{ '5' integer integer text text }
|
||||
{ 'abc' text text text text }
|
||||
{ NULL null null null null }
|
||||
}
|
||||
|
||||
# This code tests that the storage classes specified above (in the $values
|
||||
@ -75,7 +75,7 @@ foreach val $values {
|
||||
execsql "INSERT INTO t1 VALUES($lit, $lit, $lit, $lit);"
|
||||
do_test types-1.1.$tnum {
|
||||
execsql {
|
||||
SELECT classof(i), classof(n), classof(t), classof(o) FROM t1;
|
||||
SELECT typeof(i), typeof(n), typeof(t), typeof(o) FROM t1;
|
||||
}
|
||||
} [lrange $val 1 end]
|
||||
incr tnum
|
||||
@ -94,7 +94,7 @@ foreach val $values {
|
||||
execsql "INSERT INTO t1 SELECT $lit, $lit, $lit, $lit;"
|
||||
do_test types-1.2.$tnum {
|
||||
execsql {
|
||||
SELECT classof(i), classof(n), classof(t), classof(o) FROM t1;
|
||||
SELECT typeof(i), typeof(n), typeof(t), typeof(o) FROM t1;
|
||||
}
|
||||
} [lrange $val 1 end]
|
||||
incr tnum
|
||||
@ -112,7 +112,7 @@ foreach val $values {
|
||||
execsql "UPDATE t1 SET i = $lit, n = $lit, t = $lit, o = $lit;"
|
||||
do_test types-1.3.$tnum {
|
||||
execsql {
|
||||
SELECT classof(i), classof(n), classof(t), classof(o) FROM t1;
|
||||
SELECT typeof(i), typeof(n), typeof(t), typeof(o) FROM t1;
|
||||
}
|
||||
} [lrange $val 1 end]
|
||||
incr tnum
|
||||
|
Reference in New Issue
Block a user