Added additional tests. No new errors found. (CVS 653)
FossilOrigin-Name: 8924a7f5bab790ab552332d6359028d0d1825e4a
This commit is contained in:
parent
a9f9d1c08b
commit
6cbe1f1bc4
16
manifest
16
manifest
@ -1,5 +1,5 @@
|
||||
C Add\sa\sfew\smore\stests\sand\sfix\sa\sfew\sbugs\sthat\sthe\stests\suncovered.\s(CVS\s652)
|
||||
D 2002-06-29T02:20:08
|
||||
C Added\sadditional\stests.\s\sNo\snew\serrors\sfound.\s(CVS\s653)
|
||||
D 2002-07-01T00:31:36
|
||||
F Makefile.in 6291a33b87d2a395aafd7646ee1ed562c6f2c28c
|
||||
F Makefile.template 4e11752e0b5c7a043ca50af4296ec562857ba495
|
||||
F README a4c0ba11354ef6ba0776b400d057c59da47a4cc0
|
||||
@ -44,7 +44,7 @@ F src/sqlite.h.in 75c5bbb066d0faf34424b7d1babf8b44d5b31af2
|
||||
F src/sqliteInt.h 314a4feb08cccdeb90b434e6dde86b93d2f36b8e
|
||||
F src/table.c eed2098c9b577aa17f8abe89313a9c4413f57d63
|
||||
F src/tclsqlite.c e932591c0bb522b0a35ea7dc861c623ccb2e3aa8
|
||||
F src/test1.c 29ed719d8ce890733fbeadb53cacc4e542d423ed
|
||||
F src/test1.c a2f2b6b1df07d4e8b380323896c3ed34442cea91
|
||||
F src/test2.c 669cc22781c6461a273416ec1a7414d25c081730
|
||||
F src/test3.c 72ac6a9017a70e542954907a1dfd87ab6f7824e3
|
||||
F src/threadtest.c 81f0598e0f031c1bd506af337fdc1b7e8dff263f
|
||||
@ -64,8 +64,8 @@ F test/conflict.test 4518cc3c1c40c4ba74220d9ee814257ae7d09c47
|
||||
F test/copy.test 92e21ebea11319c3f70448d3763fdaa0e2f1c21f
|
||||
F test/delete.test c904a62129fe102b314a96111a8417f10249e4d8
|
||||
F test/expr.test 5fadd0bc87c223b424ce6752b576c1df346abf1f
|
||||
F test/func.test 7e5500c9db4b02fd62f9737931a6ada01e3b55d0
|
||||
F test/in.test c09312672e3f0709fa02c8e2e9cd8fb4bd6269aa
|
||||
F test/func.test cae5f27e09736cfdcc978c3719ac1345405b848c
|
||||
F test/in.test e59461f1702b7387880bf08a0ce6bb777925d282
|
||||
F test/index.test c8a471243bbf878974b99baf5badd59407237cf3
|
||||
F test/insert.test a122afb86911e77c181d912348866a5b1a61eeab
|
||||
F test/insert2.test c288375a64dad3295044714f0dfed4a193cf067f
|
||||
@ -137,7 +137,7 @@ F www/speed.tcl da8afcc1d3ccc5696cfb388a68982bc3d9f7f00f
|
||||
F www/sqlite.tcl ae3dcfb077e53833b59d4fcc94d8a12c50a44098
|
||||
F www/tclsqlite.tcl 1db15abeb446aad0caf0b95b8b9579720e4ea331
|
||||
F www/vdbe.tcl 2013852c27a02a091d39a766bc87cff329f21218
|
||||
P 96515b813eb57e1f48c28d357d1f38639b2fdcfa
|
||||
R c1f2449afe59030f9bd638b2fb549a9b
|
||||
P 91c0db66c86facb21b5b522afadd83d91a488256
|
||||
R 7d04cf3eef7b325f91f0693158023bcb
|
||||
U drh
|
||||
Z e559f098ea075de4e2b198f365f605ef
|
||||
Z e9235d5a107811a531de8a11c88a7168
|
||||
|
@ -1 +1 @@
|
||||
91c0db66c86facb21b5b522afadd83d91a488256
|
||||
8924a7f5bab790ab552332d6359028d0d1825e4a
|
60
src/test1.c
60
src/test1.c
@ -13,7 +13,7 @@
|
||||
** is not included in the SQLite library. It is used for automated
|
||||
** testing of the SQLite library.
|
||||
**
|
||||
** $Id: test1.c,v 1.10 2002/06/26 20:06:06 drh Exp $
|
||||
** $Id: test1.c,v 1.11 2002/07/01 00:31:36 drh Exp $
|
||||
*/
|
||||
#include "sqliteInt.h"
|
||||
#include "tcl.h"
|
||||
@ -214,7 +214,7 @@ static void ifnullFunc(sqlite_func *context, int argc, const char **argv){
|
||||
/*
|
||||
** Implementation of the x_sqlite_exec() function. This function takes
|
||||
** a single argument and attempts to execute that argument as SQL code.
|
||||
** This is illegal and shut set the SQLITE_MISUSE flag on the database.
|
||||
** This is illegal and should set the SQLITE_MISUSE flag on the database.
|
||||
**
|
||||
** This routine simulates the effect of having two threads attempt to
|
||||
** use the same database at the same time.
|
||||
@ -452,6 +452,60 @@ static int sqlite_abort(
|
||||
return TCL_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
** The following routine is a user-defined SQL function whose purpose
|
||||
** is to test the sqlite_set_result() API.
|
||||
*/
|
||||
static void testFunc(sqlite_func *context, int argc, const char **argv){
|
||||
while( argc>=2 ){
|
||||
if( argv[0]==0 ){
|
||||
sqlite_set_result_error(context, "first argument to test function "
|
||||
"may not be NULL", -1);
|
||||
}else if( sqliteStrICmp(argv[0],"string")==0 ){
|
||||
sqlite_set_result_string(context, argv[1], -1);
|
||||
}else if( argv[1]==0 ){
|
||||
sqlite_set_result_error(context, "2nd argument may not be NULL if the "
|
||||
"first argument is not \"string\"", -1);
|
||||
}else if( sqliteStrICmp(argv[0],"int")==0 ){
|
||||
sqlite_set_result_int(context, atoi(argv[1]));
|
||||
}else if( sqliteStrICmp(argv[0],"double")==0 ){
|
||||
sqlite_set_result_double(context, atof(argv[1]));
|
||||
}else{
|
||||
sqlite_set_result_error(context,"first argument should be one of: "
|
||||
"string int double", -1);
|
||||
}
|
||||
argc -= 2;
|
||||
argv += 2;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
** Usage: sqlite_register_test_function DB NAME
|
||||
**
|
||||
** Register the test SQL function on the database DB under the name NAME.
|
||||
*/
|
||||
static int sqlite_register_test_function(
|
||||
void *NotUsed,
|
||||
Tcl_Interp *interp, /* The TCL interpreter that invoked this command */
|
||||
int argc, /* Number of arguments */
|
||||
char **argv /* Text of each argument */
|
||||
){
|
||||
sqlite *db;
|
||||
int rc;
|
||||
if( argc!=3 ){
|
||||
Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0],
|
||||
" DB FUNCTION-NAME", 0);
|
||||
return TCL_ERROR;
|
||||
}
|
||||
db = (sqlite*)strtol(argv[1], 0, 0);
|
||||
rc = sqlite_create_function(db, argv[2], -1, testFunc, 0);
|
||||
if( rc!=0 ){
|
||||
Tcl_AppendResult(interp, sqlite_error_string(rc), 0);
|
||||
return TCL_ERROR;
|
||||
}
|
||||
return TCL_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
** Register commands with the TCL interpreter.
|
||||
*/
|
||||
@ -470,6 +524,8 @@ int Sqlitetest1_Init(Tcl_Interp *interp){
|
||||
sqlite_test_create_function, 0, 0);
|
||||
Tcl_CreateCommand(interp, "sqlite_create_aggregate",
|
||||
sqlite_test_create_aggregate, 0, 0);
|
||||
Tcl_CreateCommand(interp, "sqlite_register_test_function",
|
||||
sqlite_register_test_function, 0, 0);
|
||||
Tcl_LinkVar(interp, "sqlite_search_count",
|
||||
(char*)&sqlite_search_count, TCL_LINK_INT);
|
||||
#ifdef MEMORY_DEBUG
|
||||
|
@ -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.13 2002/06/29 02:20:09 drh Exp $
|
||||
# $Id: func.test,v 1.14 2002/07/01 00:31:36 drh Exp $
|
||||
|
||||
set testdir [file dirname $argv0]
|
||||
source $testdir/tester.tcl
|
||||
@ -273,4 +273,60 @@ do_test func-9.1 {
|
||||
}
|
||||
} {1}
|
||||
|
||||
# Use the "sqlite_register_test_function" TCL command which is part of
|
||||
# the text fixture in order to verify correct operation of some of
|
||||
# the user-defined SQL function APIs that are not used by the built-in
|
||||
# functions.
|
||||
#
|
||||
db close
|
||||
set ::DB [sqlite db test.db]
|
||||
sqlite_register_test_function $::DB testfunc
|
||||
do_test func-10.1 {
|
||||
catchsql {
|
||||
SELECT testfunc(NULL,NULL);
|
||||
}
|
||||
} {1 {first argument to test function may not be NULL}}
|
||||
do_test func-10.2 {
|
||||
execsql {
|
||||
SELECT testfunc(
|
||||
'string', 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ',
|
||||
'int', 1234
|
||||
);
|
||||
}
|
||||
} {1234}
|
||||
do_test func-10.3 {
|
||||
execsql {
|
||||
SELECT testfunc(
|
||||
'string', 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ',
|
||||
'string', NULL
|
||||
);
|
||||
}
|
||||
} {{}}
|
||||
do_test func-10.4 {
|
||||
execsql {
|
||||
SELECT testfunc(
|
||||
'string', 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ',
|
||||
'double', 1.234
|
||||
);
|
||||
}
|
||||
} {1.234}
|
||||
do_test func-10.5 {
|
||||
execsql {
|
||||
SELECT testfunc(
|
||||
'string', 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ',
|
||||
'int', 1234,
|
||||
'string', 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ',
|
||||
'string', NULL,
|
||||
'string', 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ',
|
||||
'double', 1.234,
|
||||
'string', 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ',
|
||||
'int', 1234,
|
||||
'string', 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ',
|
||||
'string', NULL,
|
||||
'string', 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ',
|
||||
'double', 1.234
|
||||
);
|
||||
}
|
||||
} {1.234}
|
||||
|
||||
finish_test
|
||||
|
19
test/in.test
19
test/in.test
@ -11,7 +11,7 @@
|
||||
# This file implements regression tests for SQLite library. The
|
||||
# focus of this file is testing the IN and BETWEEN operator.
|
||||
#
|
||||
# $Id: in.test,v 1.6 2002/01/28 15:53:05 drh Exp $
|
||||
# $Id: in.test,v 1.7 2002/07/01 00:31:36 drh Exp $
|
||||
|
||||
set testdir [file dirname $argv0]
|
||||
source $testdir/tester.tcl
|
||||
@ -167,7 +167,9 @@ do_test in-6.1 {
|
||||
INSERT INTO ta VALUES(4,4);
|
||||
INSERT INTO ta VALUES(6,6);
|
||||
INSERT INTO ta VALUES(8,8);
|
||||
SELECT * FROM ta;
|
||||
INSERT INTO ta VALUES(10,
|
||||
'This is a key that is long enough to require a malloc in the VDBE');
|
||||
SELECT * FROM ta WHERE a<10;
|
||||
}
|
||||
} {1 1 2 2 3 3 4 4 6 6 8 8}
|
||||
do_test in-6.2 {
|
||||
@ -179,7 +181,9 @@ do_test in-6.2 {
|
||||
INSERT INTO tb VALUES(5,5);
|
||||
INSERT INTO tb VALUES(7,7);
|
||||
INSERT INTO tb VALUES(9,9);
|
||||
SELECT * FROM tb;
|
||||
INSERT INTO tb VALUES(11,
|
||||
'This is a key that is long enough to require a malloc in the VDBE');
|
||||
SELECT * FROM tb WHERE a<10;
|
||||
}
|
||||
} {1 1 2 2 3 3 5 5 7 7 9 9}
|
||||
do_test in-6.3 {
|
||||
@ -191,12 +195,12 @@ do_test in-6.4 {
|
||||
execsql {
|
||||
SELECT a FROM ta WHERE b NOT IN (SELECT a FROM tb);
|
||||
}
|
||||
} {4 6 8}
|
||||
} {4 6 8 10}
|
||||
do_test in-6.5 {
|
||||
execsql {
|
||||
SELECT a FROM ta WHERE b IN (SELECT b FROM tb);
|
||||
}
|
||||
} {1 2 3}
|
||||
} {1 2 3 10}
|
||||
do_test in-6.6 {
|
||||
execsql {
|
||||
SELECT a FROM ta WHERE b NOT IN (SELECT b FROM tb);
|
||||
@ -211,7 +215,7 @@ do_test in-6.8 {
|
||||
execsql {
|
||||
SELECT a FROM ta WHERE a NOT IN (SELECT a FROM tb);
|
||||
}
|
||||
} {4 6 8}
|
||||
} {4 6 8 10}
|
||||
do_test in-6.9 {
|
||||
execsql {
|
||||
SELECT a FROM ta WHERE a IN (SELECT b FROM tb);
|
||||
@ -221,7 +225,6 @@ do_test in-6.10 {
|
||||
execsql {
|
||||
SELECT a FROM ta WHERE a NOT IN (SELECT b FROM tb);
|
||||
}
|
||||
} {4 6 8}
|
||||
|
||||
} {4 6 8 10}
|
||||
|
||||
finish_test
|
||||
|
Loading…
Reference in New Issue
Block a user