Increased test coverage. (CVS 5414)
FossilOrigin-Name: 7cf91e08c08ce515c24c738c7d079f5b81eebee6
This commit is contained in:
+2
-1
@@ -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.62 2008/01/22 01:48:09 drh Exp $
|
||||
# $Id: expr.test,v 1.63 2008/07/15 00:27:35 drh Exp $
|
||||
|
||||
set testdir [file dirname $argv0]
|
||||
source $testdir/tester.tcl
|
||||
@@ -144,6 +144,7 @@ test_expr expr-1.106 {i1=0} {(1<<63)/-1} -9223372036854775808
|
||||
test_expr expr-1.107 {i1=0} {(1<<63)%-1} 0
|
||||
test_expr expr-1.108 {i1=0} {1%0} {{}}
|
||||
test_expr expr-1.109 {i1=0} {1/0} {{}}
|
||||
test_expr expr-1.110 {i1=0} {-9223372036854775807/-1} 9223372036854775807
|
||||
|
||||
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
|
||||
|
||||
+13
-1
@@ -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.81 2008/07/07 14:50:14 drh Exp $
|
||||
# $Id: func.test,v 1.82 2008/07/15 00:27:35 drh Exp $
|
||||
|
||||
set testdir [file dirname $argv0]
|
||||
source $testdir/tester.tcl
|
||||
@@ -290,6 +290,18 @@ do_test func-8.4 {
|
||||
SELECT max('z+'||a||'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOP') FROM t3;
|
||||
}
|
||||
} {z+67890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOP}
|
||||
do_test func-8.5 {
|
||||
execsql {
|
||||
SELECT sum(x) FROM (SELECT '9223372036' || '854775807' AS x
|
||||
UNION ALL SELECT -9223372036854775807)
|
||||
}
|
||||
} {0}
|
||||
do_test func-8.6 {
|
||||
execsql {
|
||||
SELECT sum(x) FROM (SELECT '9223372036' || '854775808' AS x
|
||||
UNION ALL SELECT -9223372036854775807)
|
||||
}
|
||||
} {1.0}
|
||||
|
||||
# How do you test the random() function in a meaningful, deterministic way?
|
||||
#
|
||||
|
||||
+13
-11
@@ -9,7 +9,7 @@
|
||||
#
|
||||
#***********************************************************************
|
||||
#
|
||||
# $Id: mutex1.test,v 1.9 2008/07/12 15:55:55 danielk1977 Exp $
|
||||
# $Id: mutex1.test,v 1.10 2008/07/15 00:27:35 drh Exp $
|
||||
|
||||
set testdir [file dirname $argv0]
|
||||
source $testdir/tester.tcl
|
||||
@@ -138,16 +138,18 @@ sqlite3_enable_shared_cache $enable_shared_cache
|
||||
|
||||
# Open and use a connection in "nomutex" mode. Test that no recursive
|
||||
# mutexes are obtained.
|
||||
do_test mutex1.3.1 {
|
||||
catch {db close}
|
||||
clear_mutex_counters
|
||||
sqlite3 db test.db -nomutex 1
|
||||
execsql { SELECT * FROM abc }
|
||||
} {1 2 3 1 2 3 1 2 3}
|
||||
do_test mutex1.3.2 {
|
||||
mutex_counters counters
|
||||
set counters(recursive)
|
||||
} {0}
|
||||
ifcapable threadsafe {
|
||||
do_test mutex1.3.1 {
|
||||
catch {db close}
|
||||
clear_mutex_counters
|
||||
sqlite3 db test.db -nomutex 1
|
||||
execsql { SELECT * FROM abc }
|
||||
} {1 2 3 1 2 3 1 2 3}
|
||||
do_test mutex1.3.2 {
|
||||
mutex_counters counters
|
||||
set counters(recursive)
|
||||
} {0}
|
||||
}
|
||||
|
||||
do_test mutex1-X {
|
||||
catch {db close}
|
||||
|
||||
+55
-2
@@ -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.63 2008/07/10 00:32:42 drh Exp $
|
||||
# $Id: select1.test,v 1.64 2008/07/15 00:27:35 drh Exp $
|
||||
|
||||
set testdir [file dirname $argv0]
|
||||
source $testdir/tester.tcl
|
||||
@@ -405,7 +405,7 @@ do_test select1-5.1 {
|
||||
lappend v $msg
|
||||
} {0 33}
|
||||
|
||||
execsql {CREATE TABLE test2(t1 test, t2 text)}
|
||||
execsql {CREATE TABLE test2(t1 text, t2 text)}
|
||||
execsql {INSERT INTO test2 VALUES('abc','xyz')}
|
||||
|
||||
# Check for column naming
|
||||
@@ -552,6 +552,59 @@ do_test select1-6.9.8 {
|
||||
regsub -all {subquery_[0-9a-fA-F]+_} $x {subquery} x
|
||||
set x
|
||||
} {a.f1 11 a.f2 22 b.x 5 b.y 6}
|
||||
do_test select1-6.9.9 {
|
||||
execsql2 {
|
||||
SELECT a.f1, b.f2 FROM test1 a, test1 b LIMIT 1
|
||||
}
|
||||
} {test1.f1 11 test1.f2 22}
|
||||
do_test select1-6.9.10 {
|
||||
execsql2 {
|
||||
SELECT f1, t1 FROM test1, test2 LIMIT 1
|
||||
}
|
||||
} {test1.f1 11 test2.t1 abc}
|
||||
do_test select1-6.9.11 {
|
||||
db eval {
|
||||
PRAGMA short_column_names=ON;
|
||||
PRAGMA full_column_names=ON;
|
||||
}
|
||||
execsql2 {
|
||||
SELECT a.f1, b.f2 FROM test1 a, test1 b LIMIT 1
|
||||
}
|
||||
} {test1.f1 11 test1.f2 22}
|
||||
do_test select1-6.9.12 {
|
||||
execsql2 {
|
||||
SELECT f1, t1 FROM test1, test2 LIMIT 1
|
||||
}
|
||||
} {test1.f1 11 test2.t1 abc}
|
||||
do_test select1-6.9.13 {
|
||||
db eval {
|
||||
PRAGMA short_column_names=ON;
|
||||
PRAGMA full_column_names=OFF;
|
||||
}
|
||||
execsql2 {
|
||||
SELECT a.f1, b.f1 FROM test1 a, test1 b LIMIT 1
|
||||
}
|
||||
} {f1 11 f1 11}
|
||||
do_test select1-6.9.14 {
|
||||
execsql2 {
|
||||
SELECT f1, t1 FROM test1, test2 LIMIT 1
|
||||
}
|
||||
} {f1 11 t1 abc}
|
||||
do_test select1-6.9.15 {
|
||||
db eval {
|
||||
PRAGMA short_column_names=OFF;
|
||||
PRAGMA full_column_names=ON;
|
||||
}
|
||||
execsql2 {
|
||||
SELECT a.f1, b.f1 FROM test1 a, test1 b LIMIT 1
|
||||
}
|
||||
} {test1.f1 11 test1.f1 11}
|
||||
do_test select1-6.9.16 {
|
||||
execsql2 {
|
||||
SELECT f1, t1 FROM test1, test2 LIMIT 1
|
||||
}
|
||||
} {test1.f1 11 test2.t1 abc}
|
||||
|
||||
|
||||
db eval {
|
||||
PRAGMA short_column_names=ON;
|
||||
|
||||
+54
-2
@@ -17,7 +17,7 @@
|
||||
# explicit sort order and explicit collating secquites) and
|
||||
# with and without optional LIMIT and OFFSET clauses.
|
||||
#
|
||||
# $Id: selectA.test,v 1.3 2008/06/25 14:31:53 drh Exp $
|
||||
# $Id: selectA.test,v 1.4 2008/07/15 00:27:35 drh Exp $
|
||||
|
||||
set testdir [file dirname $argv0]
|
||||
source $testdir/tester.tcl
|
||||
@@ -630,6 +630,26 @@ do_test selectA-2.92 {
|
||||
ORDER BY y COLLATE NOCASE DESC,x,z
|
||||
}
|
||||
} {mad Z z -23 Y y 5200000.0 X x {} U u hare m M abc e e hello d D {} C c 9.9 b B 1 a a}
|
||||
do_test selectA-2.93 {
|
||||
execsql {
|
||||
SELECT upper((SELECT c FROM t1 UNION SELECT z FROM t2 ORDER BY 1));
|
||||
}
|
||||
} {A}
|
||||
do_test selectA-2.94 {
|
||||
execsql {
|
||||
SELECT lower((SELECT c FROM t1 UNION ALL SELECT z FROM t2 ORDER BY 1));
|
||||
}
|
||||
} {a}
|
||||
do_test selectA-2.95 {
|
||||
execsql {
|
||||
SELECT lower((SELECT c FROM t1 INTERSECT SELECT z FROM t2 ORDER BY 1));
|
||||
}
|
||||
} {{}}
|
||||
do_test selectA-2.96 {
|
||||
execsql {
|
||||
SELECT lower((SELECT z FROM t2 EXCEPT SELECT c FROM t1 ORDER BY 1));
|
||||
}
|
||||
} {m}
|
||||
|
||||
|
||||
do_test selectA-3.0 {
|
||||
@@ -1216,6 +1236,38 @@ do_test selectA-3.92 {
|
||||
ORDER BY y COLLATE NOCASE DESC,x,z
|
||||
}
|
||||
} {mad Z z -23 Y y 5200000.0 X x {} U u hare m M abc e e hello d D {} C c 9.9 b B 1 a a}
|
||||
|
||||
do_test selectA-3.93 {
|
||||
execsql {
|
||||
SELECT upper((SELECT c FROM t1 UNION SELECT z FROM t2 ORDER BY 1));
|
||||
}
|
||||
} {A}
|
||||
do_test selectA-3.94 {
|
||||
execsql {
|
||||
SELECT lower((SELECT c FROM t1 UNION ALL SELECT z FROM t2 ORDER BY 1));
|
||||
}
|
||||
} {a}
|
||||
do_test selectA-3.95 {
|
||||
execsql {
|
||||
SELECT lower((SELECT c FROM t1 INTERSECT SELECT z FROM t2 ORDER BY 1));
|
||||
}
|
||||
} {{}}
|
||||
do_test selectA-3.96 {
|
||||
execsql {
|
||||
SELECT lower((SELECT z FROM t2 EXCEPT SELECT c FROM t1 ORDER BY 1));
|
||||
}
|
||||
} {m}
|
||||
do_test selectA-3.97 {
|
||||
execsql {
|
||||
SELECT upper((SELECT x FROM (
|
||||
SELECT x,y,z FROM t2
|
||||
INTERSECT SELECT a,b,c FROM t3
|
||||
EXCEPT SELECT c,b,a FROM t1
|
||||
UNION SELECT a,b,c FROM t3
|
||||
INTERSECT SELECT a,b,c FROM t3
|
||||
EXCEPT SELECT c,b,a FROM t1
|
||||
UNION SELECT a,b,c FROM t3
|
||||
ORDER BY y COLLATE NOCASE DESC,x,z)))
|
||||
}
|
||||
} {MAD}
|
||||
|
||||
finish_test
|
||||
|
||||
+10
-2
@@ -12,7 +12,7 @@
|
||||
# This file contains tests to verify that the limits defined in
|
||||
# sqlite source file limits.h are enforced.
|
||||
#
|
||||
# $Id: sqllimits1.test,v 1.30 2008/07/10 00:32:42 drh Exp $
|
||||
# $Id: sqllimits1.test,v 1.31 2008/07/15 00:27:35 drh Exp $
|
||||
|
||||
set testdir [file dirname $argv0]
|
||||
source $testdir/tester.tcl
|
||||
@@ -360,9 +360,17 @@ set strvalue [string repeat A $::SQLITE_LIMIT_LENGTH]
|
||||
do_test sqllimits1-5.16 {
|
||||
catchsql "SELECT '$strvalue'"
|
||||
} [list 0 $strvalue]
|
||||
do_test sqllimits1-5.17 {
|
||||
do_test sqllimits1-5.17.1 {
|
||||
catchsql "SELECT 'A$strvalue'"
|
||||
} [list 1 {string or blob too big}]
|
||||
do_test sqllimits1-5.17.2 {
|
||||
sqlite3_limit db SQLITE_LIMIT_LENGTH 0x7fffffff
|
||||
catchsql {SELECT 'A' || $::strvalue}
|
||||
} [list 0 A$strvalue]
|
||||
do_test sqllimits1-5.17.3 {
|
||||
sqlite3_limit db SQLITE_LIMIT_LENGTH $SQLITE_LIMIT_LENGTH
|
||||
catchsql {SELECT 'A' || $::strvalue}
|
||||
} [list 1 {string or blob too big}]
|
||||
set blobvalue [string repeat 41 $::SQLITE_LIMIT_LENGTH]
|
||||
do_test sqllimits1-5.18 {
|
||||
catchsql "SELECT x'$blobvalue'"
|
||||
|
||||
+8
-2
@@ -12,7 +12,7 @@
|
||||
# focus of this file is testing SELECT statements that are part of
|
||||
# expressions.
|
||||
#
|
||||
# $Id: subselect.test,v 1.14 2007/04/12 03:54:39 drh Exp $
|
||||
# $Id: subselect.test,v 1.15 2008/07/15 00:27:35 drh Exp $
|
||||
|
||||
set testdir [file dirname $argv0]
|
||||
source $testdir/tester.tcl
|
||||
@@ -53,9 +53,15 @@ do_test subselect-1.3b {
|
||||
do_test subselect-1.3c {
|
||||
execsql {SELECT b from t1 where a = (SELECT a FROM t1 WHERE b=6)}
|
||||
} {6}
|
||||
do_test subselect-1.3c {
|
||||
do_test subselect-1.3d {
|
||||
execsql {SELECT b from t1 where a = (SELECT a FROM t1 WHERE b=8)}
|
||||
} {}
|
||||
do_test subselect-1.3e {
|
||||
execsql {
|
||||
SELECT b FROM t1
|
||||
WHERE a = (SELECT a FROM t1 UNION SELECT b FROM t1 ORDER BY 1);
|
||||
}
|
||||
} {2}
|
||||
|
||||
# What if the subselect doesn't return any value. We should get
|
||||
# NULL as the result. Check it out.
|
||||
|
||||
+6
-1
@@ -11,7 +11,7 @@
|
||||
# This file implements regression tests for SQLite library. The
|
||||
# focus of this file is testing the use of indices in WHERE clases.
|
||||
#
|
||||
# $Id: where.test,v 1.45 2008/07/12 14:52:21 drh Exp $
|
||||
# $Id: where.test,v 1.46 2008/07/15 00:27:35 drh Exp $
|
||||
|
||||
set testdir [file dirname $argv0]
|
||||
source $testdir/tester.tcl
|
||||
@@ -344,6 +344,11 @@ do_test where-4.6 {
|
||||
SELECT 99 WHERE 0.0
|
||||
}
|
||||
} {}
|
||||
do_test where-4.7 {
|
||||
execsql {
|
||||
SELECT count(*) FROM t1 WHERE t1.w
|
||||
}
|
||||
} {100}
|
||||
|
||||
# Verify that IN operators in a WHERE clause are handled correctly.
|
||||
# Omit these tests if the build is not capable of sub-queries.
|
||||
|
||||
Reference in New Issue
Block a user