1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-08-01 06:27:03 +03:00

Add the testcase() macro. Additional CSE test coverage. (CVS 4951)

FossilOrigin-Name: 492490f9c86e52c7a706d9e1bf0ba216d5bb8aba
This commit is contained in:
drh
2008-04-01 15:06:33 +00:00
parent b3843a82ea
commit c5499bef4b
6 changed files with 185 additions and 31 deletions

View File

@ -13,7 +13,7 @@
# factoring constant expressions out of loops and for
# common subexpression eliminations.
#
# $Id: cse.test,v 1.3 2008/04/01 12:24:11 drh Exp $
# $Id: cse.test,v 1.4 2008/04/01 15:06:34 drh Exp $
#
set testdir [file dirname $argv0]
@ -70,13 +70,40 @@ do_test cse-1.9 {
}
} {0 -12 1 11 0 -22 1 21}
do_test cse-1.10 {
explain {
SELECT CAST(b AS integer), typeof(b), CAST(b AS text), typeof(b) FROM t1
}
execsql {
SELECT CAST(b AS integer), typeof(b), CAST(b AS text), typeof(b) FROM t1
}
} {11 integer 11 integer 21 integer 21 integer}
do_test cse-1.11 {
execsql {
SELECT *,* FROM t1 WHERE a=2
UNION ALL
SELECT *,* FROM t1 WHERE a=1
}
} {2 21 22 23 24 25 2 21 22 23 24 25 1 11 12 13 14 15 1 11 12 13 14 15}
do_test cse-1.12 {
execsql {
SELECT coalesce(b,c,d,e), a, b, c, d, e FROM t1 WHERE a=2
UNION ALL
SELECT coalesce(e,d,c,b), e, d, c, b, a FROM t1 WHERE a=1
}
} {21 2 21 22 23 24 14 14 13 12 11 1}
do_test cse-1.13 {
explain {
SELECT upper(b), typeof(b), b FROM t1
}
execsql {
SELECT upper(b), typeof(b), b FROM t1
}
} {11 integer 11 21 integer 21}
do_test cse-1.14 {
explain {
SELECT b, typeof(b), upper(b), typeof(b), b FROM t1
}
execsql {
SELECT b, typeof(b), upper(b), typeof(b), b FROM t1
}
} {11 integer 11 integer 11 21 integer 21 integer 21}
# Overflow the column cache. Create queries involving more and more
# columns until the cache overflows. Verify correct operation throughout.