]>
git.saurik.com Git - wxWidgets.git/blob - tests/misc/misctests.cpp
1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: tests/misc/misctests.cpp
3 // Purpose: test miscellaneous stuff
7 // Copyright: (c) 2008 Peter Most
8 ///////////////////////////////////////////////////////////////////////////////
10 // ----------------------------------------------------------------------------
12 // ----------------------------------------------------------------------------
22 // ----------------------------------------------------------------------------
24 // ----------------------------------------------------------------------------
26 class MiscTestCase
: public CppUnit::TestCase
32 CPPUNIT_TEST_SUITE( MiscTestCase
);
33 CPPUNIT_TEST( Delete
);
34 CPPUNIT_TEST_SUITE_END();
38 DECLARE_NO_COPY_CLASS(MiscTestCase
)
41 // register in the unnamed registry so that these tests are run by default
42 CPPUNIT_TEST_SUITE_REGISTRATION( MiscTestCase
);
44 // also include in it's own registry so that these tests can be run alone
45 CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( MiscTestCase
, "MiscTestCase" );
47 void MiscTestCase::Delete()
49 // Allocate some arbitrary memory to get a valid pointer:
50 long *pointer
= new long;
51 CPPUNIT_ASSERT( pointer
!= NULL
);
53 // Check that wxDELETE sets the pointer to NULL:
55 CPPUNIT_ASSERT( pointer
== NULL
);
57 // Allocate some arbitrary array to get a valid pointer:
58 long *array
= new long[ 3 ];
59 CPPUNIT_ASSERT( array
!= NULL
);
61 // Check that wxDELETEA sets the pointer to NULL:
63 CPPUNIT_ASSERT( array
== NULL
);
65 // this results in compilation error, as it should
67 struct SomeUnknownStruct
*p
= NULL
;