From d400728ac1178351833bced6a24c06f3d0c0781f Mon Sep 17 00:00:00 2001
From: drh
Date: Thu, 12 Apr 2001 23:21:58 +0000
Subject: [PATCH] More testing (CVS 209)
FossilOrigin-Name: 3bde128418fe70a2fd62bf9e013999827a16053c
---
manifest | 22 ++++++-------
manifest.uuid | 2 +-
test/all.test | 12 +++----
test/malloc.test | 33 +++++++++++++++++--
test/select1.test | 81 ++++++++++++++++++++++++++++++++++++++++++++++-
test/table.test | 12 ++++---
test/trans.test | 73 +++++++++++++++++++++++++++++++++++++++++-
www/changes.tcl | 2 +-
8 files changed, 208 insertions(+), 29 deletions(-)
diff --git a/manifest b/manifest
index 15b32bc7e9..ab13f54838 100644
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C :-)\s(CVS\s208)
-D 2001-04-11T14:29:22
+C More\stesting\s(CVS\s209)
+D 2001-04-12T23:21:59
F COPYRIGHT 74a8a6531a42e124df07ab5599aad63870fa0bd4
F Makefile.in 4775f7fd1ed543606bb24fa3fada1bc90a23a6b9
F README 51f6a4e7408b34afa5bc1c0485f61b6a4efb6958
@@ -45,7 +45,7 @@ F src/util.c 1b396ac34e30dd6222d82e996c17b161bbc906bc
F src/vdbe.c ee5a6ab95c8c84497f6685ebde153da6fb06e825
F src/vdbe.h dc1205da434c6a9da03b5d6b089270bbc8e6d437
F src/where.c 0c542fc44bd85152dfb8507862cfe2e60c629e9f
-F test/all.test 4ba0807feec7f29bf90c4f0ffd10b3801634461d
+F test/all.test 21d55a97e39e7ec5776751dc9dd8b1b51ef4a048
F test/copy.test b77a1214bd7756f2849d5c4fa6e715c0ff0c34eb
F test/dbbe.test a022fe2d983848f786e17ef1fc6809cfd37fb02c
F test/delete.test 50b9b1f06c843d591741dba7869433a105360dbf
@@ -57,21 +57,21 @@ F test/insert.test dbd3bd189edb61fddbe66c236694ef23352429f1
F test/insert2.test 732405e30331635af8d159fccabe835eea5cd0c6
F test/lock.test bca7d53de73138b1f670a2fbdb1f481ff7eaa45a
F test/main.test da635f9e078cd21ddf074e727381a715064489ff
-F test/malloc.test 47777dd5697c43f575d6a898b6b3f332f10a71d3
+F test/malloc.test 3daa97f6a9577d8f4c6e468b274333af19ce5861
F test/printf.test 4c71871e1a75a2dacb673945fc13ddb30168798f
F test/rowid.test 128453599def7435e988216f7fe89c7450b8a9a3
-F test/select1.test 824d9d5007dffd6a45edde79e89c0a04c36e3ebe
+F test/select1.test 223507655cdb4f9901d83fa7f5c5328e022c211f
F test/select2.test 04ac3bd69298f58c7d0883159bab42ab9ad6021c
F test/select3.test a9234b8424b6c6d71de534f43b91ade9be68e9cc
F test/select4.test cb5374d7c87680e294ac749307459a5cc547609d
F test/select5.test e2b9d51d88cbd6c307c2c05b0ef55fe7ba811ac2
F test/sort.test 838cd862642ed9a2c47e1a17b5c33da452b4552e
F test/subselect.test bf8b251a92fb091973c1c469ce499dc9648a41d5
-F test/table.test c1704fead1af27d67850a934d531848ce5bee4a7
+F test/table.test 3e0d74ec03f3df167544d63f39b9b6cd6d1d1273
F test/tableapi.test 4778414470ba150983d03b9858334effe720c2e0
F test/tclsqlite.test d2aa55926874783b2401f0146e839f773c6796e1
F test/tester.tcl 39a707dac2b6048d9c9e07a98d3256d50069fe47
-F test/trans.test 82556605d48f56ad4679e95478d70546a763f26a
+F test/trans.test 51e50e8273da6845b31a2095e9d3b221fb60d8d0
F test/update.test 72c0c93310483b86dc904a992220c5b84c7ce100
F test/vacuum.test b95d8119a0a83dc6c4ac63888f8872f06199e065
F test/where.test bbab5a308055fb6087dc23d600b4ad2b72797397
@@ -88,7 +88,7 @@ F www/arch.fig 4f246003b7da23bd63b8b0af0618afb4ee3055c8
F www/arch.png 8dae0766d42ed3de9ed013c1341a5792bcf633e6
F www/arch.tcl a40380c1fe0080c43e6cc5c20ed70731511b06be
F www/c_interface.tcl ddca19005c47dd5a15882addc02fff5de83d8ed9
-F www/changes.tcl cad714ae8d6e5c19e8d14282dbfbe7c61c5cc4ee
+F www/changes.tcl e89e31b688833f6393dc1add45e3b4bd1da966b8
F www/crosscompile.tcl c99efacb3aefaa550c6e80d91b240f55eb9fd33e
F www/dynload.tcl 02eb8273aa78cfa9070dd4501dca937fb22b466c
F www/fileformat.tcl cfb7fba80b7275555281ba2f256c00734bcdd1c9
@@ -99,7 +99,7 @@ F www/opcode.tcl cb3a1abf8b7b9be9f3a228d097d6bf8b742c2b6f
F www/sqlite.tcl cb0d23d8f061a80543928755ec7775da6e4f362f
F www/tclsqlite.tcl 06f81c401f79a04f2c5ebfb97e7c176225c0aef2
F www/vdbe.tcl 0c8aaa529dd216ccbf7daaabd80985e413d5f9ad
-P 86b30cd0975dfea9424b9f9f0d4194aa71ce508b
-R 446c442a007e555210ed8cb182f64479
+P 555351dd1918f96167e2cb46cc1db6496e8d10a3
+R 88f43cdb122b3ed28d135a7a6386c93b
U drh
-Z 9bc3b137c004e3bfdf49c47f3fac4875
+Z f62bd098004466e47e342be3c2445c9d
diff --git a/manifest.uuid b/manifest.uuid
index cd48105137..048449f22e 100644
--- a/manifest.uuid
+++ b/manifest.uuid
@@ -1 +1 @@
-555351dd1918f96167e2cb46cc1db6496e8d10a3
\ No newline at end of file
+3bde128418fe70a2fd62bf9e013999827a16053c
\ No newline at end of file
diff --git a/test/all.test b/test/all.test
index 9aeb987ef3..b052599acb 100644
--- a/test/all.test
+++ b/test/all.test
@@ -22,7 +22,7 @@
#***********************************************************************
# This file runs all tests.
#
-# $Id: all.test,v 1.6 2001/04/11 14:28:43 drh Exp $
+# $Id: all.test,v 1.7 2001/04/12 23:21:59 drh Exp $
set testdir [file dirname $argv0]
source $testdir/tester.tcl
@@ -32,7 +32,7 @@ proc finish_test {} {memleak_check}
if {[file exists ./sqlite_test_count]} {
set COUNT [exec cat ./sqlite_test_count]
} else {
- set COUNT 4
+ set COUNT 3
}
if {[file exists ./sqlite_test_prefixes]} {
@@ -81,11 +81,9 @@ if {$LeakList!=""} {
}
if {[file readable $testdir/malloc.test]} {
- for {set Counter 0} {$Counter<$COUNT} {incr Counter} {
- foreach p $PREFIXES {
- set dbprefix $p
- source $testdir/malloc.test
- }
+ foreach p $PREFIXES {
+ set dbprefix $p
+ source $testdir/malloc.test
}
}
diff --git a/test/malloc.test b/test/malloc.test
index d8a24f199d..f8c66995df 100644
--- a/test/malloc.test
+++ b/test/malloc.test
@@ -26,7 +26,7 @@
# special feature is used to see what happens in the library if a malloc
# were to really fail due to an out-of-memory situation.
#
-# $Id: malloc.test,v 1.1 2001/04/11 14:29:22 drh Exp $
+# $Id: malloc.test,v 1.2 2001/04/12 23:21:59 drh Exp $
set testdir [file dirname $argv0]
source $testdir/tester.tcl
@@ -53,7 +53,7 @@ for {set go 1; set i 1} {$go} {incr i} {
INSERT INTO t1 VALUES(1,2.3,4.5,'hi','there');
INSERT INTO t1 VALUES(6,7.0,0.8,'hello','out yonder');
SELECT * FROM t1;
- SELECT avg(b) FROM t1 GROUP BY a;
+ SELECT avg(b) FROM t1 GROUP BY a HAVING b>20.0;
DELETE FROM t1 WHERE a==6;
SELECT count(*) FROM t1;
}} msg]
@@ -65,5 +65,34 @@ for {set go 1; set i 1} {$go} {incr i} {
}
} {1 1}
}
+
+set fd [open ./data.tmp w]
+for {set i 1} {$i<=40} {incr i} {
+ puts $fd "$i\t[expr {$i*$i}]\t[expr {100-$i}]"
+}
+close $fd
+
+for {set go 1; set i 1} {$go} {incr i} {
+ do_test malloc-2.$i {
+ sqlite_malloc_fail 0
+ catch {execsql {DROP TABLE t1}}
+ sqlite_malloc_fail $i
+ set v [catch {execsql {
+ CREATE TABLE t1(a int, b int, c int);
+ CREATE INDEX i1 ON t1(a,b);
+ COPY t1 FROM 'data.tmp';
+ SELECT 'stuff', count(*) as 'other stuff' FROM t1;
+ UPDATE t1 SET b=a WHERE a in (10,12,22);
+ DROP INDEX i1;
+ VACUUM t1;
+ }} msg]
+ if {[lindex [sqlite_malloc_stat] 2]>0} {
+ set ::go 0
+ set v {1 1}
+ } else {
+ lappend v [expr {$msg=="" || $msg=="out of memory"}]
+ }
+ } {1 1}
+}
sqlite_malloc_fail 0
finish_test
diff --git a/test/select1.test b/test/select1.test
index f7d2adbf30..e8d982f037 100644
--- a/test/select1.test
+++ b/test/select1.test
@@ -23,7 +23,7 @@
# This file implements regression tests for SQLite library. The
# focus of this file is testing the SELECT statement.
#
-# $Id: select1.test,v 1.8 2001/04/04 11:48:58 drh Exp $
+# $Id: select1.test,v 1.9 2001/04/12 23:21:59 drh Exp $
set testdir [file dirname $argv0]
source $testdir/tester.tcl
@@ -258,6 +258,10 @@ do_test select1-6.3 {
set v [catch {execsql2 {SELECT f1 as "xyzzy" FROM test1 ORDER BY f2}} msg]
lappend v $msg
} {0 {xyzzy 11 xyzzy 33}}
+do_test select1-6.3.1 {
+ set v [catch {execsql2 {SELECT f1 as 'xyzzy ' FROM test1 ORDER BY f2}} msg]
+ lappend v $msg
+} {0 {{xyzzy } 11 {xyzzy } 33}}
do_test select1-6.4 {
set v [catch {execsql2 {SELECT f1+F2 as xyzzy FROM test1 ORDER BY f2}} msg]
lappend v $msg
@@ -315,4 +319,79 @@ do_test select1-6.11 {
lappend v $msg
} {0 {f2+100 11 f2+100 33 f2+100 122 f2+100 144}}
+do_test select1-7.1 {
+ set v [catch {execsql {
+ SELECT f1 FROM test1 WHERE f2=;
+ }} msg]
+ lappend v $msg
+} {1 {near ";": syntax error}}
+do_test select1-7.2 {
+ set v [catch {execsql {
+ SELECT f1 FROM test1 UNION SELECT WHERE;
+ }} msg]
+ lappend v $msg
+} {1 {near "WHERE": syntax error}}
+do_test select1-7.3 {
+ set v [catch {execsql {SELECT f1 FROM test1 as 'hi', test2 as}} msg]
+ lappend v $msg
+} {1 {near "as": syntax error}}
+do_test select1-7.4 {
+ set v [catch {execsql {
+ SELECT f1 FROM test1 ORDER BY;
+ }} msg]
+ lappend v $msg
+} {1 {near ";": syntax error}}
+do_test select1-7.5 {
+ set v [catch {execsql {
+ SELECT f1 FROM test1 ORDER BY f1 desc, f2 where;
+ }} msg]
+ lappend v $msg
+} {1 {near "where": syntax error}}
+do_test select1-7.6 {
+ set v [catch {execsql {
+ SELECT count(f1,f2 FROM test1;
+ }} msg]
+ lappend v $msg
+} {1 {near "FROM": syntax error}}
+do_test select1-7.7 {
+ set v [catch {execsql {
+ SELECT count(f1,f2+) FROM test1;
+ }} msg]
+ lappend v $msg
+} {1 {near ")": syntax error}}
+do_test select1-7.8 {
+ set v [catch {execsql {
+ SELECT f1 FROM test1 ORDER BY f2, f1+;
+ }} msg]
+ lappend v $msg
+} {1 {near ";": syntax error}}
+
+do_test select1-8.1 {
+ execsql {SELECT f1 FROM test1 WHERE 4.3+2.4 OR 1 ORDER BY f1}
+} {11 33}
+do_test select1-8.2 {
+ execsql {
+ SELECT f1 FROM test1 WHERE ('x' || f1) BETWEEN 'x10' AND 'x20'
+ ORDER BY f1
+ }
+} {11}
+do_test select1-8.3 {
+ execsql {
+ SELECT f1 FROM test1 WHERE 5-3==2
+ ORDER BY f1
+ }
+} {11 33}
+do_test select1-8.4 {
+ execsql {
+ 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}
+do_test select1-8.5 {
+ execsql {
+ SELECT min(1,2,3), -max(1,2,3)
+ FROM test1 ORDER BY f1
+ }
+} {1 -3 1 -3}
+
finish_test
diff --git a/test/table.test b/test/table.test
index b3f21c6702..6c103b1ea3 100644
--- a/test/table.test
+++ b/test/table.test
@@ -23,7 +23,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.8 2001/04/04 11:48:58 drh Exp $
+# $Id: table.test,v 1.9 2001/04/12 23:21:59 drh Exp $
set testdir [file dirname $argv0]
source $testdir/tester.tcl
@@ -313,21 +313,23 @@ do_test table-7.1 {
asc text,
explain int,
vacuum boolean,
- delimiters varchar(10)
+ delimiters varchar(10),
+ begin blob,
+ end clob
)
}} msg]
lappend v $msg
} {0 {}}
do_test table-7.2 {
execsql {
- INSERT INTO weird VALUES('a','b',9,0,'xyz');
+ INSERT INTO weird VALUES('a','b',9,0,'xyz','hi','y''all');
SELECT * FROM weird;
}
-} {a b 9 0 xyz}
+} {a b 9 0 xyz hi y'all}
do_test table-7.3 {
execsql2 {
SELECT * FROM weird;
}
-} {desc a asc b explain 9 vacuum 0 delimiters xyz}
+} {desc a asc b explain 9 vacuum 0 delimiters xyz begin hi end y'all}
finish_test
diff --git a/test/trans.test b/test/trans.test
index 3b018ea80a..407fe6dc36 100644
--- a/test/trans.test
+++ b/test/trans.test
@@ -23,7 +23,7 @@
# This file implements regression tests for SQLite library. The
# focus of this script is database locks.
#
-# $Id: trans.test,v 1.1 2001/04/04 11:48:58 drh Exp $
+# $Id: trans.test,v 1.2 2001/04/12 23:21:59 drh Exp $
set testdir [file dirname $argv0]
@@ -178,6 +178,76 @@ do_test trans-3.14 {
lappend v $msg
} {0 {1 2 3 4}}
+do_test trans-4.1 {
+ set v [catch {execsql {
+ COMMIT;
+ } db} msg]
+ lappend v $msg
+} {0 {}}
+do_test trans-4.2 {
+ set v [catch {execsql {
+ ROLLBACK;
+ } db} msg]
+ lappend v $msg
+} {0 {}}
+do_test trans-4.3 {
+ set v [catch {execsql {
+ BEGIN TRANSACTION;
+ SELECT a FROM two ORDER BY a;
+ } db} msg]
+ lappend v $msg
+} {0 {1 4 5 10}}
+do_test trans-4.4 {
+ set v [catch {execsql {
+ SELECT a FROM two ORDER BY a;
+ } altdb} msg]
+ lappend v $msg
+} {1 {table two is locked}}
+do_test trans-4.5 {
+ set v [catch {execsql {
+ SELECT a FROM one ORDER BY a;
+ } altdb} msg]
+ lappend v $msg
+} {0 {1 2 3 4}}
+do_test trans-4.6 {
+ set v [catch {execsql {
+ BEGIN TRANSACTION;
+ SELECT a FROM one ORDER BY a;
+ } db} msg]
+ lappend v $msg
+} {0 {1 2 3 4}}
+do_test trans-4.7 {
+ set v [catch {execsql {
+ SELECT a FROM two ORDER BY a;
+ } altdb} msg]
+ lappend v $msg
+} {1 {table two is locked}}
+do_test trans-4.8 {
+ set v [catch {execsql {
+ SELECT a FROM one ORDER BY a;
+ } altdb} msg]
+ lappend v $msg
+} {1 {table one is locked}}
+do_test trans-4.9 {
+ set v [catch {execsql {
+ END TRANSACTION;
+ SELECT a FROM two ORDER BY a;
+ } db} msg]
+ lappend v $msg
+} {0 {1 4 5 10}}
+do_test trans-4.10 {
+ set v [catch {execsql {
+ SELECT a FROM two ORDER BY a;
+ } altdb} msg]
+ lappend v $msg
+} {0 {1 4 5 10}}
+do_test trans-4.11 {
+ set v [catch {execsql {
+ SELECT a FROM one ORDER BY a;
+ } altdb} msg]
+ lappend v $msg
+} {0 {1 2 3 4}}
+
do_test trans-99.1 {
altdb close
execsql {
@@ -186,6 +256,7 @@ do_test trans-99.1 {
}
} {}
+
finish_test
} ;# end if(gdbm and not windows)
diff --git a/www/changes.tcl b/www/changes.tcl
index 4dc8400b9a..f5de4f6236 100644
--- a/www/changes.tcl
+++ b/www/changes.tcl
@@ -17,7 +17,7 @@ proc chng {date desc} {
puts "
"
}
-chng {2001 Apr 11 (1.0.31)} {
+chng {2001 Apr 12 (1.0.31)} {
More robust handling of out-of-memory errors.
New tests added to the test suite.
}