mirror of
https://github.com/pocoproject/poco.git
synced 2025-10-29 12:18:01 +01:00
SharedPtr now has referenceCount() member fn
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// SharedPtrTest.cpp
|
||||
//
|
||||
// $Id: //poco/svn/Foundation/testsuite/src/SharedPtrTest.cpp#2 $
|
||||
// $Id: //poco/1.3/Foundation/testsuite/src/SharedPtrTest.cpp#3 $
|
||||
//
|
||||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
@@ -84,6 +84,7 @@ namespace
|
||||
{
|
||||
return _number;
|
||||
}
|
||||
|
||||
private:
|
||||
int _number;
|
||||
};
|
||||
@@ -114,8 +115,10 @@ void SharedPtrTest::testSharedPtr()
|
||||
}
|
||||
assert (pTO1 < pTO2);
|
||||
ptr1 = pTO1;
|
||||
assert (ptr1.referenceCount() == 1);
|
||||
SharedPtr<TestObject> ptr2 = pTO2;
|
||||
SharedPtr<TestObject> ptr3 = ptr1;
|
||||
assert (ptr1.referenceCount() == 2);
|
||||
SharedPtr<TestObject> ptr4;
|
||||
assert (ptr1.get() == pTO1);
|
||||
assert (ptr1 == pTO1);
|
||||
@@ -198,6 +201,7 @@ void SharedPtrTest::testImplicitCast()
|
||||
assert (TestObject::count() == 0);
|
||||
}
|
||||
|
||||
|
||||
void SharedPtrTest::testExplicitCast()
|
||||
{
|
||||
SharedPtr<TestObject> ptr1 = new DerivedObject("test", 666);
|
||||
@@ -212,6 +216,7 @@ void SharedPtrTest::testExplicitCast()
|
||||
assert (ptr2.get() == 0);
|
||||
}
|
||||
|
||||
|
||||
void SharedPtrTest::setUp()
|
||||
{
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user