1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-07-30 19:03:16 +03:00

The new function code passes regression tests. (CVS 403)

FossilOrigin-Name: b00cf110b1cc671b7200a5ce8b9e704f660763c9
This commit is contained in:
drh
2002-02-28 03:04:48 +00:00
parent f55f25f02f
commit 89425d5e02
7 changed files with 44 additions and 42 deletions

View File

@ -11,7 +11,7 @@
# This file implements regression tests for SQLite library. The
# focus of this file is testing built-in functions.
#
# $Id: func.test,v 1.7 2001/12/22 14:49:26 drh Exp $
# $Id: func.test,v 1.8 2002/02/28 03:04:48 drh Exp $
set testdir [file dirname $argv0]
source $testdir/tester.tcl
@ -34,11 +34,11 @@ do_test func-1.0 {
do_test func-1.1 {
set r [catch {execsql {SELECT length(*) FROM tbl1 ORDER BY t1}} msg]
lappend r $msg
} {1 {too few arguments to function length()}}
} {1 {wrong number of arguments to function length()}}
do_test func-1.2 {
set r [catch {execsql {SELECT length(t1,5) FROM tbl1 ORDER BY t1}} msg]
lappend r $msg
} {1 {too many arguments to function length()}}
} {1 {wrong number of arguments to function length()}}
do_test func-1.3 {
execsql {SELECT length(t1), count(*) FROM tbl1 GROUP BY length(t1)
ORDER BY length(t1)}
@ -131,20 +131,20 @@ do_test func-4.1 {
INSERT INTO t1 VALUES(3,-2,-5);
}
catchsql {SELECT abs(a,b) FROM t1}
} {1 {too many arguments to function abs()}}
} {1 {wrong number of arguments to function abs()}}
do_test func-4.2 {
catchsql {SELECT abs() FROM t1}
} {1 {too few arguments to function abs()}}
} {1 {wrong number of arguments to function abs()}}
do_test func-4.3 {
catchsql {SELECT abs(b) FROM t1 ORDER BY a}
} {0 {2 1.2345678901234 2}}
do_test func-4.4 {
catchsql {SELECT abs(c) FROM t1 ORDER BY a}
} {0 {3 12345.6789 5}}
} {0 {3 12345.67890 5}}
do_test func-4.5 {
catchsql {SELECT round(a,b,c) FROM t1}
} {1 {too many arguments to function round()}}
} {1 {wrong number of arguments to function round()}}
do_test func-4.6 {
catchsql {SELECT round(b,2) FROM t1 ORDER BY b}
} {0 {-2.00 1.23 2.00}}
@ -162,6 +162,6 @@ do_test func-4.10 {
} {0 {x3.0y x-12345.68y x-5.000y}}
do_test func-4.11 {
catchsql {SELECT round() FROM t1 ORDER BY a}
} {1 {too few arguments to function round()}}
} {1 {wrong number of arguments to function round()}}
finish_test

View File

@ -11,7 +11,7 @@
# This file implements regression tests for SQLite library. The
# focus of this file is testing the SELECT statement.
#
# $Id: select1.test,v 1.19 2002/02/23 23:45:47 drh Exp $
# $Id: select1.test,v 1.20 2002/02/28 03:04:48 drh Exp $
set testdir [file dirname $argv0]
source $testdir/tester.tcl
@ -107,7 +107,7 @@ execsql {INSERT INTO test1 VALUES(33,44)}
do_test select1-2.1 {
set v [catch {execsql {SELECT count(f1,f2) FROM test1}} msg]
lappend v $msg
} {1 {too many arguments to function count()}}
} {1 {wrong number of arguments to function count()}}
do_test select1-2.2 {
set v [catch {execsql {SELECT count(f1) FROM test1}} msg]
lappend v $msg
@ -127,7 +127,7 @@ do_test select1-2.5 {
do_test select1-2.6 {
set v [catch {execsql {SELECT min(*) FROM test1}} msg]
lappend v $msg
} {1 {too few arguments to function min()}}
} {0 {{} {}}}
do_test select1-2.7 {
set v [catch {execsql {SELECT Min(f1) FROM test1}} msg]
lappend v $msg
@ -139,7 +139,7 @@ do_test select1-2.8 {
do_test select1-2.9 {
set v [catch {execsql {SELECT MAX(*) FROM test1}} msg]
lappend v $msg
} {1 {too few arguments to function MAX()}}
} {0 {{} {}}}
do_test select1-2.10 {
set v [catch {execsql {SELECT Max(f1) FROM test1}} msg]
lappend v $msg
@ -159,7 +159,7 @@ do_test select1-2.13 {
do_test select1-2.14 {
set v [catch {execsql {SELECT SUM(*) FROM test1}} msg]
lappend v $msg
} {1 {too few arguments to function SUM()}}
} {1 {wrong number of arguments to function SUM()}}
do_test select1-2.15 {
set v [catch {execsql {SELECT Sum(f1) FROM test1}} msg]
lappend v $msg
@ -167,7 +167,7 @@ do_test select1-2.15 {
do_test select1-2.16 {
set v [catch {execsql {SELECT sum(f1,f2) FROM test1}} msg]
lappend v $msg
} {1 {too many arguments to function sum()}}
} {1 {wrong number of arguments to function sum()}}
do_test select1-2.17 {
set v [catch {execsql {SELECT SUM(f1)+1 FROM test1}} msg]
lappend v $msg
@ -222,7 +222,7 @@ do_test select1-3.8 {
do_test select1-3.9 {
set v [catch {execsql {SELECT f1 FROM test1 WHERE count(f1,f2)!=11}} msg]
lappend v $msg
} {1 {misuse of aggregate function count()}}
} {1 {wrong number of arguments to function count()}}
# ORDER BY expressions
#
@ -432,7 +432,7 @@ do_test select1-8.4 {
SELECT f1/(f1-11), min(f1/(f1-11),5), max(f1/(f1-33),6)
FROM test1 ORDER BY f1
}
} {{} 5 6 1.5 1.5 6}
} {{} {} 6 1.5 1.5 6}
do_test select1-8.5 {
execsql {
SELECT min(1,2,3), -max(1,2,3)