1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-08-07 02:42:48 +03:00

Fix some test scripts so that they work with a minimal build configuration. (CVS 2241)

FossilOrigin-Name: d267fb3ca3f31ee138c9613cb84e873ede7f141a
This commit is contained in:
danielk1977
2005-01-20 02:17:01 +00:00
parent 1bd3644f27
commit 4489f9bdec
11 changed files with 136 additions and 113 deletions

View File

@@ -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.26 2005/01/12 00:08:25 drh Exp $
# $Id: bind.test,v 1.27 2005/01/20 02:17:02 danielk1977 Exp $
#
set testdir [file dirname $argv0]
@@ -494,8 +494,10 @@ catch {sqlite3_finalize $VM}
# Make sure we catch an unterminated "(" in a Tcl-style variable name
#
do_test bind-11.1 {
catchsql {SELECT * FROM sqlite_master WHERE name=$abc(123 and sql NOT NULL;}
} {1 {unrecognized token: "$abc(123"}}
ifcapable tclvar {
do_test bind-11.1 {
catchsql {SELECT * FROM sqlite_master WHERE name=$abc(123 and sql NOT NULL;}
} {1 {unrecognized token: "$abc(123"}}
}
finish_test

View File

@@ -13,7 +13,7 @@
# This file implements tests to make sure SQLite does not crash or
# segfault if it sees a corrupt database file.
#
# $Id: corrupt.test,v 1.3 2005/01/17 07:53:44 danielk1977 Exp $
# $Id: corrupt.test,v 1.4 2005/01/20 02:17:02 danielk1977 Exp $
catch {file delete -force test.db}
catch {file delete -force test.db-journal}
@@ -43,9 +43,9 @@ do_test corrupt-1.1 {
CREATE TABLE t2 AS SELECT * FROM t1;
DELETE FROM t2 WHERE rowid%5!=0;
COMMIT;
PRAGMA integrity_check;
}
} {ok}
} {}
integrity_check corrupt-1.2
# Copy file $from into $to
#

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.31 2005/01/11 16:54:15 drh Exp $
# $Id: func.test,v 1.32 2005/01/20 02:17:02 danielk1977 Exp $
set testdir [file dirname $argv0]
source $testdir/tester.tcl
@@ -248,7 +248,9 @@ do_test func-7.1 {
# Tests for aggregate functions and how they handle NULLs.
#
do_test func-8.1 {
execsql {EXPLAIN SELECT sum(a) FROM t2;}
ifcapable explain {
execsql {EXPLAIN SELECT sum(a) FROM t2;}
}
execsql {
SELECT sum(a), count(a), round(avg(a),2), min(a), max(a), count(*) FROM t2;
}

View File

@@ -11,7 +11,7 @@
# This file implements regression tests for SQLite library. The
# focus of this file is testing the CREATE INDEX statement.
#
# $Id: index2.test,v 1.1 2005/01/11 16:54:15 drh Exp $
# $Id: index2.test,v 1.2 2005/01/20 02:17:02 danielk1977 Exp $
set testdir [file dirname $argv0]
source $testdir/tester.tcl
@@ -65,7 +65,9 @@ do_test index2-2.1 {
execsql $sql
} {}
do_test index2-2.2 {
execsql {EXPLAIN SELECT c9 FROM t1 ORDER BY c1, c2, c3, c4, c5}
ifcapable explain {
execsql {EXPLAIN SELECT c9 FROM t1 ORDER BY c1, c2, c3, c4, c5}
}
execsql {SELECT c9 FROM t1 ORDER BY c1, c2, c3, c4, c5, c6 LIMIT 5}
} {9 10009 20009 30009 40009}

View File

@@ -12,7 +12,7 @@
# focus of this file is testing the LIMIT ... OFFSET ... clause
# of SELECT statements.
#
# $Id: limit.test,v 1.20 2005/01/15 01:52:33 drh Exp $
# $Id: limit.test,v 1.21 2005/01/20 02:17:02 danielk1977 Exp $
set testdir [file dirname $argv0]
source $testdir/tester.tcl
@@ -331,29 +331,31 @@ do_test limit-9.2 {
SELECT * FROM (SELECT * FROM t7 LIMIT 3);
}
} {1 2 3}
do_test limit-9.3 {
execsql {
SELECT * FROM (SELECT * FROM t6 LIMIT 3)
UNION
SELECT * FROM (SELECT * FROM t7 LIMIT 3)
ORDER BY 1
}
} {1 2 3}
do_test limit-9.4 {
execsql {
SELECT * FROM (SELECT * FROM t6 LIMIT 3)
UNION
SELECT * FROM (SELECT * FROM t7 LIMIT 3)
ORDER BY 1
LIMIT 2
}
} {1 2}
do_test limit-9.5 {
catchsql {
SELECT * FROM t6 LIMIT 3
UNION
SELECT * FROM t7 LIMIT 3
}
} {1 {LIMIT clause should come after UNION not before}}
ifcapable compound {
do_test limit-9.3 {
execsql {
SELECT * FROM (SELECT * FROM t6 LIMIT 3)
UNION
SELECT * FROM (SELECT * FROM t7 LIMIT 3)
ORDER BY 1
}
} {1 2 3}
do_test limit-9.4 {
execsql {
SELECT * FROM (SELECT * FROM t6 LIMIT 3)
UNION
SELECT * FROM (SELECT * FROM t7 LIMIT 3)
ORDER BY 1
LIMIT 2
}
} {1 2}
do_test limit-9.5 {
catchsql {
SELECT * FROM t6 LIMIT 3
UNION
SELECT * FROM t7 LIMIT 3
}
} {1 {LIMIT clause should come after UNION not before}}
}
finish_test

View File

@@ -13,7 +13,7 @@
# This file implements tests for miscellanous features that were
# left out of other test files.
#
# $Id: misc2.test,v 1.18 2004/11/22 15:05:59 danielk1977 Exp $
# $Id: misc2.test,v 1.19 2005/01/20 02:17:02 danielk1977 Exp $
set testdir [file dirname $argv0]
source $testdir/tester.tcl
@@ -166,29 +166,33 @@ do_test misc2-7.2 {
} msg]
lappend rc $msg
} {1 {database table is locked}}
do_test misc2-7.3 {
db close
file delete -force test.db
sqlite3 db :memory:
execsql {
CREATE TABLE t1(x);
INSERT INTO t1 VALUES(1);
}
set rc [catch {
db eval {SELECT rowid FROM t1} {} {
db eval "DELETE FROM t1 WHERE rowid=$rowid"
ifcapable memorydb {
do_test misc2-7.3 {
sqlite3 db :memory:
execsql {
CREATE TABLE t1(x);
INSERT INTO t1 VALUES(1);
}
} msg]
lappend rc $msg
} {1 {database table is locked}}
do_test misc2-7.4 {
set rc [catch {
db eval {SELECT rowid FROM t1} {} {
db eval "INSERT INTO t1 VALUES(3)"
}
} msg]
lappend rc $msg
} {1 {database table is locked}}
set rc [catch {
db eval {SELECT rowid FROM t1} {} {
db eval "DELETE FROM t1 WHERE rowid=$rowid"
}
} msg]
lappend rc $msg
} {1 {database table is locked}}
do_test misc2-7.4 {
set rc [catch {
db eval {SELECT rowid FROM t1} {} {
db eval "INSERT INTO t1 VALUES(3)"
}
} msg]
lappend rc $msg
} {1 {database table is locked}}
}
db close
file delete -force test.db
sqlite3 db test.db
# Ticket #453. If the SQL ended with "-", the tokenizer was calling that
# an incomplete token, which caused problem. The solution was to just call

View File

@@ -13,7 +13,7 @@
# This file implements tests for miscellanous features that were
# left out of other test files.
#
# $Id: misc4.test,v 1.11 2005/01/18 17:20:10 drh Exp $
# $Id: misc4.test,v 1.12 2005/01/20 02:17:02 danielk1977 Exp $
set testdir [file dirname $argv0]
source $testdir/tester.tcl
@@ -122,24 +122,26 @@ do_test misc4-4.1 {
# Ticket #1036. When creating tables from a SELECT on a view, use the
# short names of columns.
#
do_test misc4-5.1 {
execsql {
create table t4(a,b);
create table t5(a,c);
insert into t4 values (1,2);
insert into t5 values (1,3);
create view myview as select t4.a a from t4 inner join t5 on t4.a=t5.a;
create table problem as select * from myview;
}
execsql2 {
select * FROM problem;
}
} {a 1}
do_test misc4-5.2 {
execsql2 {
create table t6 as select * from t4, t5;
select * from t6;
}
} {a 1 b 2 a:1 1 c 3}
ifcapable view {
do_test misc4-5.1 {
execsql {
create table t4(a,b);
create table t5(a,c);
insert into t4 values (1,2);
insert into t5 values (1,3);
create view myview as select t4.a a from t4 inner join t5 on t4.a=t5.a;
create table problem as select * from myview;
}
execsql2 {
select * FROM problem;
}
} {a 1}
do_test misc4-5.2 {
execsql2 {
create table t6 as select * from t4, t5;
select * from t6;
}
} {a 1 b 2 a:1 1 c 3}
}
finish_test

View File

@@ -11,7 +11,7 @@
# This file implements regression tests for SQLite library. The
# focus of this script is page cache subsystem.
#
# $Id: pager.test,v 1.21 2005/01/19 03:47:16 danielk1977 Exp $
# $Id: pager.test,v 1.22 2005/01/20 02:17:02 danielk1977 Exp $
set testdir [file dirname $argv0]
@@ -403,22 +403,24 @@ do_test pager-4.6.1 {
} {}
# Test truncate on an in-memory database is Ok.
do_test pager-4.6.2 {
set ::p2 [pager_open :memory: 10]
pager_truncate $::p2 5
} {}
do_test pager-4.6.3 {
for {set i 1} {$i<5} {incr i} {
set p [page_get $::p2 $i]
page_write $p "Page $i"
page_unref $p
pager_commit $::p2
}
pager_truncate $::p2 3
} {}
do_test pager-4.6.4 {
pager_close $::p2
} {}
ifcapable memorydb {
do_test pager-4.6.2 {
set ::p2 [pager_open :memory: 10]
pager_truncate $::p2 5
} {}
do_test pager-4.6.3 {
for {set i 1} {$i<5} {incr i} {
set p [page_get $::p2 $i]
page_write $p "Page $i"
page_unref $p
pager_commit $::p2
}
pager_truncate $::p2 3
} {}
do_test pager-4.6.4 {
pager_close $::p2
} {}
}
do_test pager-4.99 {
pager_close $::p1

View File

@@ -11,11 +11,18 @@
# This file implements regression tests for SQLite library. The
# focus of this file is testing the 'progress callback'.
#
# $Id: progress.test,v 1.4 2004/10/18 21:34:47 drh Exp $
# $Id: progress.test,v 1.5 2005/01/20 02:17:02 danielk1977 Exp $
set testdir [file dirname $argv0]
source $testdir/tester.tcl
# If the progress callback is not available in this build, skip this
# whole file.
ifcapable !progress {
finish_test
return
}
# Build some test data
#
execsql {