xref: /sqlite-3.40.0/test/mallocE.test (revision eee4c8ca)
1cfa063b3Sdrh# 2007 Aug 29
2cfa063b3Sdrh#
3cfa063b3Sdrh# The author disclaims copyright to this source code.  In place of
4cfa063b3Sdrh# a legal notice, here is a blessing:
5cfa063b3Sdrh#
6cfa063b3Sdrh#    May you do good and not evil.
7cfa063b3Sdrh#    May you find forgiveness for yourself and forgive others.
8cfa063b3Sdrh#    May you share freely, never taking more than you give.
9cfa063b3Sdrh#
10cfa063b3Sdrh#***********************************************************************
11cfa063b3Sdrh#
12f4ce8ed0Sdrh# This test script checks that tickets #2784 and #2789 have been fixed.
13cfa063b3Sdrh#
14*eee4c8caSdrh# $Id: mallocE.test,v 1.3 2008/02/18 22:24:58 drh Exp $
15cfa063b3Sdrh
16cfa063b3Sdrhset testdir [file dirname $argv0]
17cfa063b3Sdrhsource $testdir/tester.tcl
18*eee4c8caSdrhsource $testdir/malloc_common.tcl
19cfa063b3Sdrh
20cfa063b3Sdrh# Only run these tests if memory debugging is turned on.
21cfa063b3Sdrh#
22*eee4c8caSdrhif {!$MEMDEBUG} {
23cfa063b3Sdrh   puts "Skipping mallocE tests: not compiled with -DSQLITE_MEMDEBUG..."
24cfa063b3Sdrh   finish_test
25cfa063b3Sdrh   return
26cfa063b3Sdrh}
27cfa063b3Sdrh
28f4ce8ed0Sdrh# ticket #2784
29f4ce8ed0Sdrh#
30cfa063b3Sdrhset PREP {
31cfa063b3Sdrh  PRAGMA page_size = 1024;
32cfa063b3Sdrh  CREATE TABLE t1(a, b, c);
33cfa063b3Sdrh  CREATE TABLE t2(x, y, z);
34cfa063b3Sdrh}
35cfa063b3Sdrhdo_malloc_test mallocE-1 -sqlprep $PREP -sqlbody {
36cfa063b3Sdrh  SELECT p, q FROM (SELECT a+b AS p, b+c AS q FROM t1, t2 WHERE c>5)
37cfa063b3Sdrh              LEFT JOIN t2 ON p=x;
38cfa063b3Sdrh}
39cfa063b3Sdrh
40f4ce8ed0Sdrh# Ticket #2789
41f4ce8ed0Sdrh#
42f4ce8ed0Sdrhdo_malloc_test mallocE-2 -sqlprep $PREP -sqlbody {
43f4ce8ed0Sdrh  SELECT x, y2 FROM (SELECT a+b AS x, b+c AS y2 FROM t1, t2 WHERE c>5)
44f4ce8ed0Sdrh              LEFT JOIN t2 USING(x) WHERE y2>11;
45f4ce8ed0Sdrh}
46f4ce8ed0Sdrh
47f4ce8ed0Sdrh
48cfa063b3Sdrhfinish_test
49