Teuchos Package Browser (Single Doxygen Collection)  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
SimpleObjectDB_UnitTests.cpp
Go to the documentation of this file.
1 /*
2 // @HEADER
3 // ***********************************************************************
4 //
5 // Teuchos: Common Tools Package
6 // Copyright (2004) Sandia Corporation
7 //
8 // Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive
9 // license for use of this work by or on behalf of the U.S. Government.
10 //
11 // Redistribution and use in source and binary forms, with or without
12 // modification, are permitted provided that the following conditions are
13 // met:
14 //
15 // 1. Redistributions of source code must retain the above copyright
16 // notice, this list of conditions and the following disclaimer.
17 //
18 // 2. Redistributions in binary form must reproduce the above copyright
19 // notice, this list of conditions and the following disclaimer in the
20 // documentation and/or other materials provided with the distribution.
21 //
22 // 3. Neither the name of the Corporation nor the names of the
23 // contributors may be used to endorse or promote products derived from
24 // this software without specific prior written permission.
25 //
26 // THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
27 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
28 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
29 // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
30 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
31 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
32 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
33 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
34 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
35 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
36 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
37 //
38 // Questions? Contact Michael A. Heroux (maherou@sandia.gov)
39 //
40 // ***********************************************************************
41 // @HEADER
42 */
43 
45 #include "Teuchos_getConst.hpp"
46 
47 #include "TestClasses.hpp"
49 
50 
51 namespace {
52 
53 
54 using Teuchos::null;
55 using Teuchos::RCP;
56 using Teuchos::rcp;
61 using Teuchos::getConst;
62 
63 
64 //
65 // SimpleObjectDB::SimpleObjectDB()
66 //
67 
68 
69 TEUCHOS_UNIT_TEST_TEMPLATE_1_DECL( SimpleObjectDB, defaultConstruct, T )
70 {
71  ECHO(SimpleObjectDB<T> sot);
72  TEST_EQUALITY_CONST(sot.tableSize(), 0);
73  TEST_EQUALITY_CONST(sot.numFreeIndexes(), 0);
74  TEST_EQUALITY_CONST(sot.numObjects(), 0);
75  TEST_THROW(sot.getNonconstObjRCP(0), RangeError);
76  TEST_THROW(sot.getConstObjRCP(0), RangeError);
77  TEST_THROW(sot.getNonconstObjPtr(0), RangeError);
78  TEST_THROW(sot.getConstObjPtr(0), RangeError);
79 }
80 
81 
82 //
83 // createSimpleObjectDB()
84 //
85 
86 
88 {
89  ECHO(RCP<SimpleObjectDB<T> > sot = Teuchos::createSimpleObjectDB<T>());
90  TEST_EQUALITY_CONST(sot->numObjects(), 0);
91 }
92 
93 
94 //
95 // SimpleObjectDB::storeNonconstObj()
96 //
97 
98 
99 TEUCHOS_UNIT_TEST_TEMPLATE_1_DECL( SimpleObjectDB, storeNonconstObj, T )
100 {
101  ECHO(SimpleObjectDB<T> sot);
102  ECHO(const int id = sot.storeNonconstObj(T::create()));
103  TEST_EQUALITY_CONST(sot.tableSize(), 1);
104  TEST_EQUALITY_CONST(sot.numFreeIndexes(), 0);
105  TEST_EQUALITY_CONST(id, 0);
106  TEST_EQUALITY_CONST(nonnull(sot.getNonconstObjRCP(id)), true);
107 }
108 
109 
110 //
111 // SimpleObjectDB::get[Nonconst,Const]Obj[RCP,Ptr]()
112 //
113 
114 
115 TEUCHOS_UNIT_TEST_TEMPLATE_1_DECL( SimpleObjectDB, getNonconstObjRCP, T )
116 {
117  ECHO(SimpleObjectDB<T> sot);
118  ECHO(const RCP<T> obj = T::create());
119  ECHO(const int id = sot.storeNonconstObj(obj));
120  TEST_EQUALITY(obj.get(), sot.getNonconstObjRCP(id).get());
121 }
122 
123 
124 TEUCHOS_UNIT_TEST_TEMPLATE_1_DECL( SimpleObjectDB, getConstObjRCP, T )
125 {
126  ECHO(SimpleObjectDB<T> sot);
127  ECHO(const RCP<T> obj = T::create());
128  ECHO(const int id = sot.storeNonconstObj(obj));
129  TEST_EQUALITY(obj.get(), getConst(sot).getConstObjRCP(id).get());
130 }
131 
132 
133 TEUCHOS_UNIT_TEST_TEMPLATE_1_DECL( SimpleObjectDB, getNonconstObjPtr, T )
134 {
135  ECHO(SimpleObjectDB<T> sot);
136  ECHO(const RCP<T> obj = T::create());
137  ECHO(const int id = sot.storeNonconstObj(obj));
138  TEST_EQUALITY(obj.get(), sot.getNonconstObjPtr(id).get());
139 }
140 
141 
142 TEUCHOS_UNIT_TEST_TEMPLATE_1_DECL( SimpleObjectDB, getConstObjPtr, T )
143 {
144  ECHO(SimpleObjectDB<T> sot);
145  ECHO(const RCP<T> obj = T::create());
146  ECHO(const int id = sot.storeNonconstObj(obj));
147  TEST_EQUALITY(obj.get(), getConst(sot).getConstObjPtr(id).get());
148 }
149 
150 
151 //
152 // SimpleObjectDB::storeConstObj(), getNonconstObjRCP()
153 //
154 
155 
156 TEUCHOS_UNIT_TEST_TEMPLATE_1_DECL( SimpleObjectDB, storeConstObj, T )
157 {
158  ECHO(SimpleObjectDB<T> sot);
159  ECHO(RCP<const T> obj = T::create());
160  ECHO(const int id = sot.storeConstObj(obj));
161  TEST_EQUALITY_CONST(id, 0);
162  TEST_EQUALITY_CONST(sot.tableSize(), 1);
163  TEST_EQUALITY_CONST(sot.numFreeIndexes(), 0);
164  TEST_EQUALITY(sot.getConstObjRCP(id).get(), obj.get());
165  TEST_THROW(sot.getNonconstObjRCP(id), Teuchos::NonconstAccessError);
166 }
167 
168 
169 TEUCHOS_UNIT_TEST( SimpleObjectDB, storeNonconstObjNull1 )
170 {
171  ECHO(SimpleObjectDB<A> sot);
172  ECHO(RCP<A> rcpA);
173  TEST_THROW(sot.storeNonconstObj(rcpA), NullReferenceError);
174  TEST_EQUALITY_CONST(sot.tableSize(), 0);
175  TEST_EQUALITY_CONST(sot.numFreeIndexes(), 0);
176 }
177 
178 
179 TEUCHOS_UNIT_TEST( SimpleObjectDB, storeNonconstObjNull2 )
180 {
181  ECHO(SimpleObjectDB<A> sot);
182  ECHO(A *a=NULL);
183  TEST_THROW(sot.storeNonconstObj(rcp(a)), NullReferenceError);
184  TEST_EQUALITY_CONST(sot.tableSize(), 0);
185  TEST_EQUALITY_CONST(sot.numFreeIndexes(), 0);
186 }
187 
188 
189 TEUCHOS_UNIT_TEST( SimpleObjectDB, storeNonconstObjNull3 )
190 {
191  ECHO(SimpleObjectDB<A> sot);
192  TEST_THROW(sot.storeNonconstObj(Teuchos::null), NullReferenceError);
193  TEST_EQUALITY_CONST(sot.tableSize(), 0);
194  TEST_EQUALITY_CONST(sot.numFreeIndexes(), 0);
195 }
196 
197 
198 //
199 // SimpleObjectDB::remove[Nonconst,Const]Obj()
200 //
201 
202 
203 TEUCHOS_UNIT_TEST( SimpleObjectDB, removeObj_storeNonconstObj_1_0 )
204 {
205  ECHO(SimpleObjectDB<A> sot);
206  ECHO(const RCP<A> obj = A::create());
207  ECHO(const int id1 = sot.storeNonconstObj(obj));
208  TEST_EQUALITY(sot.getNonconstObjRCP(id1).ptr(), obj.ptr());
209  ECHO(sot.removeObj(id1));
210  TEST_EQUALITY_CONST(sot.numObjects(), 0);
211 }
212 
213 
214 TEUCHOS_UNIT_TEST( SimpleObjectDB, removeObj_storeConstObj_1_0 )
215 {
216  ECHO(SimpleObjectDB<A> sot);
217  ECHO(const RCP<A> obj = A::create());
218  ECHO(const int id1 = sot.storeConstObj(obj));
219  TEST_EQUALITY(sot.getConstObjRCP(id1).ptr(), obj.ptr());
220  ECHO(sot.removeObj(id1));
221  TEST_EQUALITY_CONST(sot.numObjects(), 0);
222  ECHO(const int id2 = sot.storeConstObj(obj));
223  TEST_EQUALITY_CONST(id2, 0);
224  TEST_EQUALITY(sot.getConstObjRCP(id2).ptr(), obj.ptr());
225  TEST_EQUALITY_CONST(sot.numObjects(), 1);
226 }
227 
228 
229 TEUCHOS_UNIT_TEST( SimpleObjectDB, removeNonconstObj_storeNonconstObj_1_0 )
230 {
231  ECHO(SimpleObjectDB<A> sot);
232  ECHO(const RCP<A> obj = A::create());
233  ECHO(const int id1 = sot.storeNonconstObj(obj));
234  TEST_EQUALITY(sot.getNonconstObjRCP(id1).ptr(), obj.ptr());
235  ECHO(const RCP<A> obj2 = sot.removeNonconstObj(id1));
236  TEST_EQUALITY(obj2.ptr(), obj.ptr());
237  TEST_EQUALITY_CONST(sot.numObjects(), 0);
238  ECHO(const int id2 = sot.storeNonconstObj(obj));
239  TEST_EQUALITY_CONST(id2, 0);
240  TEST_EQUALITY(sot.getNonconstObjRCP(id2).ptr(), obj.ptr());
241  TEST_EQUALITY_CONST(sot.numObjects(), 1);
242 }
243 
244 
245 TEUCHOS_UNIT_TEST( SimpleObjectDB, removeConstObj_storeConstObj_1_0 )
246 {
247  ECHO(SimpleObjectDB<A> sot);
248  ECHO(const RCP<const A> obj = A::create());
249  ECHO(const int id1 = sot.storeConstObj(obj));
250  TEST_EQUALITY(sot.getConstObjRCP(id1).ptr(), obj.ptr());
251  ECHO(const RCP<const A> obj2 = sot.removeConstObj(id1));
252  TEST_EQUALITY(obj2.ptr(), obj.ptr());
253  TEST_EQUALITY_CONST(sot.numObjects(), 0);
254  ECHO(const int id2 = sot.storeConstObj(obj));
255  TEST_EQUALITY_CONST(id2, 0);
256  TEST_EQUALITY(sot.getConstObjRCP(id2).ptr(), obj.ptr());
257  TEST_EQUALITY_CONST(sot.numObjects(), 1);
258 }
259 
260 
261 #ifdef TEUCHOS_DEBUG
262 
263 
264 TEUCHOS_UNIT_TEST( SimpleObjectDB, removeNonconstObjInvalid1 )
265 {
266  ECHO(SimpleObjectDB<A> sot);
267  ECHO(int id = -1);
268  TEST_THROW(sot.removeNonconstObj(id), RangeError);
269 }
270 
271 
272 TEUCHOS_UNIT_TEST( SimpleObjectDB, removeNonconstObjInvalid2 )
273 {
274  ECHO(SimpleObjectDB<A> sot);
275  ECHO(int id = -2);
276  TEST_THROW(sot.removeNonconstObj(id), RangeError);
277 }
278 
279 
280 TEUCHOS_UNIT_TEST( SimpleObjectDB, removeNonconstObjInvalid3 )
281 {
282  ECHO(SimpleObjectDB<A> sot);
283  ECHO(int id = 0);
284  TEST_THROW(sot.removeNonconstObj(id), RangeError);
285 }
286 
287 
288 TEUCHOS_UNIT_TEST( SimpleObjectDB, removeObjTwice )
289 {
290  ECHO(SimpleObjectDB<A> sot);
291  ECHO(const int id = sot.storeNonconstObj(A::create()));
292  ECHO(sot.removeObj(id));
293  TEST_THROW(sot.removeObj(id), NullReferenceError);
294 }
295 
296 
297 TEUCHOS_UNIT_TEST( SimpleObjectDB, removeNonconstObjTwice )
298 {
299  ECHO(SimpleObjectDB<A> sot);
300  ECHO(const int id = sot.storeNonconstObj(A::create()));
301  ECHO(sot.removeNonconstObj(id));
302  TEST_THROW(sot.removeNonconstObj(id), NullReferenceError);
303 }
304 
305 
306 TEUCHOS_UNIT_TEST( SimpleObjectDB, removeConstObjTwice )
307 {
308  ECHO(SimpleObjectDB<A> sot);
309  ECHO(const int id = sot.storeNonconstObj(A::create()));
310  ECHO(sot.removeConstObj(id));
311  TEST_THROW(sot.removeConstObj(id), NullReferenceError);
312 }
313 
314 
315 #endif // TEUCHOS_DEBUG
316 
317 
318 //
319 // SimpleObjectDB::getNonconstObjRCP()
320 //
321 
322 
323 #ifdef TEUCHOS_DEBUG
324 
325 
326 TEUCHOS_UNIT_TEST( SimpleObjectDB, getNonconstObjRCPInvalid1 )
327 {
328  ECHO(SimpleObjectDB<A> sot);
329  ECHO(int id = -1);
330  TEST_THROW(sot.getNonconstObjRCP(id), RangeError);
331 }
332 
333 TEUCHOS_UNIT_TEST( SimpleObjectDB, getNonconstObjRCPInvalid2 )
334 {
335  ECHO(SimpleObjectDB<A> sot);
336  ECHO(int id = -2);
337  TEST_THROW(sot.getNonconstObjRCP(id), RangeError);
338 }
339 
340 TEUCHOS_UNIT_TEST( SimpleObjectDB, getNonconstObjRCPInvalid3 )
341 {
342  ECHO(SimpleObjectDB<A> sot);
343  ECHO(int id = 0);
344  TEST_THROW(sot.getNonconstObjRCP(id), RangeError);
345 }
346 
347 
348 #endif // TEUCHOS_DEBUG
349 
350 
351 TEUCHOS_UNIT_TEST( SimpleObjectDB, getNonconstObjRCPInvalid4 )
352 {
353  ECHO(SimpleObjectDB<A> sot);
354  ECHO(int id = sot.storeNonconstObj(A::create()));
355  TEST_EQUALITY_CONST(id, 0);
356  ECHO(int id2 = sot.storeNonconstObj(A::create()));
357  TEST_EQUALITY_CONST(id2, 1);
358  ECHO(sot.removeNonconstObj(id));
359  TEST_THROW(sot.getNonconstObjRCP(id), NullReferenceError);
360 }
361 
362 
363 //
364 // SimpleObjectDB::storeCastedNonconstObj()
365 //
366 
367 
368 TEUCHOS_UNIT_TEST_TEMPLATE_2_DECL( SimpleObjectDB, storeCastedNonconstObj, T1, T2 )
369 {
370  ECHO(SimpleObjectDB<T2> sot);
371  ECHO(RCP<T1> rcpT1 = rcp(new T1));
372  ECHO(T2 *pT2 = dynamic_cast<T2*>(rcpT1.get()));
373  if (pT2 == NULL) {
374  TEST_THROW(sot.storeCastedNonconstObj(rcpT1), m_bad_cast);
375  } else {
376  ECHO(int id = sot.storeCastedNonconstObj(rcpT1));
377  TEST_EQUALITY_CONST(id, 0);
378  TEST_EQUALITY_CONST(nonnull(sot.getNonconstObjRCP(id)), true);
379  TEST_EQUALITY_CONST(rcpT1.shares_resource(sot.getNonconstObjRCP(id)), true);
380  }
381 }
382 
383 
384 //
385 // SimpleObjectDB::purge()
386 //
387 
388 
389 #ifdef TEUCHOS_DEBUG
390 
391 
392 TEUCHOS_UNIT_TEST( SimpleObjectDB, purge )
393 {
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));
398  TEST_EQUALITY_CONST(nonnull(sot.getNonconstObjRCP(id)), true);
399  TEST_EQUALITY_CONST(nonnull(sot.getNonconstObjRCP(id2)), true);
400  TEST_EQUALITY_CONST(sot.tableSize(), 2);
401  TEST_EQUALITY_CONST(sot.numFreeIndexes(), 0);
402  TEST_EQUALITY_CONST(sot.numObjects(), 2);
403  ECHO(sot.removeNonconstObj(id));
404  TEST_EQUALITY_CONST(sot.tableSize(), 2);
405  TEST_EQUALITY_CONST(sot.numFreeIndexes(), 1);
406  TEST_EQUALITY_CONST(sot.numObjects(), 1);
407  ECHO(sot.purge());
408  TEST_EQUALITY_CONST(sot.tableSize(), 0);
409  TEST_EQUALITY_CONST(sot.numFreeIndexes(), 0);
410  TEST_EQUALITY_CONST(sot.numObjects(), 0);
411  TEST_THROW(sot.getNonconstObjRCP(id), RangeError);
412  TEST_EQUALITY_CONST(a.strong_count(), 1); // sot gave up its RCP?
413 }
414 
415 
416 #endif // TEUCHOS_DEBUG
417 
418 
419 //
420 // SimpleObjectDB's freedIndices table
421 //
422 
423 
424 TEUCHOS_UNIT_TEST( SimpleObjectDB, recycleIndex1 )
425 {
426  ECHO(SimpleObjectDB<A> sot);
427  ECHO(int id = sot.storeNonconstObj(A::create()));
428  TEST_EQUALITY_CONST(id, 0);
429  TEST_EQUALITY_CONST(sot.tableSize(), 1);
430  TEST_EQUALITY_CONST(sot.numFreeIndexes(), 0);
431  TEST_EQUALITY_CONST(sot.numObjects(), 1);
432  ECHO(sot.removeNonconstObj(id));
433  TEST_EQUALITY_CONST(sot.tableSize(), 1);
434  TEST_EQUALITY_CONST(sot.numFreeIndexes(), 1);
435  TEST_EQUALITY_CONST(sot.numObjects(), 0);
436  ECHO(int id2 = sot.storeNonconstObj(A::create()));
437  TEST_EQUALITY_CONST(id2, 0);
438  TEST_EQUALITY_CONST(sot.tableSize(), 1);
439  TEST_EQUALITY_CONST(sot.numFreeIndexes(), 0);
440  TEST_EQUALITY_CONST(sot.numObjects(), 1);
441 }
442 
443 
444 TEUCHOS_UNIT_TEST( SimpleObjectDB, recycleIndex2 )
445 {
446  ECHO(SimpleObjectDB<A> sot);
447  ECHO(int id = sot.storeNonconstObj(A::create()));
448  TEST_EQUALITY_CONST(id, 0);
449  ECHO(int id2 = sot.storeNonconstObj(A::create()));
450  TEST_EQUALITY_CONST(id2, 1);
451  TEST_EQUALITY_CONST(sot.tableSize(), 2);
452  TEST_EQUALITY_CONST(sot.numFreeIndexes(), 0);
453  TEST_EQUALITY_CONST(sot.numObjects(), 2);
454  ECHO(sot.removeNonconstObj(id));
455  TEST_EQUALITY_CONST(sot.tableSize(), 2);
456  TEST_EQUALITY_CONST(sot.numFreeIndexes(), 1);
457  TEST_EQUALITY_CONST(sot.numObjects(), 1);
458  ECHO(int id3 = sot.storeNonconstObj(A::create()));
459  TEST_EQUALITY_CONST(id3, 0);
460  TEST_EQUALITY_CONST(sot.tableSize(), 2);
461  TEST_EQUALITY_CONST(sot.numFreeIndexes(), 0);
462  TEST_EQUALITY_CONST(sot.numObjects(), 2);
463 }
464 
465 
466 TEUCHOS_UNIT_TEST( SimpleObjectDB, recycleIndex3 )
467 {
468  ECHO(SimpleObjectDB<A> sot);
469  ECHO(int id = sot.storeNonconstObj(A::create()));
470  TEST_EQUALITY_CONST(id, 0);
471  ECHO(int id2 = sot.storeNonconstObj(A::create()));
472  TEST_EQUALITY_CONST(id2, 1);
473  ECHO(int id3 = sot.storeNonconstObj(A::create()));
474  TEST_EQUALITY_CONST(id3, 2);
475  TEST_EQUALITY_CONST(sot.tableSize(), 3);
476  TEST_EQUALITY_CONST(sot.numFreeIndexes(), 0);
477  TEST_EQUALITY_CONST(sot.numObjects(), 3);
478  ECHO(sot.removeNonconstObj(id2));
479  TEST_EQUALITY_CONST(sot.tableSize(), 3);
480  TEST_EQUALITY_CONST(sot.numFreeIndexes(), 1);
481  TEST_EQUALITY_CONST(sot.numObjects(), 2);
482  ECHO(int id4 = sot.storeNonconstObj(A::create()));
483  TEST_EQUALITY_CONST(id4, 1);
484  TEST_EQUALITY_CONST(sot.tableSize(), 3);
485  TEST_EQUALITY_CONST(sot.numFreeIndexes(), 0);
486  TEST_EQUALITY_CONST(sot.numObjects(), 3);
487  ECHO(int id5 = sot.storeNonconstObj(A::create()));
488  TEST_EQUALITY_CONST(id5, 3);
489  TEST_EQUALITY_CONST(sot.tableSize(), 4);
490  TEST_EQUALITY_CONST(sot.numFreeIndexes(), 0);
491  TEST_EQUALITY_CONST(sot.numObjects(), 4);
492 }
493 
494 
495 //
496 // Template Instantiations
497 //
498 
499 
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 )
509 
510 #define UNIT_TEST_GROUP_PAIR( T1, T2 ) \
511  TEUCHOS_UNIT_TEST_TEMPLATE_2_INSTANT( SimpleObjectDB, storeCastedNonconstObj, T1, T2 )
512 
513 #define UNIT_TEST_GROUP_PAIR_SYM( T1, T2 ) \
514  UNIT_TEST_GROUP_PAIR( T1, T2 ) \
515  UNIT_TEST_GROUP_PAIR( T2, T1 )
516 
517 
522 
527 
534 
535 
536 } // namespace
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 &#39;code&#39; throws the exception &#39;ExceptType&#39; (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()
Definition: TestClasses.hpp:96
#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.
Unit testing support.
#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.