37 ECHO(SimpleObjectDB<T> sot);
41 TEST_THROW(sot.getNonconstObjRCP(0), RangeError);
43 TEST_THROW(sot.getNonconstObjPtr(0), RangeError);
55 ECHO(RCP<SimpleObjectDB<T> > sot = Teuchos::createSimpleObjectDB<T>());
67 ECHO(SimpleObjectDB<T> sot);
68 ECHO(
const int id = sot.storeNonconstObj(T::create()));
83 ECHO(SimpleObjectDB<T> sot);
84 ECHO(
const RCP<T> obj = T::create());
85 ECHO(
const int id = sot.storeNonconstObj(obj));
92 ECHO(SimpleObjectDB<T> sot);
93 ECHO(
const RCP<T> obj = T::create());
94 ECHO(
const int id = sot.storeNonconstObj(obj));
101 ECHO(SimpleObjectDB<T> sot);
102 ECHO(
const RCP<T> obj = T::create());
103 ECHO(
const int id = sot.storeNonconstObj(obj));
110 ECHO(SimpleObjectDB<T> sot);
111 ECHO(
const RCP<T> obj = T::create());
112 ECHO(
const int id = sot.storeNonconstObj(obj));
124 ECHO(SimpleObjectDB<T> sot);
125 ECHO(RCP<const T> obj = T::create());
126 ECHO(
const int id = sot.storeConstObj(obj));
137 ECHO(SimpleObjectDB<A> sot);
139 TEST_THROW(sot.storeNonconstObj(rcpA), NullReferenceError);
147 ECHO(SimpleObjectDB<A> sot);
149 TEST_THROW(sot.storeNonconstObj(
rcp(a)), NullReferenceError);
157 ECHO(SimpleObjectDB<A> sot);
171 ECHO(SimpleObjectDB<A> sot);
173 ECHO(
const int id1 = sot.storeNonconstObj(obj));
175 ECHO(sot.removeObj(id1));
182 ECHO(SimpleObjectDB<A> sot);
184 ECHO(
const int id1 = sot.storeConstObj(obj));
186 ECHO(sot.removeObj(id1));
188 ECHO(
const int id2 = sot.storeConstObj(obj));
197 ECHO(SimpleObjectDB<A> sot);
199 ECHO(
const int id1 = sot.storeNonconstObj(obj));
201 ECHO(
const RCP<A> obj2 = sot.removeNonconstObj(id1));
204 ECHO(
const int id2 = sot.storeNonconstObj(obj));
213 ECHO(SimpleObjectDB<A> sot);
215 ECHO(
const int id1 = sot.storeConstObj(obj));
217 ECHO(
const RCP<const A> obj2 = sot.removeConstObj(id1));
220 ECHO(
const int id2 = sot.storeConstObj(obj));
232 ECHO(SimpleObjectDB<A> sot);
234 TEST_THROW(sot.removeNonconstObj(
id), RangeError);
240 ECHO(SimpleObjectDB<A> sot);
242 TEST_THROW(sot.removeNonconstObj(
id), RangeError);
248 ECHO(SimpleObjectDB<A> sot);
250 TEST_THROW(sot.removeNonconstObj(
id), RangeError);
256 ECHO(SimpleObjectDB<A> sot);
258 ECHO(sot.removeObj(
id));
259 TEST_THROW(sot.removeObj(
id), NullReferenceError);
265 ECHO(SimpleObjectDB<A> sot);
267 ECHO(sot.removeNonconstObj(
id));
268 TEST_THROW(sot.removeNonconstObj(
id), NullReferenceError);
274 ECHO(SimpleObjectDB<A> sot);
276 ECHO(sot.removeConstObj(
id));
277 TEST_THROW(sot.removeConstObj(
id), NullReferenceError);
281 #endif // TEUCHOS_DEBUG
294 ECHO(SimpleObjectDB<A> sot);
296 TEST_THROW(sot.getNonconstObjRCP(
id), RangeError);
301 ECHO(SimpleObjectDB<A> sot);
303 TEST_THROW(sot.getNonconstObjRCP(
id), RangeError);
308 ECHO(SimpleObjectDB<A> sot);
310 TEST_THROW(sot.getNonconstObjRCP(
id), RangeError);
314 #endif // TEUCHOS_DEBUG
319 ECHO(SimpleObjectDB<A> sot);
324 ECHO(sot.removeNonconstObj(
id));
325 TEST_THROW(sot.getNonconstObjRCP(
id), NullReferenceError);
336 ECHO(SimpleObjectDB<T2> sot);
337 ECHO(RCP<T1> rcpT1 =
rcp(
new T1));
338 ECHO(T2 *pT2 = dynamic_cast<T2*>(rcpT1.get()));
340 TEST_THROW(sot.storeCastedNonconstObj(rcpT1), m_bad_cast);
342 ECHO(
int id = sot.storeCastedNonconstObj(rcpT1));
360 ECHO(SimpleObjectDB<A> sot);
361 ECHO(
const RCP<A> a(
new A));
362 ECHO(
int id = sot.storeNonconstObj(a));
363 ECHO(
int id2 = sot.storeNonconstObj(a));
369 ECHO(sot.removeNonconstObj(
id));
377 TEST_THROW(sot.getNonconstObjRCP(
id), RangeError);
382 #endif // TEUCHOS_DEBUG
392 ECHO(SimpleObjectDB<A> sot);
398 ECHO(sot.removeNonconstObj(
id));
412 ECHO(SimpleObjectDB<A> sot);
420 ECHO(sot.removeNonconstObj(
id));
434 ECHO(SimpleObjectDB<A> sot);
444 ECHO(sot.removeNonconstObj(id2));
466 #define UNIT_TEST_GROUP( T ) \
467 TEUCHOS_UNIT_TEST_TEMPLATE_1_INSTANT( SimpleObjectDB, defaultConstruct, T ) \
468 TEUCHOS_UNIT_TEST_TEMPLATE_1_INSTANT( SimpleObjectDB, createSimpleObjectDB, T ) \
469 TEUCHOS_UNIT_TEST_TEMPLATE_1_INSTANT( SimpleObjectDB, storeNonconstObj, T ) \
470 TEUCHOS_UNIT_TEST_TEMPLATE_1_INSTANT( SimpleObjectDB, getNonconstObjRCP, T ) \
471 TEUCHOS_UNIT_TEST_TEMPLATE_1_INSTANT( SimpleObjectDB, getConstObjRCP, T ) \
472 TEUCHOS_UNIT_TEST_TEMPLATE_1_INSTANT( SimpleObjectDB, getNonconstObjPtr, T ) \
473 TEUCHOS_UNIT_TEST_TEMPLATE_1_INSTANT( SimpleObjectDB, getConstObjPtr, T ) \
474 TEUCHOS_UNIT_TEST_TEMPLATE_1_INSTANT( SimpleObjectDB, storeConstObj, T )
476 #define UNIT_TEST_GROUP_PAIR( T1, T2 ) \
477 TEUCHOS_UNIT_TEST_TEMPLATE_2_INSTANT( SimpleObjectDB, storeCastedNonconstObj, T1, T2 )
479 #define UNIT_TEST_GROUP_PAIR_SYM( T1, T2 ) \
480 UNIT_TEST_GROUP_PAIR( T1, T2 ) \
481 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.