1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152
|
#include <stdio.h>
#include <new>
#include <fstream>
#ifndef DUMA_SO_LIBRARY
#include "../dumapp.h"
#endif
#if 0
class test
{
public:
test()
{
x = 0;
}
test(int m)
{
x = m;
}
~test()
{
x = 0;
}
int x;
};
class testtest
{
public:
testtest()
{
y = new test; //NEW_ELEM( test ); //new test();
}
testtest(int m)
{
y = new test(m); //NEW_ELEM( test(m) ); //new test(m);
}
~testtest()
{
delete y;
}
test *y;
};
#endif
int main( int argc, char ** argv )
{
(void)argc;
(void)argv;
#if 0
int * x = 0;
int ret;
ret = posix_memalign(&x, 2048, sizeof(int) );
if ( !ret )
*x = 1;
free(x);
#elif 0
#include "noduma.h"
int * x = 0;
x = new int[10];
x[0] = 0;
delete x;
#elif 0
std::fstream *f = new std::fstream();
delete f;
#elif 0
/* this test should fail */
int i;
CA_DEFINE(int,acTest,20);
for (i=0; i<100; ++i)
CA_REF(acTest,i) = i;
#elif 0
/* this test should not fail */
int *y, *z;
y = new int;
z = new int[2];
DEL_ARRAY( z );
DEL_ARRAY( z );
DEL_ELEM( y );
DEL_ELEM( y );
#elif 1
int *y, *z;
y = new int;
z = new int[2];
delete []z;
delete y;
#elif 0
int *y, *z;
y = new int;
z = new int[2];
DEL_ARRAY(z);
DEL_ELEM(y);
//y = new int;
//DEL_ELEM(y);
//DEL_ELEM(y);
//y = new(__FILE__,__LINE__) int;
//delete (__FILE__, __LINE__, y);
//y = new(std::nothrow) int;
//delete (std::nothrow, y);
//y = new(std::nothrow, __FILE__, __LINE__) int;
//delete (std::nothrow, __FILE__, __LINE__, y);
#elif 0
/* this test should not fail */
int *y;
y = NEW_ARRAY( int, 2 );
DEL_ARRAY( y );
#elif 0
/* this test should not fail */
int * x, *y;
test *z;
x = (int*)malloc( sizeof(int) );
y = new int;
z = new test[2];
free( x );
delete y;
delete []z;
#elif 0
/* this test should not fail */
test * x = new test(10);
test *ax = new test[2];
testtest *y = new testtest;
delete y;
delete []ax;
delete x;
#endif
return 0;
}
|