Teuchos Package Browser (Single Doxygen Collection) Version of the Day
SimpleObjectDB_UnitTests.cpp
Go to the documentation of this file.
00001 /*
00002 // @HEADER
00003 // ***********************************************************************
00004 //
00005 //                    Teuchos: Common Tools Package
00006 //                 Copyright (2004) Sandia Corporation
00007 //
00008 // Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive
00009 // license for use of this work by or on behalf of the U.S. Government.
00010 //
00011 // Redistribution and use in source and binary forms, with or without
00012 // modification, are permitted provided that the following conditions are
00013 // met:
00014 //
00015 // 1. Redistributions of source code must retain the above copyright
00016 // notice, this list of conditions and the following disclaimer.
00017 //
00018 // 2. Redistributions in binary form must reproduce the above copyright
00019 // notice, this list of conditions and the following disclaimer in the
00020 // documentation and/or other materials provided with the distribution.
00021 //
00022 // 3. Neither the name of the Corporation nor the names of the
00023 // contributors may be used to endorse or promote products derived from
00024 // this software without specific prior written permission.
00025 //
00026 // THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
00027 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00028 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
00029 // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
00030 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
00031 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
00032 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
00033 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
00034 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
00035 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
00036 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00037 //
00038 // Questions? Contact Michael A. Heroux (maherou@sandia.gov)
00039 //
00040 // ***********************************************************************
00041 // @HEADER
00042 */
00043 
00044 #include "Teuchos_SimpleObjectDB.hpp"
00045 #include "Teuchos_getConst.hpp"
00046 
00047 #include "TestClasses.hpp"
00048 #include "Teuchos_UnitTestHarness.hpp"
00049 
00050 
00051 namespace {
00052 
00053 
00054 using Teuchos::null;
00055 using Teuchos::RCP;
00056 using Teuchos::rcp;
00057 using Teuchos::RangeError;
00058 using Teuchos::NullReferenceError;
00059 using Teuchos::m_bad_cast;
00060 using Teuchos::SimpleObjectDB;
00061 using Teuchos::getConst;
00062 
00063 
00064 //
00065 // SimpleObjectDB::SimpleObjectDB()
00066 //
00067 
00068 
00069 TEUCHOS_UNIT_TEST_TEMPLATE_1_DECL( SimpleObjectDB, defaultConstruct, T )
00070 {
00071   ECHO(SimpleObjectDB<T> sot);
00072   TEST_EQUALITY_CONST(sot.tableSize(), 0);
00073   TEST_EQUALITY_CONST(sot.numFreeIndexes(), 0);
00074   TEST_EQUALITY_CONST(sot.numObjects(), 0);
00075   TEST_THROW(sot.getNonconstObjRCP(0), RangeError);
00076   TEST_THROW(sot.getConstObjRCP(0), RangeError);
00077   TEST_THROW(sot.getNonconstObjPtr(0), RangeError);
00078   TEST_THROW(sot.getConstObjPtr(0), RangeError);
00079 }
00080 
00081 
00082 //
00083 // createSimpleObjectDB()
00084 //
00085 
00086 
00087 TEUCHOS_UNIT_TEST_TEMPLATE_1_DECL( SimpleObjectDB, createSimpleObjectDB, T )
00088 {
00089   ECHO(RCP<SimpleObjectDB<T> > sot = Teuchos::createSimpleObjectDB<T>());
00090   TEST_EQUALITY_CONST(sot->numObjects(), 0);
00091 }
00092 
00093 
00094 //
00095 // SimpleObjectDB::storeNonconstObj()
00096 //
00097 
00098 
00099 TEUCHOS_UNIT_TEST_TEMPLATE_1_DECL( SimpleObjectDB, storeNonconstObj, T )
00100 {
00101   ECHO(SimpleObjectDB<T> sot);
00102   ECHO(const int id = sot.storeNonconstObj(T::create()));
00103   TEST_EQUALITY_CONST(sot.tableSize(), 1);
00104   TEST_EQUALITY_CONST(sot.numFreeIndexes(), 0);
00105   TEST_EQUALITY_CONST(id, 0);
00106   TEST_EQUALITY_CONST(nonnull(sot.getNonconstObjRCP(id)), true);
00107 }
00108 
00109 
00110 //
00111 // SimpleObjectDB::get[Nonconst,Const]Obj[RCP,Ptr]()
00112 //
00113 
00114 
00115 TEUCHOS_UNIT_TEST_TEMPLATE_1_DECL( SimpleObjectDB, getNonconstObjRCP, T )
00116 {
00117   ECHO(SimpleObjectDB<T> sot);
00118   ECHO(const RCP<T> obj = T::create());
00119   ECHO(const int id = sot.storeNonconstObj(obj));
00120   TEST_EQUALITY(obj.get(), sot.getNonconstObjRCP(id).get());
00121 }
00122 
00123 
00124 TEUCHOS_UNIT_TEST_TEMPLATE_1_DECL( SimpleObjectDB, getConstObjRCP, T )
00125 {
00126   ECHO(SimpleObjectDB<T> sot);
00127   ECHO(const RCP<T> obj = T::create());
00128   ECHO(const int id = sot.storeNonconstObj(obj));
00129   TEST_EQUALITY(obj.get(), getConst(sot).getConstObjRCP(id).get());
00130 }
00131 
00132 
00133 TEUCHOS_UNIT_TEST_TEMPLATE_1_DECL( SimpleObjectDB, getNonconstObjPtr, T )
00134 {
00135   ECHO(SimpleObjectDB<T> sot);
00136   ECHO(const RCP<T> obj = T::create());
00137   ECHO(const int id = sot.storeNonconstObj(obj));
00138   TEST_EQUALITY(obj.get(), sot.getNonconstObjPtr(id).get());
00139 }
00140 
00141 
00142 TEUCHOS_UNIT_TEST_TEMPLATE_1_DECL( SimpleObjectDB, getConstObjPtr, T )
00143 {
00144   ECHO(SimpleObjectDB<T> sot);
00145   ECHO(const RCP<T> obj = T::create());
00146   ECHO(const int id = sot.storeNonconstObj(obj));
00147   TEST_EQUALITY(obj.get(), getConst(sot).getConstObjPtr(id).get());
00148 }
00149 
00150 
00151 //
00152 // SimpleObjectDB::storeConstObj(), getNonconstObjRCP()
00153 //
00154 
00155 
00156 TEUCHOS_UNIT_TEST_TEMPLATE_1_DECL( SimpleObjectDB, storeConstObj, T )
00157 {
00158   ECHO(SimpleObjectDB<T> sot);
00159   ECHO(RCP<const T> obj = T::create());
00160   ECHO(const int id = sot.storeConstObj(obj));
00161   TEST_EQUALITY_CONST(id, 0);
00162   TEST_EQUALITY_CONST(sot.tableSize(), 1);
00163   TEST_EQUALITY_CONST(sot.numFreeIndexes(), 0);
00164   TEST_EQUALITY(sot.getConstObjRCP(id).get(), obj.get());
00165   TEST_THROW(sot.getNonconstObjRCP(id), Teuchos::NonconstAccessError);
00166 }
00167 
00168 
00169 TEUCHOS_UNIT_TEST( SimpleObjectDB, storeNonconstObjNull1 )
00170 {
00171   ECHO(SimpleObjectDB<A> sot);
00172   ECHO(RCP<A> rcpA);
00173   TEST_THROW(sot.storeNonconstObj(rcpA), NullReferenceError);
00174   TEST_EQUALITY_CONST(sot.tableSize(), 0);
00175   TEST_EQUALITY_CONST(sot.numFreeIndexes(), 0);
00176 }
00177 
00178 
00179 TEUCHOS_UNIT_TEST( SimpleObjectDB, storeNonconstObjNull2 )
00180 {
00181   ECHO(SimpleObjectDB<A> sot);
00182   ECHO(A *a=NULL);
00183   TEST_THROW(sot.storeNonconstObj(rcp(a)), NullReferenceError);
00184   TEST_EQUALITY_CONST(sot.tableSize(), 0);
00185   TEST_EQUALITY_CONST(sot.numFreeIndexes(), 0);
00186 }
00187 
00188 
00189 TEUCHOS_UNIT_TEST( SimpleObjectDB, storeNonconstObjNull3 )
00190 {
00191   ECHO(SimpleObjectDB<A> sot);
00192   TEST_THROW(sot.storeNonconstObj(Teuchos::null), NullReferenceError);
00193   TEST_EQUALITY_CONST(sot.tableSize(), 0);
00194   TEST_EQUALITY_CONST(sot.numFreeIndexes(), 0);
00195 }
00196 
00197 
00198 //
00199 // SimpleObjectDB::remove[Nonconst,Const]Obj()
00200 //
00201 
00202 
00203 TEUCHOS_UNIT_TEST( SimpleObjectDB, removeObj_storeNonconstObj_1_0 )
00204 {
00205   ECHO(SimpleObjectDB<A> sot);
00206   ECHO(const RCP<A> obj = A::create());
00207   ECHO(const int id1 = sot.storeNonconstObj(obj));
00208   TEST_EQUALITY(sot.getNonconstObjRCP(id1).ptr(), obj.ptr());
00209   ECHO(sot.removeObj(id1));
00210   TEST_EQUALITY_CONST(sot.numObjects(), 0);
00211 }
00212 
00213 
00214 TEUCHOS_UNIT_TEST( SimpleObjectDB, removeObj_storeConstObj_1_0 )
00215 {
00216   ECHO(SimpleObjectDB<A> sot);
00217   ECHO(const RCP<A> obj = A::create());
00218   ECHO(const int id1 = sot.storeConstObj(obj));
00219   TEST_EQUALITY(sot.getConstObjRCP(id1).ptr(), obj.ptr());
00220   ECHO(sot.removeObj(id1));
00221   TEST_EQUALITY_CONST(sot.numObjects(), 0);
00222   ECHO(const int id2 = sot.storeConstObj(obj));
00223   TEST_EQUALITY_CONST(id2, 0);
00224   TEST_EQUALITY(sot.getConstObjRCP(id2).ptr(), obj.ptr());
00225   TEST_EQUALITY_CONST(sot.numObjects(), 1);
00226 }
00227 
00228 
00229 TEUCHOS_UNIT_TEST( SimpleObjectDB, removeNonconstObj_storeNonconstObj_1_0 )
00230 {
00231   ECHO(SimpleObjectDB<A> sot);
00232   ECHO(const RCP<A> obj = A::create());
00233   ECHO(const int id1 = sot.storeNonconstObj(obj));
00234   TEST_EQUALITY(sot.getNonconstObjRCP(id1).ptr(), obj.ptr());
00235   ECHO(const RCP<A> obj2 = sot.removeNonconstObj(id1));
00236   TEST_EQUALITY(obj2.ptr(), obj.ptr());
00237   TEST_EQUALITY_CONST(sot.numObjects(), 0);
00238   ECHO(const int id2 = sot.storeNonconstObj(obj));
00239   TEST_EQUALITY_CONST(id2, 0);
00240   TEST_EQUALITY(sot.getNonconstObjRCP(id2).ptr(), obj.ptr());
00241   TEST_EQUALITY_CONST(sot.numObjects(), 1);
00242 }
00243 
00244 
00245 TEUCHOS_UNIT_TEST( SimpleObjectDB, removeConstObj_storeConstObj_1_0 )
00246 {
00247   ECHO(SimpleObjectDB<A> sot);
00248   ECHO(const RCP<const A> obj = A::create());
00249   ECHO(const int id1 = sot.storeConstObj(obj));
00250   TEST_EQUALITY(sot.getConstObjRCP(id1).ptr(), obj.ptr());
00251   ECHO(const RCP<const A> obj2 = sot.removeConstObj(id1));
00252   TEST_EQUALITY(obj2.ptr(), obj.ptr());
00253   TEST_EQUALITY_CONST(sot.numObjects(), 0);
00254   ECHO(const int id2 = sot.storeConstObj(obj));
00255   TEST_EQUALITY_CONST(id2, 0);
00256   TEST_EQUALITY(sot.getConstObjRCP(id2).ptr(), obj.ptr());
00257   TEST_EQUALITY_CONST(sot.numObjects(), 1);
00258 }
00259 
00260 
00261 #ifdef TEUCHOS_DEBUG
00262 
00263 
00264 TEUCHOS_UNIT_TEST( SimpleObjectDB, removeNonconstObjInvalid1 )
00265 {
00266   ECHO(SimpleObjectDB<A> sot);
00267   ECHO(int id = -1);
00268   TEST_THROW(sot.removeNonconstObj(id), RangeError);
00269 }
00270 
00271 
00272 TEUCHOS_UNIT_TEST( SimpleObjectDB, removeNonconstObjInvalid2 )
00273 {
00274   ECHO(SimpleObjectDB<A> sot);
00275   ECHO(int id = -2);
00276   TEST_THROW(sot.removeNonconstObj(id), RangeError);
00277 }
00278 
00279 
00280 TEUCHOS_UNIT_TEST( SimpleObjectDB, removeNonconstObjInvalid3 )
00281 {
00282   ECHO(SimpleObjectDB<A> sot);
00283   ECHO(int id = 0);
00284   TEST_THROW(sot.removeNonconstObj(id), RangeError);
00285 }
00286 
00287 
00288 TEUCHOS_UNIT_TEST( SimpleObjectDB, removeObjTwice )
00289 {
00290   ECHO(SimpleObjectDB<A> sot);
00291   ECHO(const int id = sot.storeNonconstObj(A::create()));
00292   ECHO(sot.removeObj(id));
00293   TEST_THROW(sot.removeObj(id), NullReferenceError);
00294 }
00295 
00296 
00297 TEUCHOS_UNIT_TEST( SimpleObjectDB, removeNonconstObjTwice )
00298 {
00299   ECHO(SimpleObjectDB<A> sot);
00300   ECHO(const int id = sot.storeNonconstObj(A::create()));
00301   ECHO(sot.removeNonconstObj(id));
00302   TEST_THROW(sot.removeNonconstObj(id), NullReferenceError);
00303 }
00304 
00305 
00306 TEUCHOS_UNIT_TEST( SimpleObjectDB, removeConstObjTwice )
00307 {
00308   ECHO(SimpleObjectDB<A> sot);
00309   ECHO(const int id = sot.storeNonconstObj(A::create()));
00310   ECHO(sot.removeConstObj(id));
00311   TEST_THROW(sot.removeConstObj(id), NullReferenceError);
00312 }
00313 
00314 
00315 #endif // TEUCHOS_DEBUG
00316 
00317 
00318 //
00319 // SimpleObjectDB::getNonconstObjRCP()
00320 //
00321 
00322 
00323 #ifdef TEUCHOS_DEBUG
00324 
00325 
00326 TEUCHOS_UNIT_TEST( SimpleObjectDB, getNonconstObjRCPInvalid1 )
00327 {
00328   ECHO(SimpleObjectDB<A> sot);
00329   ECHO(int id = -1);
00330   TEST_THROW(sot.getNonconstObjRCP(id), RangeError);
00331 }
00332 
00333 TEUCHOS_UNIT_TEST( SimpleObjectDB, getNonconstObjRCPInvalid2 )
00334 {
00335   ECHO(SimpleObjectDB<A> sot);
00336   ECHO(int id = -2);
00337   TEST_THROW(sot.getNonconstObjRCP(id), RangeError);
00338 }
00339 
00340 TEUCHOS_UNIT_TEST( SimpleObjectDB, getNonconstObjRCPInvalid3 )
00341 {
00342   ECHO(SimpleObjectDB<A> sot);
00343   ECHO(int id = 0);
00344   TEST_THROW(sot.getNonconstObjRCP(id), RangeError);
00345 }
00346 
00347 
00348 #endif // TEUCHOS_DEBUG
00349 
00350 
00351 TEUCHOS_UNIT_TEST( SimpleObjectDB, getNonconstObjRCPInvalid4 )
00352 {
00353   ECHO(SimpleObjectDB<A> sot);
00354   ECHO(int id = sot.storeNonconstObj(A::create()));
00355   TEST_EQUALITY_CONST(id, 0);
00356   ECHO(int id2 = sot.storeNonconstObj(A::create()));
00357   TEST_EQUALITY_CONST(id2, 1);
00358   ECHO(sot.removeNonconstObj(id));
00359   TEST_THROW(sot.getNonconstObjRCP(id), NullReferenceError);
00360 }
00361 
00362 
00363 //
00364 // SimpleObjectDB::storeCastedNonconstObj()
00365 //
00366 
00367 
00368 TEUCHOS_UNIT_TEST_TEMPLATE_2_DECL( SimpleObjectDB, storeCastedNonconstObj, T1, T2 )
00369 {
00370   ECHO(SimpleObjectDB<T2> sot);
00371   ECHO(RCP<T1> rcpT1 = rcp(new T1));
00372   ECHO(T2 *pT2 = dynamic_cast<T2*>(rcpT1.get()));
00373   if (pT2 == NULL) {
00374     TEST_THROW(sot.storeCastedNonconstObj(rcpT1), m_bad_cast);
00375   } else {
00376     ECHO(int id = sot.storeCastedNonconstObj(rcpT1));
00377     TEST_EQUALITY_CONST(id, 0);
00378     TEST_EQUALITY_CONST(nonnull(sot.getNonconstObjRCP(id)), true);
00379     TEST_EQUALITY_CONST(rcpT1.shares_resource(sot.getNonconstObjRCP(id)), true);
00380   }
00381 }
00382 
00383 
00384 //
00385 // SimpleObjectDB::purge()
00386 //
00387 
00388 
00389 #ifdef TEUCHOS_DEBUG
00390 
00391 
00392 TEUCHOS_UNIT_TEST( SimpleObjectDB, purge )
00393 {
00394   ECHO(SimpleObjectDB<A> sot);
00395   ECHO(const RCP<A> a(new A));
00396   ECHO(int id = sot.storeNonconstObj(a));
00397   ECHO(int id2 = sot.storeNonconstObj(a));
00398   TEST_EQUALITY_CONST(nonnull(sot.getNonconstObjRCP(id)), true);
00399   TEST_EQUALITY_CONST(nonnull(sot.getNonconstObjRCP(id2)), true);
00400   TEST_EQUALITY_CONST(sot.tableSize(), 2);
00401   TEST_EQUALITY_CONST(sot.numFreeIndexes(), 0);
00402   TEST_EQUALITY_CONST(sot.numObjects(), 2);
00403   ECHO(sot.removeNonconstObj(id));
00404   TEST_EQUALITY_CONST(sot.tableSize(), 2);
00405   TEST_EQUALITY_CONST(sot.numFreeIndexes(), 1);
00406   TEST_EQUALITY_CONST(sot.numObjects(), 1);
00407   ECHO(sot.purge());
00408   TEST_EQUALITY_CONST(sot.tableSize(), 0);
00409   TEST_EQUALITY_CONST(sot.numFreeIndexes(), 0);
00410   TEST_EQUALITY_CONST(sot.numObjects(), 0);
00411   TEST_THROW(sot.getNonconstObjRCP(id), RangeError);
00412   TEST_EQUALITY_CONST(a.strong_count(), 1); // sot gave up its RCP?
00413 }
00414 
00415 
00416 #endif // TEUCHOS_DEBUG
00417 
00418 
00419 //
00420 // SimpleObjectDB's freedIndices table
00421 //
00422 
00423 
00424 TEUCHOS_UNIT_TEST( SimpleObjectDB, recycleIndex1 )
00425 {
00426   ECHO(SimpleObjectDB<A> sot);
00427   ECHO(int id = sot.storeNonconstObj(A::create()));
00428   TEST_EQUALITY_CONST(id, 0);
00429   TEST_EQUALITY_CONST(sot.tableSize(), 1);
00430   TEST_EQUALITY_CONST(sot.numFreeIndexes(), 0);
00431   TEST_EQUALITY_CONST(sot.numObjects(), 1);
00432   ECHO(sot.removeNonconstObj(id));
00433   TEST_EQUALITY_CONST(sot.tableSize(), 1);
00434   TEST_EQUALITY_CONST(sot.numFreeIndexes(), 1);
00435   TEST_EQUALITY_CONST(sot.numObjects(), 0);
00436   ECHO(int id2 = sot.storeNonconstObj(A::create()));
00437   TEST_EQUALITY_CONST(id2, 0);
00438   TEST_EQUALITY_CONST(sot.tableSize(), 1);
00439   TEST_EQUALITY_CONST(sot.numFreeIndexes(), 0);
00440   TEST_EQUALITY_CONST(sot.numObjects(), 1);
00441 }
00442 
00443 
00444 TEUCHOS_UNIT_TEST( SimpleObjectDB, recycleIndex2 )
00445 {
00446   ECHO(SimpleObjectDB<A> sot);
00447   ECHO(int id = sot.storeNonconstObj(A::create()));
00448   TEST_EQUALITY_CONST(id, 0);
00449   ECHO(int id2 = sot.storeNonconstObj(A::create()));
00450   TEST_EQUALITY_CONST(id2, 1);
00451   TEST_EQUALITY_CONST(sot.tableSize(), 2);
00452   TEST_EQUALITY_CONST(sot.numFreeIndexes(), 0);
00453   TEST_EQUALITY_CONST(sot.numObjects(), 2);
00454   ECHO(sot.removeNonconstObj(id));
00455   TEST_EQUALITY_CONST(sot.tableSize(), 2);
00456   TEST_EQUALITY_CONST(sot.numFreeIndexes(), 1);
00457   TEST_EQUALITY_CONST(sot.numObjects(), 1);
00458   ECHO(int id3 = sot.storeNonconstObj(A::create()));
00459   TEST_EQUALITY_CONST(id3, 0);
00460   TEST_EQUALITY_CONST(sot.tableSize(), 2);
00461   TEST_EQUALITY_CONST(sot.numFreeIndexes(), 0);
00462   TEST_EQUALITY_CONST(sot.numObjects(), 2);
00463 }
00464 
00465 
00466 TEUCHOS_UNIT_TEST( SimpleObjectDB, recycleIndex3 )
00467 {
00468   ECHO(SimpleObjectDB<A> sot);
00469   ECHO(int id = sot.storeNonconstObj(A::create()));
00470   TEST_EQUALITY_CONST(id, 0);
00471   ECHO(int id2 = sot.storeNonconstObj(A::create()));
00472   TEST_EQUALITY_CONST(id2, 1);
00473   ECHO(int id3 = sot.storeNonconstObj(A::create()));
00474   TEST_EQUALITY_CONST(id3, 2);
00475   TEST_EQUALITY_CONST(sot.tableSize(), 3);
00476   TEST_EQUALITY_CONST(sot.numFreeIndexes(), 0);
00477   TEST_EQUALITY_CONST(sot.numObjects(), 3);
00478   ECHO(sot.removeNonconstObj(id2));
00479   TEST_EQUALITY_CONST(sot.tableSize(), 3);
00480   TEST_EQUALITY_CONST(sot.numFreeIndexes(), 1);
00481   TEST_EQUALITY_CONST(sot.numObjects(), 2);
00482   ECHO(int id4 = sot.storeNonconstObj(A::create()));
00483   TEST_EQUALITY_CONST(id4, 1);
00484   TEST_EQUALITY_CONST(sot.tableSize(), 3);
00485   TEST_EQUALITY_CONST(sot.numFreeIndexes(), 0);
00486   TEST_EQUALITY_CONST(sot.numObjects(), 3);
00487   ECHO(int id5 = sot.storeNonconstObj(A::create()));
00488   TEST_EQUALITY_CONST(id5, 3);
00489   TEST_EQUALITY_CONST(sot.tableSize(), 4);
00490   TEST_EQUALITY_CONST(sot.numFreeIndexes(), 0);
00491   TEST_EQUALITY_CONST(sot.numObjects(), 4);
00492 }
00493 
00494 
00495 //
00496 // Template Instantiations
00497 //
00498 
00499 
00500 #define UNIT_TEST_GROUP( T ) \
00501   TEUCHOS_UNIT_TEST_TEMPLATE_1_INSTANT( SimpleObjectDB, defaultConstruct, T ) \
00502   TEUCHOS_UNIT_TEST_TEMPLATE_1_INSTANT( SimpleObjectDB, createSimpleObjectDB, T ) \
00503   TEUCHOS_UNIT_TEST_TEMPLATE_1_INSTANT( SimpleObjectDB, storeNonconstObj, T ) \
00504   TEUCHOS_UNIT_TEST_TEMPLATE_1_INSTANT( SimpleObjectDB, getNonconstObjRCP, T ) \
00505   TEUCHOS_UNIT_TEST_TEMPLATE_1_INSTANT( SimpleObjectDB, getConstObjRCP, T ) \
00506   TEUCHOS_UNIT_TEST_TEMPLATE_1_INSTANT( SimpleObjectDB, getNonconstObjPtr, T ) \
00507   TEUCHOS_UNIT_TEST_TEMPLATE_1_INSTANT( SimpleObjectDB, getConstObjPtr, T ) \
00508   TEUCHOS_UNIT_TEST_TEMPLATE_1_INSTANT( SimpleObjectDB, storeConstObj, T )
00509 
00510 #define UNIT_TEST_GROUP_PAIR( T1, T2 ) \
00511   TEUCHOS_UNIT_TEST_TEMPLATE_2_INSTANT( SimpleObjectDB, storeCastedNonconstObj, T1, T2 )
00512 
00513 #define UNIT_TEST_GROUP_PAIR_SYM( T1, T2 ) \
00514   UNIT_TEST_GROUP_PAIR( T1, T2 ) \
00515   UNIT_TEST_GROUP_PAIR( T2, T1 )
00516 
00517 
00518 UNIT_TEST_GROUP(A)
00519 UNIT_TEST_GROUP(B1)
00520 UNIT_TEST_GROUP(B2)
00521 UNIT_TEST_GROUP(C)
00522 
00523 UNIT_TEST_GROUP_PAIR(A, A)
00524 UNIT_TEST_GROUP_PAIR(B1, B1)
00525 UNIT_TEST_GROUP_PAIR(B2, B2)
00526 UNIT_TEST_GROUP_PAIR(C, C)
00527 
00528 UNIT_TEST_GROUP_PAIR_SYM(A, B1)
00529 UNIT_TEST_GROUP_PAIR_SYM(A, B2)
00530 UNIT_TEST_GROUP_PAIR_SYM(A, C)
00531 UNIT_TEST_GROUP_PAIR_SYM(B1, B2)
00532 UNIT_TEST_GROUP_PAIR_SYM(B1, C)
00533 UNIT_TEST_GROUP_PAIR_SYM(B2, C)
00534 
00535 
00536 } // namespace
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines