Skip to content
Snippets Groups Projects
Commit 07fcf467 authored by Jan Trávníček's avatar Jan Trávníček
Browse files

test even moving of cow_shared_ptrs

parent 022b5558
No related branches found
No related tags found
No related merge requests found
......@@ -28,16 +28,21 @@ void SharedPtrTest::testSharedPtr1() {
 
std::make_const(two).get();
 
std::cow_shared_ptr<SharedPtrTest::Moveable> three(std::move ( two ) );
std::make_const(three).get();
CPPUNIT_ASSERT(!one.unique());
CPPUNIT_ASSERT(moves == 0);
CPPUNIT_ASSERT(copies == 0);
 
two = std::move ( three ) ;
two.get();
 
CPPUNIT_ASSERT(one.unique());
CPPUNIT_ASSERT(moves == 0);
CPPUNIT_ASSERT(copies == 1);
}
 
void SharedPtrTest::testSharedPtr2() {
......@@ -58,16 +63,21 @@ void SharedPtrTest::testSharedPtr2() {
 
std::make_const(two).get();
 
std::cow_shared_ptr<SharedPtrTest::Moveable2> three(std::move ( two ) );
std::make_const(three).get();
CPPUNIT_ASSERT(!one.unique());
CPPUNIT_ASSERT(moves == 0);
CPPUNIT_ASSERT(copies == 0);
 
two = std::move ( three ) ;
two.get();
 
CPPUNIT_ASSERT(one.unique());
CPPUNIT_ASSERT(moves == 0);
CPPUNIT_ASSERT(copies == 1);
}
 
void SharedPtrTest::testSharedPtr3() {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment