mirror of
https://github.com/sqlite/sqlite.git
synced 2025-07-30 19:03:16 +03:00
2.0.3 (CVS 287)
FossilOrigin-Name: 75e90cf09b64ee1fcb39a711fc9ac6d3d2b849a5
This commit is contained in:
@ -11,7 +11,7 @@
|
||||
# This file implements regression tests for SQLite library. The
|
||||
# focus of this file is testing expressions.
|
||||
#
|
||||
# $Id: expr.test,v 1.15 2001/09/16 00:13:28 drh Exp $
|
||||
# $Id: expr.test,v 1.16 2001/10/13 02:59:09 drh Exp $
|
||||
|
||||
set testdir [file dirname $argv0]
|
||||
source $testdir/tester.tcl
|
||||
@ -68,6 +68,11 @@ test_expr expr-1.38 {i1=1} {-i1} {-1}
|
||||
test_expr expr-1.39 {i1=1} {+i1} {1}
|
||||
test_expr expr-1.40 {i1=1, i2=2} {+(i2+i1)} {3}
|
||||
test_expr expr-1.41 {i1=1, i2=2} {-(i2+i1)} {-3}
|
||||
test_expr expr-1.42 {i1=1, i2=2} {i1|i2} {3}
|
||||
test_expr expr-1.43 {i1=1, i2=2} {i1&i2} {0}
|
||||
test_expr expr-1.44 {i1=1} {~i1} {-2}
|
||||
test_expr expr-1.45 {i1=1, i2=3} {i1<<i2} {8}
|
||||
test_expr expr-1.46 {i1=32, i2=3} {i1>>i2} {4}
|
||||
|
||||
test_expr expr-2.1 {r1=1.23, r2=2.34} {r1+r2} 3.57
|
||||
test_expr expr-2.2 {r1=1.23, r2=2.34} {r1-r2} -1.11
|
||||
|
@ -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.4 2001/09/16 00:13:28 drh Exp $
|
||||
# $Id: func.test,v 1.5 2001/10/13 02:59:09 drh Exp $
|
||||
|
||||
set testdir [file dirname $argv0]
|
||||
source $testdir/tester.tcl
|
||||
@ -121,4 +121,44 @@ do_test func-3.10 {
|
||||
|
||||
} ;# End [sqlite -encoding]==UTF-8 and \u1234!=u1234
|
||||
|
||||
# Test the abs() and round() functions.
|
||||
#
|
||||
do_test func-4.1 {
|
||||
execsql {
|
||||
CREATE TABLE t1(a,b,c);
|
||||
INSERT INTO t1 VALUES(1,2,3);
|
||||
INSERT INTO t1 VALUES(2,1.2345678901234,-12345.67890);
|
||||
INSERT INTO t1 VALUES(3,-2,-5);
|
||||
}
|
||||
catchsql {SELECT abs(a,b) FROM t1}
|
||||
} {1 {too many arguments to function abs()}}
|
||||
do_test func-4.2 {
|
||||
catchsql {SELECT abs() FROM t1}
|
||||
} {1 {too few 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}}
|
||||
|
||||
do_test func-4.5 {
|
||||
catchsql {SELECT round(a,b,c) FROM t1}
|
||||
} {1 {too many arguments to function round()}}
|
||||
do_test func-4.6 {
|
||||
catchsql {SELECT round(b,2) FROM t1}
|
||||
} {0 {2.00 1.23 -2.00}}
|
||||
do_test func-4.7 {
|
||||
catchsql {SELECT round(b,0) FROM t1 ORDER BY a}
|
||||
} {0 {2 1 -2}}
|
||||
do_test func-4.8 {
|
||||
catchsql {SELECT round(c) FROM t1 ORDER BY a}
|
||||
} {0 {3 -12346 -5}}
|
||||
do_test func-4.9 {
|
||||
catchsql {SELECT round(c,a) FROM t1 ORDER BY a}
|
||||
} {0 {3.0 -12345.68 -5.000}}
|
||||
do_test func-4.10 {
|
||||
catchsql {SELECT round() FROM t1 ORDER BY a}
|
||||
} {1 {too few arguments to function round()}}
|
||||
|
||||
finish_test
|
||||
|
@ -11,7 +11,7 @@
|
||||
# This file implements regression tests for SQLite library. The
|
||||
# focus of this file is exercising the code in main.c.
|
||||
#
|
||||
# $Id: main.test,v 1.8 2001/09/16 00:13:28 drh Exp $
|
||||
# $Id: main.test,v 1.9 2001/10/13 02:59:09 drh Exp $
|
||||
|
||||
set testdir [file dirname $argv0]
|
||||
source $testdir/tester.tcl
|
||||
@ -98,17 +98,9 @@ do_test main-3.2 {
|
||||
foreach f [glob -nocomplain testdb/*] {file delete -force $f}
|
||||
file delete -force testdb
|
||||
sqlite db testdb
|
||||
set v [catch {execsql {SELECT * from T1 where ~x}} msg]
|
||||
set v [catch {execsql {SELECT * from T1 where @x}} msg]
|
||||
lappend v $msg
|
||||
} {1 {unrecognized token: "~"}}
|
||||
do_test main-3.3 {
|
||||
catch {db close}
|
||||
foreach f [glob -nocomplain testdb/*] {file delete -force $f}
|
||||
file delete -force testdb
|
||||
sqlite db testdb
|
||||
set v [catch {execsql {SELECT a|b from T1 where x}} msg]
|
||||
lappend v $msg
|
||||
} {1 {unrecognized token: "|"}}
|
||||
} {1 {unrecognized token: "@"}}
|
||||
|
||||
do_test main-3.3 {
|
||||
catch {db close}
|
||||
|
Reference in New Issue
Block a user