1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-07-30 19:03:16 +03:00

Add new test file sqllimits1.test. (CVS 3952)

FossilOrigin-Name: c8974603976ebc02edbc9ab271e87e57f8eb365e
This commit is contained in:
danielk1977
2007-05-08 15:59:05 +00:00
parent 2e6400ba9e
commit b0ab63cd8e
5 changed files with 71 additions and 11 deletions

View File

@ -10,7 +10,7 @@
#***********************************************************************
# This file runs all tests.
#
# $Id: all.test,v 1.40 2007/04/16 17:07:55 drh Exp $
# $Id: all.test,v 1.41 2007/05/08 15:59:06 danielk1977 Exp $
set testdir [file dirname $argv0]
source $testdir/tester.tcl
@ -59,6 +59,7 @@ set EXCLUDE {
malloc.test
misuse.test
memleak.test
sqllimits1.test
}
# Files to include in the test. If this list is empty then everything

View File

@ -6,7 +6,7 @@
#***********************************************************************
# This file runs all tests.
#
# $Id: quick.test,v 1.53 2007/04/28 15:47:45 danielk1977 Exp $
# $Id: quick.test,v 1.54 2007/05/08 15:59:06 danielk1977 Exp $
proc lshift {lvar} {
upvar $lvar l
@ -55,6 +55,7 @@ set EXCLUDE {
quick.test
speed1.test
speed2.test
sqllimits1.test
incrvacuum_ioerr.test
autovacuum_crash.test

57
test/sqllimits1.test Normal file
View File

@ -0,0 +1,57 @@
# 2007 May 8
#
# The author disclaims copyright to this source code. In place of
# a legal notice, here is a blessing:
#
# May you do good and not evil.
# May you find forgiveness for yourself and forgive others.
# May you share freely, never taking more than you give.
#
#***********************************************************************
#
# This file contains tests to verify that the limits defined in
# sqlite source file limits.h are enforced.
#
# $Id: sqllimits1.test,v 1.1 2007/05/08 15:59:06 danielk1977 Exp $
set testdir [file dirname $argv0]
source $testdir/tester.tcl
#--------------------------------------------------------------------
# Test cases sqllimits-1.* test that the SQLITE_MAX_LENGTH limit
# is enforced.
#
do_test sqllimits-1.1 {
catchsql { SELECT randomblob(2147483647) }
} {1 {string or blob too big}}
# Large, but allowable, blob-size.
#
set ::LARGESIZE [expr $SQLITE_MAX_LENGTH - 1]
do_test sqllimits-1.2 {
catchsql { SELECT LENGTH(randomblob($::LARGESIZE)) }
} "0 $::LARGESIZE"
do_test sqllimits-1.3 {
catchsql { SELECT quote(randomblob($::LARGESIZE)) }
} {1 {string or blob too big}}
do_test sqllimits-1.4 {
set ::str [string repeat A 65537]
set ::rep [string repeat B 65537]
catchsql { SELECT replace($::str, 'A', $::rep) }
} {1 {string or blob too big}}
#--------------------------------------------------------------------
# Test cases sqllimits-1.* test that the SQLITE_MAX_SQL limit
# is enforced.
#
do_test sqllimits-2.1 {
set sql "SELECT 1 WHERE 1==1"
append sql [string repeat " AND 1==1" 200000]
catchsql $sql
} {1 {String or BLOB exceeded size limit}}
finish_test