32#include "DGtal/base/Common.h"
33#include "DGtal/base/OwningOrAliasingPtr.h"
43template<
typename Ptr,
typename Value>
46 return ( (aPtr.operator->() == aPtr.get()) && (*aPtr == aValue) );
59 return ( ( (p1.get() != aPtr.get()) && (*p1 == *aPtr) )
60 && ( (p2.get() != aPtr.get()) && (*p2 != *aPtr) )
61 && ( (p3.get() != aPtr.get()) && (*p3 == *aPtr) ) );
65 return ( ( (p1.get() == aPtr.get()) && (*p1 == *aPtr) )
66 && ( (p2.get() != aPtr.get()) && (*p2 != *aPtr) )
67 && ( (p3.get() == aPtr.get()) && (*p3 == *aPtr) ) );
77 unsigned int nbok = 0;
92 trace.
info() <<
"(" << nbok <<
"/" << nb <<
") " << std::endl;
96 trace.
info() <<
"(" << nbok <<
"/" << nb <<
") " << std::endl;
100 trace.
info() <<
"(" << nbok <<
"/" << nb <<
") " << std::endl;
113 trace.
info() <<
"(" << nbok <<
"/" << nb <<
") " << std::endl;
117 trace.
info() <<
"(" << nbok <<
"/" << nb <<
") " << std::endl;
121 trace.
info() <<
"(" << nbok <<
"/" << nb <<
") " << std::endl;
130 trace.
info() << aliasingPtr << std::endl;
131 if ( (!aliasingPtr.
isOwning()) && (aliasingPtr.
get() == &i) && (aliasingPtr.
isValid()) )
134 trace.
info() <<
"(" << nbok <<
"/" << nb <<
") " << std::endl;
138 trace.
info() <<
"(" << nbok <<
"/" << nb <<
") " << std::endl;
142 trace.
info() <<
"(" << nbok <<
"/" << nb <<
") " << std::endl;
161 Dummy1():myPtr(new T(), true) {}
162 Dummy1(T* aPtr):myPtr(aPtr) {}
171 Dummy2(T* aPtr):myPtr(aPtr) {}
172 Dummy2(T data):myPtr(data) {}
187 Dummy1<int> d2(&obj);
191 Dummy2<int> d3(smallObj);
192 DummyBigObject bigObj;
193 Dummy2<DummyBigObject> d4(&bigObj);
203int main(
int argc,
char** argv )
207 for (
int i = 0; i < argc; ++i )
212 trace.
emphase() << ( res ?
"Passed." :
"Error." ) << endl;
Aim: This class describes a smart pointer that is, given the constructor called by the user,...
void beginBlock(const std::string &keyword="")
DGtal is the top-level namespace which contains all DGtal functions and types.
bool testAccessOperators(const Ptr &aPtr, const Value &aValue)
bool testOwningOrAliasingPtr()
bool testCopyAndAssignement(const Ptr &aPtr)