Added tests for DestructiveCopy.
git-svn-id: svn://svn.code.sf.net/p/loki-lib/code/trunk@1097 7ec92016-0320-0410-acc4-a06ded1c099a
This commit is contained in:
parent
cd6a4f5864
commit
d6ee790dd6
1 changed files with 39 additions and 0 deletions
|
@ -1455,6 +1455,44 @@ void DoDeepCopyTests( void )
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
typedef Loki::SmartPtr< BaseClass, DestructiveCopy > DestructiveCopyPtr;
|
||||||
|
|
||||||
|
DestructiveCopyPtr MakePointer( void )
|
||||||
|
{
|
||||||
|
DestructiveCopyPtr p( new BaseClass );
|
||||||
|
return p;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
void DoDestructiveCopyTest( void )
|
||||||
|
{
|
||||||
|
cout << "Starting DoDestructiveCopyTest." << endl;
|
||||||
|
|
||||||
|
{
|
||||||
|
DestructiveCopyPtr p1( new BaseClass );
|
||||||
|
assert( p1 );
|
||||||
|
DestructiveCopyPtr p2;
|
||||||
|
assert( !p2 );
|
||||||
|
p2 = p1;
|
||||||
|
assert( !p1 );
|
||||||
|
assert( p2 );
|
||||||
|
DestructiveCopyPtr p3( p2 );
|
||||||
|
assert( p3 );
|
||||||
|
assert( !p2 );
|
||||||
|
/// @todo The following lines need to be uncommented when bug 3224572 gets fixed.
|
||||||
|
// DestructiveCopyPtr p4( MakePointer() );
|
||||||
|
// assert( p4 );
|
||||||
|
}
|
||||||
|
|
||||||
|
assert( BaseClass::AllDestroyed() );
|
||||||
|
assert( !BaseClass::ExtraConstructions() );
|
||||||
|
assert( !BaseClass::ExtraDestructions() );
|
||||||
|
cout << "Finished DoDestructiveCopyTest." << endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
int main( int argc, const char * argv[] )
|
int main( int argc, const char * argv[] )
|
||||||
{
|
{
|
||||||
bool doThreadTest = false;
|
bool doThreadTest = false;
|
||||||
|
@ -1465,6 +1503,7 @@ int main( int argc, const char * argv[] )
|
||||||
}
|
}
|
||||||
|
|
||||||
DoDeepCopyTests();
|
DoDeepCopyTests();
|
||||||
|
DoDestructiveCopyTest();
|
||||||
DoRefLinkTests();
|
DoRefLinkTests();
|
||||||
DoWeakLeakTest();
|
DoWeakLeakTest();
|
||||||
DoStrongRefCountTests();
|
DoStrongRefCountTests();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue