1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/persistentdata/persistentstorage/sqlite3api/TEST/TclScript/mallocB.test Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,51 @@
1.4 +# 2007 May 30
1.5 +#
1.6 +# The author disclaims copyright to this source code. In place of
1.7 +# a legal notice, here is a blessing:
1.8 +#
1.9 +# May you do good and not evil.
1.10 +# May you find forgiveness for yourself and forgive others.
1.11 +# May you share freely, never taking more than you give.
1.12 +#
1.13 +#***********************************************************************
1.14 +# This file contains additional out-of-memory checks (see malloc.tcl).
1.15 +# These were all discovered by fuzzy generation of SQL. Apart from
1.16 +# that they have little in common.
1.17 +#
1.18 +#
1.19 +# $Id: mallocB.test,v 1.9 2008/02/18 22:24:58 drh Exp $
1.20 +
1.21 +set testdir [file dirname $argv0]
1.22 +source $testdir/tester.tcl
1.23 +source $testdir/malloc_common.tcl
1.24 +
1.25 +# Only run these tests if memory debugging is turned on.
1.26 +#
1.27 +if {!$MEMDEBUG} {
1.28 + puts "Skipping mallocB tests: not compiled with -DSQLITE_MEMDEBUG..."
1.29 + finish_test
1.30 + return
1.31 +}
1.32 +source $testdir/malloc_common.tcl
1.33 +
1.34 +do_malloc_test mallocB-1 -sqlbody {SELECT - 456}
1.35 +do_malloc_test mallocB-2 -sqlbody {SELECT - 456.1}
1.36 +do_malloc_test mallocB-3 -sqlbody {SELECT random()}
1.37 +do_malloc_test mallocB-4 -sqlbody {SELECT length(zeroblob(1000))}
1.38 +ifcapable subquery {
1.39 + do_malloc_test mallocB-5 -sqlbody {SELECT * FROM (SELECT 1) GROUP BY 1;}
1.40 +}
1.41 +
1.42 +# The following test checks that there are no resource leaks following a
1.43 +# malloc() failure in sqlite3_set_auxdata().
1.44 +#
1.45 +# Note: This problem was not discovered by fuzzy generation of SQL. Not
1.46 +# that it really matters.
1.47 +#
1.48 +do_malloc_test mallocB-6 -sqlbody { SELECT test_auxdata('hello world'); }
1.49 +
1.50 +do_malloc_test mallocB-7 -sqlbody {
1.51 + SELECT strftime(hex(randomblob(50)) || '%Y', 'now')
1.52 +}
1.53 +
1.54 +finish_test