Home | History | Annotate | Download | only in test
      1 # 2007 Aug 29
      2 #
      3 # The author disclaims copyright to this source code.  In place of
      4 # a legal notice, here is a blessing:
      5 #
      6 #    May you do good and not evil.
      7 #    May you find forgiveness for yourself and forgive others.
      8 #    May you share freely, never taking more than you give.
      9 #
     10 #***********************************************************************
     11 #
     12 # This test script checks that tickets #2794, #2795, #2796, and #2797
     13 # have been fixed.
     14 # 
     15 # $Id: mallocF.test,v 1.4 2008/02/18 22:24:58 drh Exp $
     16 
     17 set testdir [file dirname $argv0]
     18 source $testdir/tester.tcl
     19 source $testdir/malloc_common.tcl
     20 
     21 # Only run these tests if memory debugging is turned on.
     22 #
     23 if {!$MEMDEBUG} {
     24    puts "Skipping mallocF tests: not compiled with -DSQLITE_MEMDEBUG..."
     25    finish_test
     26    return
     27 }
     28 
     29 # tickets #2794 and #2795 and #2797
     30 #
     31 set PREP {
     32   CREATE TABLE t1(x,y);
     33   INSERT INTO t1 VALUES('abc123', 5);
     34   INSERT INTO t1 VALUES('xyz987', 42);
     35 }
     36 do_malloc_test malloeF-1 -sqlprep $PREP -sqlbody {
     37   SELECT * FROM t1 WHERE x GLOB 'abc*'
     38 }
     39 
     40 # ticket #2796
     41 #
     42 set PREP {
     43   CREATE TABLE t1(x PRIMARY KEY,y UNIQUE);
     44   INSERT INTO t1 VALUES('abc123', 5);
     45   INSERT INTO t1 VALUES('xyz987', 42);
     46 }
     47 do_malloc_test malloeF-2 -sqlprep $PREP -sqlbody {
     48   SELECT x FROM t1
     49    WHERE y=1 OR y=2 OR y=3 OR y=4 OR y=5
     50       OR y=6 OR y=7 OR y=8 OR y=9 OR y=10
     51       OR y=11 OR y=12 OR y=13 OR y=14 OR y=15
     52       OR y=x
     53 }
     54 
     55 set PREP {
     56   CREATE TABLE t1(x PRIMARY KEY,y UNIQUE);
     57   INSERT INTO t1 VALUES('abc123', 5);
     58   INSERT INTO t1 VALUES('xyz987', 42);
     59 }
     60 do_malloc_test malloeF-3 -sqlprep $PREP -sqlbody {
     61   SELECT x FROM t1 WHERE y BETWEEN 10 AND 29
     62 }
     63 
     64 # Ticket #2843
     65 #
     66 set PREP {
     67   CREATE TABLE t1(x);
     68   CREATE TRIGGER r1 BEFORE INSERT ON t1 BEGIN
     69     SELECT 'hello';
     70   END;
     71 }
     72 do_malloc_test mallocF-4 -sqlprep $PREP -sqlbody {
     73   INSERT INTO t1 VALUES(random());
     74 }
     75 
     76 finish_test
     77