ReactOS 0.4.16-dev-340-g0540c21
memory_test.cpp
Go to the documentation of this file.
1#include <memory>
2
4
5#if !defined (STLPORT) || defined(_STLP_USE_NAMESPACES)
6using namespace std;
7#endif
8
9//
10// TestCase class
11//
12class MemoryTest : public CPPUNIT_NS::TestCase
13{
15#if defined (_STLP_MSVC) && (_STLP_MSVC < 1310)
17#endif
20
21protected:
22 void auto_ptr_test();
23};
24
26
27#if !defined (_STLP_MSVC) || (_STLP_MSVC >= 1310)
29{ return auto_ptr<int>(new int(val)); }
30
32{ return *pint == val; }
33#endif
34
35//
36// tests implementation
37//
39{
40#if !defined (_STLP_MSVC) || (_STLP_MSVC >= 1310)
41 {
42 auto_ptr<int> pint(new int(1));
43 CPPUNIT_ASSERT( *pint == 1 );
44 *pint = 2;
45 CPPUNIT_ASSERT( *pint == 2 );
46 }
47
48 {
50 CPPUNIT_ASSERT( *pint == 3 );
51 CPPUNIT_ASSERT( CheckEquality(pint, 3) );
52 }
53
54 {
55 auto_ptr<const int> pint(new int(2));
56 CPPUNIT_ASSERT( *pint == 2 );
57 }
58 {
59 auto_ptr<volatile int> pint(new int(2));
60 CPPUNIT_ASSERT( *pint == 2 );
61 }
62 {
63 auto_ptr<const volatile int> pint(new int(2));
64 CPPUNIT_ASSERT( *pint == 2 );
65 }
66#endif
67}
CPPUNIT_TEST_SUITE(MemoryTest)
CPPUNIT_TEST(auto_ptr_test)
void auto_ptr_test()
Definition: memory_test.cpp:38
CPPUNIT_TEST_SUITE_END()
#define CPPUNIT_IGNORE
Definition: cppunit_mini.h:185
#define CPPUNIT_TEST_SUITE_REGISTRATION(X)
Definition: cppunit_mini.h:193
#define CPPUNIT_ASSERT(X)
Definition: cppunit_mini.h:200
GLuint GLfloat * val
Definition: glext.h:7180
bool CheckEquality(auto_ptr< int > pint, int val)
Definition: memory_test.cpp:31
auto_ptr< int > CreateAutoPtr(int val)
Definition: memory_test.cpp:28
Definition: features.h:417