ReactOS  0.4.15-dev-3453-gff89651
shared_ptr_test.cpp
Go to the documentation of this file.
1 #include <memory>
2 
3 #if !defined(_STLP_NO_EXTENSIONS) && defined(_STLP_USE_BOOST_SUPPORT)
4 
5 // #include <typeinfo>
7 
8 #if !defined (STLPORT) || defined(_STLP_USE_NAMESPACES)
9 using namespace std;
10 #endif
11 
12 class SharedPtrTest :
13  public CPPUNIT_NS::TestCase
14 {
15  CPPUNIT_TEST_SUITE(SharedPtrTest);
16  CPPUNIT_TEST(shared_from_this);
18 
19  protected:
20  void shared_from_this();
21 };
22 
23 CPPUNIT_TEST_SUITE_REGISTRATION(SharedPtrTest);
24 
25 struct X;
26 
27 struct X :
28  public std::tr1::enable_shared_from_this<X>
29 {
30 };
31 
32 void SharedPtrTest::shared_from_this()
33 {
34  std::tr1::shared_ptr<X> p( new X );
35  std::tr1::shared_ptr<X> q = p->shared_from_this();
36 
37  CPPUNIT_CHECK( p == q );
38  CPPUNIT_CHECK( !(p < q) && !(q < p) ); // p and q share ownership
39 }
40 
41 #endif /* !_STLP_NO_EXTENSIONS && _STLP_USE_BOOST_SUPPORT */
#define CPPUNIT_TEST_SUITE(X)
Definition: cppunit_mini.h:142
#define CPPUNIT_TEST(X)
Definition: cppunit_mini.h:182
Definition: features.h:417
#define CPPUNIT_TEST_SUITE_END()
Definition: cppunit_mini.h:191
#define CPPUNIT_CHECK(X)
Definition: cppunit_mini.h:195
GLdouble GLdouble GLdouble GLdouble q
Definition: gl.h:2063
#define CPPUNIT_TEST_SUITE_REGISTRATION(X)
Definition: cppunit_mini.h:193
GLfloat GLfloat p
Definition: glext.h:8902