71 ECHO(SimpleObjectDB<T> sot);
75 TEST_THROW(sot.getNonconstObjRCP(0), RangeError);
77 TEST_THROW(sot.getNonconstObjPtr(0), RangeError);
89 ECHO(RCP<SimpleObjectDB<T> > sot = Teuchos::createSimpleObjectDB<T>());
101 ECHO(SimpleObjectDB<T> sot);
102 ECHO(
const int id = sot.storeNonconstObj(T::create()));
117 ECHO(SimpleObjectDB<T> sot);
118 ECHO(
const RCP<T> obj = T::create());
119 ECHO(
const int id = sot.storeNonconstObj(obj));
126 ECHO(SimpleObjectDB<T> sot);
127 ECHO(
const RCP<T> obj = T::create());
128 ECHO(
const int id = sot.storeNonconstObj(obj));
135 ECHO(SimpleObjectDB<T> sot);
136 ECHO(
const RCP<T> obj = T::create());
137 ECHO(
const int id = sot.storeNonconstObj(obj));
144 ECHO(SimpleObjectDB<T> sot);
145 ECHO(
const RCP<T> obj = T::create());
146 ECHO(
const int id = sot.storeNonconstObj(obj));
158 ECHO(SimpleObjectDB<T> sot);
159 ECHO(RCP<const T> obj = T::create());
160 ECHO(
const int id = sot.storeConstObj(obj));
171 ECHO(SimpleObjectDB<A> sot);
173 TEST_THROW(sot.storeNonconstObj(rcpA), NullReferenceError);
181 ECHO(SimpleObjectDB<A> sot);
183 TEST_THROW(sot.storeNonconstObj(
rcp(a)), NullReferenceError);
191 ECHO(SimpleObjectDB<A> sot);
205 ECHO(SimpleObjectDB<A> sot);
207 ECHO(
const int id1 = sot.storeNonconstObj(obj));
209 ECHO(sot.removeObj(id1));
216 ECHO(SimpleObjectDB<A> sot);
218 ECHO(
const int id1 = sot.storeConstObj(obj));
220 ECHO(sot.removeObj(id1));
222 ECHO(
const int id2 = sot.storeConstObj(obj));
231 ECHO(SimpleObjectDB<A> sot);
233 ECHO(
const int id1 = sot.storeNonconstObj(obj));
235 ECHO(
const RCP<A> obj2 = sot.removeNonconstObj(id1));
238 ECHO(
const int id2 = sot.storeNonconstObj(obj));
247 ECHO(SimpleObjectDB<A> sot);
249 ECHO(
const int id1 = sot.storeConstObj(obj));
251 ECHO(
const RCP<const A> obj2 = sot.removeConstObj(id1));
254 ECHO(
const int id2 = sot.storeConstObj(obj));
266 ECHO(SimpleObjectDB<A> sot);
268 TEST_THROW(sot.removeNonconstObj(
id), RangeError);
274 ECHO(SimpleObjectDB<A> sot);
276 TEST_THROW(sot.removeNonconstObj(
id), RangeError);
282 ECHO(SimpleObjectDB<A> sot);
284 TEST_THROW(sot.removeNonconstObj(
id), RangeError);
290 ECHO(SimpleObjectDB<A> sot);
292 ECHO(sot.removeObj(
id));
293 TEST_THROW(sot.removeObj(
id), NullReferenceError);
299 ECHO(SimpleObjectDB<A> sot);
301 ECHO(sot.removeNonconstObj(
id));
302 TEST_THROW(sot.removeNonconstObj(
id), NullReferenceError);
308 ECHO(SimpleObjectDB<A> sot);
310 ECHO(sot.removeConstObj(
id));
311 TEST_THROW(sot.removeConstObj(
id), NullReferenceError);
315 #endif // TEUCHOS_DEBUG
328 ECHO(SimpleObjectDB<A> sot);
330 TEST_THROW(sot.getNonconstObjRCP(
id), RangeError);
335 ECHO(SimpleObjectDB<A> sot);
337 TEST_THROW(sot.getNonconstObjRCP(
id), RangeError);
342 ECHO(SimpleObjectDB<A> sot);
344 TEST_THROW(sot.getNonconstObjRCP(
id), RangeError);
348 #endif // TEUCHOS_DEBUG
353 ECHO(SimpleObjectDB<A> sot);
358 ECHO(sot.removeNonconstObj(
id));
359 TEST_THROW(sot.getNonconstObjRCP(
id), NullReferenceError);
370 ECHO(SimpleObjectDB<T2> sot);
371 ECHO(RCP<T1> rcpT1 =
rcp(
new T1));
372 ECHO(T2 *pT2 = dynamic_cast<T2*>(rcpT1.get()));
374 TEST_THROW(sot.storeCastedNonconstObj(rcpT1), m_bad_cast);
376 ECHO(
int id = sot.storeCastedNonconstObj(rcpT1));
394 ECHO(SimpleObjectDB<A> sot);
395 ECHO(
const RCP<A> a(
new A));
396 ECHO(
int id = sot.storeNonconstObj(a));
397 ECHO(
int id2 = sot.storeNonconstObj(a));
403 ECHO(sot.removeNonconstObj(
id));
411 TEST_THROW(sot.getNonconstObjRCP(
id), RangeError);
416 #endif // TEUCHOS_DEBUG
426 ECHO(SimpleObjectDB<A> sot);
432 ECHO(sot.removeNonconstObj(
id));
446 ECHO(SimpleObjectDB<A> sot);
454 ECHO(sot.removeNonconstObj(
id));
468 ECHO(SimpleObjectDB<A> sot);
478 ECHO(sot.removeNonconstObj(id2));
500 #define UNIT_TEST_GROUP( T ) \
501 TEUCHOS_UNIT_TEST_TEMPLATE_1_INSTANT( SimpleObjectDB, defaultConstruct, T ) \
502 TEUCHOS_UNIT_TEST_TEMPLATE_1_INSTANT( SimpleObjectDB, createSimpleObjectDB, T ) \
503 TEUCHOS_UNIT_TEST_TEMPLATE_1_INSTANT( SimpleObjectDB, storeNonconstObj, T ) \
504 TEUCHOS_UNIT_TEST_TEMPLATE_1_INSTANT( SimpleObjectDB, getNonconstObjRCP, T ) \
505 TEUCHOS_UNIT_TEST_TEMPLATE_1_INSTANT( SimpleObjectDB, getConstObjRCP, T ) \
506 TEUCHOS_UNIT_TEST_TEMPLATE_1_INSTANT( SimpleObjectDB, getNonconstObjPtr, T ) \
507 TEUCHOS_UNIT_TEST_TEMPLATE_1_INSTANT( SimpleObjectDB, getConstObjPtr, T ) \
508 TEUCHOS_UNIT_TEST_TEMPLATE_1_INSTANT( SimpleObjectDB, storeConstObj, T )
510 #define UNIT_TEST_GROUP_PAIR( T1, T2 ) \
511 TEUCHOS_UNIT_TEST_TEMPLATE_2_INSTANT( SimpleObjectDB, storeCastedNonconstObj, T1, T2 )
513 #define UNIT_TEST_GROUP_PAIR_SYM( T1, T2 ) \
514 UNIT_TEST_GROUP_PAIR( T1, T2 ) \
515 UNIT_TEST_GROUP_PAIR( T2, T1 )
Null reference error exception class.
RCP< T > rcp(const boost::shared_ptr< T > &sptr)
Conversion function that takes in a boost::shared_ptr object and spits out a Teuchos::RCP object...
Simple object object database.
#define ECHO(statement)
Echo the given statement before it is executed.
#define TEUCHOS_UNIT_TEST_TEMPLATE_1_DECL(TEST_GROUP, TEST_NAME, TYPE)
Macro for defining a templated unit test with one template parameter.
#define TEST_EQUALITY(v1, v2)
Assert the equality of v1 and v2.
#define TEST_THROW(code, ExceptType)
Assert that the statement 'code' throws the exception 'ExceptType' (otherwise the test fails)...
const T & getConst(T &t)
Return a constant reference to an object given a non-const reference.
#define TEUCHOS_UNIT_TEST_TEMPLATE_2_DECL(TEST_GROUP, TEST_NAME, TYPE1, TYPE2)
Macro for defining a templated unit test with two template parameters.
static Teuchos::RCP< A > create()
#define TEUCHOS_UNIT_TEST(TEST_GROUP, TEST_NAME)
Macro for defining a (non-templated) unit test.
#define UNIT_TEST_GROUP(T)
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
Deprecated.
#define UNIT_TEST_GROUP_PAIR(T1, T2)
RCP< SimpleObjectDB< T > > createSimpleObjectDB()
Nonmember constructor.
#define TEST_EQUALITY_CONST(v1, v2)
Assert the equality of v1 and constant v2.
Exception class for bad cast.
Smart reference counting pointer class for automatic garbage collection.
A simple object table class for Teuchos.
Range error exception class.
#define UNIT_TEST_GROUP_PAIR_SYM(T1, T2)
bool nonnull(const ArrayRCP< T > &p)
Returns true if p.get()!=NULL.
Null reference error exception class.