reactos/lib/3rdparty/stlport/test/unit/shared_ptr_test.cpp
Cameron Gutman c2d0d784c7 [USB-BRINGUP-TRUNK]
- Create a branch to do a proper merge of USB work from a trunk base instead of from cmake-bringup
- In the future, DO NOT under any circumstances branch another branch. This leads to merge problems!

svn path=/branches/usb-bringup-trunk/; revision=55018
2012-01-20 20:58:46 +00:00

42 lines
859 B
C++

#include <memory>
#if !defined(_STLP_NO_EXTENSIONS) && defined(_STLP_USE_BOOST_SUPPORT)
// #include <typeinfo>
#include "cppunit/cppunit_proxy.h"
#if !defined (STLPORT) || defined(_STLP_USE_NAMESPACES)
using namespace std;
#endif
class SharedPtrTest :
public CPPUNIT_NS::TestCase
{
CPPUNIT_TEST_SUITE(SharedPtrTest);
CPPUNIT_TEST(shared_from_this);
CPPUNIT_TEST_SUITE_END();
protected:
void shared_from_this();
};
CPPUNIT_TEST_SUITE_REGISTRATION(SharedPtrTest);
struct X;
struct X :
public std::tr1::enable_shared_from_this<X>
{
};
void SharedPtrTest::shared_from_this()
{
std::tr1::shared_ptr<X> p( new X );
std::tr1::shared_ptr<X> q = p->shared_from_this();
CPPUNIT_CHECK( p == q );
CPPUNIT_CHECK( !(p < q) && !(q < p) ); // p and q share ownership
}
#endif /* !_STLP_NO_EXTENSIONS && _STLP_USE_BOOST_SUPPORT */