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 #ifdef HAVE_TEUCHOS_ARRAY_BOUNDSCHECK
00076   TEST_THROW(sot.getNonconstObjRCP(0), RangeError);
00077   TEST_THROW(sot.getConstObjRCP(0), RangeError);
00078   TEST_THROW(sot.getNonconstObjPtr(0), RangeError);
00079   TEST_THROW(sot.getConstObjPtr(0), RangeError);
00080 #endif // HAVE_TEUCHOS_ARRAY_BOUNDSCHECK
00081 }
00082 
00083 
00084 //
00085 // createSimpleObjectDB()
00086 //
00087 
00088 
00089 TEUCHOS_UNIT_TEST_TEMPLATE_1_DECL( SimpleObjectDB, createSimpleObjectDB, T )
00090 {
00091   ECHO(RCP<SimpleObjectDB<T> > sot = Teuchos::createSimpleObjectDB<T>());
00092   TEST_EQUALITY_CONST(sot->numObjects(), 0);
00093 }
00094 
00095 
00096 //
00097 // SimpleObjectDB::storeNonconstObj()
00098 //
00099 
00100 
00101 TEUCHOS_UNIT_TEST_TEMPLATE_1_DECL( SimpleObjectDB, storeNonconstObj, T )
00102 {
00103   ECHO(SimpleObjectDB<T> sot);
00104   ECHO(const int id = sot.storeNonconstObj(T::create()));
00105   TEST_EQUALITY_CONST(sot.tableSize(), 1);
00106   TEST_EQUALITY_CONST(sot.numFreeIndexes(), 0);
00107   TEST_EQUALITY_CONST(id, 0);
00108   TEST_EQUALITY_CONST(nonnull(sot.getNonconstObjRCP(id)), true);
00109 }
00110 
00111 
00112 //
00113 // SimpleObjectDB::get[Nonconst,Const]Obj[RCP,Ptr]()
00114 //
00115 
00116 
00117 TEUCHOS_UNIT_TEST_TEMPLATE_1_DECL( SimpleObjectDB, getNonconstObjRCP, T )
00118 {
00119   ECHO(SimpleObjectDB<T> sot);
00120   ECHO(const RCP<T> obj = T::create());
00121   ECHO(const int id = sot.storeNonconstObj(obj));
00122   TEST_EQUALITY(obj.get(), sot.getNonconstObjRCP(id).get());
00123 }
00124 
00125 
00126 TEUCHOS_UNIT_TEST_TEMPLATE_1_DECL( SimpleObjectDB, getConstObjRCP, T )
00127 {
00128   ECHO(SimpleObjectDB<T> sot);
00129   ECHO(const RCP<T> obj = T::create());
00130   ECHO(const int id = sot.storeNonconstObj(obj));
00131   TEST_EQUALITY(obj.get(), getConst(sot).getConstObjRCP(id).get());
00132 }
00133 
00134 
00135 TEUCHOS_UNIT_TEST_TEMPLATE_1_DECL( SimpleObjectDB, getNonconstObjPtr, T )
00136 {
00137   ECHO(SimpleObjectDB<T> sot);
00138   ECHO(const RCP<T> obj = T::create());
00139   ECHO(const int id = sot.storeNonconstObj(obj));
00140   TEST_EQUALITY(obj.get(), sot.getNonconstObjPtr(id).get());
00141 }
00142 
00143 
00144 TEUCHOS_UNIT_TEST_TEMPLATE_1_DECL( SimpleObjectDB, getConstObjPtr, T )
00145 {
00146   ECHO(SimpleObjectDB<T> sot);
00147   ECHO(const RCP<T> obj = T::create());
00148   ECHO(const int id = sot.storeNonconstObj(obj));
00149   TEST_EQUALITY(obj.get(), getConst(sot).getConstObjPtr(id).get());
00150 }
00151 
00152 
00153 //
00154 // SimpleObjectDB::storeConstObj(), getNonconstObjRCP()
00155 //
00156 
00157 
00158 TEUCHOS_UNIT_TEST_TEMPLATE_1_DECL( SimpleObjectDB, storeConstObj, T )
00159 {
00160   ECHO(SimpleObjectDB<T> sot);
00161   ECHO(RCP<const T> obj = T::create());
00162   ECHO(const int id = sot.storeConstObj(obj));
00163   TEST_EQUALITY_CONST(id, 0);
00164   TEST_EQUALITY_CONST(sot.tableSize(), 1);
00165   TEST_EQUALITY_CONST(sot.numFreeIndexes(), 0);
00166   TEST_EQUALITY(sot.getConstObjRCP(id).get(), obj.get());
00167   TEST_THROW(sot.getNonconstObjRCP(id), Teuchos::NonconstAccessError);
00168 }
00169 
00170 
00171 TEUCHOS_UNIT_TEST( SimpleObjectDB, storeNonconstObjNull1 )
00172 {
00173   ECHO(SimpleObjectDB<A> sot);
00174   ECHO(RCP<A> rcpA);
00175   TEST_THROW(sot.storeNonconstObj(rcpA), NullReferenceError);
00176   TEST_EQUALITY_CONST(sot.tableSize(), 0);
00177   TEST_EQUALITY_CONST(sot.numFreeIndexes(), 0);
00178 }
00179 
00180 
00181 TEUCHOS_UNIT_TEST( SimpleObjectDB, storeNonconstObjNull2 )
00182 {
00183   ECHO(SimpleObjectDB<A> sot);
00184   ECHO(A *a=NULL);
00185   TEST_THROW(sot.storeNonconstObj(rcp(a)), NullReferenceError);
00186   TEST_EQUALITY_CONST(sot.tableSize(), 0);
00187   TEST_EQUALITY_CONST(sot.numFreeIndexes(), 0);
00188 }
00189 
00190 
00191 TEUCHOS_UNIT_TEST( SimpleObjectDB, storeNonconstObjNull3 )
00192 {
00193   ECHO(SimpleObjectDB<A> sot);
00194   TEST_THROW(sot.storeNonconstObj(Teuchos::null), NullReferenceError);
00195   TEST_EQUALITY_CONST(sot.tableSize(), 0);
00196   TEST_EQUALITY_CONST(sot.numFreeIndexes(), 0);
00197 }
00198 
00199 
00200 //
00201 // SimpleObjectDB::remove[Nonconst,Const]Obj()
00202 //
00203 
00204 
00205 TEUCHOS_UNIT_TEST( SimpleObjectDB, removeObj_storeNonconstObj_1_0 )
00206 {
00207   ECHO(SimpleObjectDB<A> sot);
00208   ECHO(const RCP<A> obj = A::create());
00209   ECHO(const int id1 = sot.storeNonconstObj(obj));
00210   TEST_EQUALITY(sot.getNonconstObjRCP(id1).ptr(), obj.ptr());
00211   ECHO(sot.removeObj(id1));
00212   TEST_EQUALITY_CONST(sot.numObjects(), 0);
00213 }
00214 
00215 
00216 TEUCHOS_UNIT_TEST( SimpleObjectDB, removeObj_storeConstObj_1_0 )
00217 {
00218   ECHO(SimpleObjectDB<A> sot);
00219   ECHO(const RCP<A> obj = A::create());
00220   ECHO(const int id1 = sot.storeConstObj(obj));
00221   TEST_EQUALITY(sot.getConstObjRCP(id1).ptr(), obj.ptr());
00222   ECHO(sot.removeObj(id1));
00223   TEST_EQUALITY_CONST(sot.numObjects(), 0);
00224   ECHO(const int id2 = sot.storeConstObj(obj));
00225   TEST_EQUALITY_CONST(id2, 0);
00226   TEST_EQUALITY(sot.getConstObjRCP(id2).ptr(), obj.ptr());
00227   TEST_EQUALITY_CONST(sot.numObjects(), 1);
00228 }
00229 
00230 
00231 TEUCHOS_UNIT_TEST( SimpleObjectDB, removeNonconstObj_storeNonconstObj_1_0 )
00232 {
00233   ECHO(SimpleObjectDB<A> sot);
00234   ECHO(const RCP<A> obj = A::create());
00235   ECHO(const int id1 = sot.storeNonconstObj(obj));
00236   TEST_EQUALITY(sot.getNonconstObjRCP(id1).ptr(), obj.ptr());
00237   ECHO(const RCP<A> obj2 = sot.removeNonconstObj(id1));
00238   TEST_EQUALITY(obj2.ptr(), obj.ptr());
00239   TEST_EQUALITY_CONST(sot.numObjects(), 0);
00240   ECHO(const int id2 = sot.storeNonconstObj(obj));
00241   TEST_EQUALITY_CONST(id2, 0);
00242   TEST_EQUALITY(sot.getNonconstObjRCP(id2).ptr(), obj.ptr());
00243   TEST_EQUALITY_CONST(sot.numObjects(), 1);
00244 }
00245 
00246 
00247 TEUCHOS_UNIT_TEST( SimpleObjectDB, removeConstObj_storeConstObj_1_0 )
00248 {
00249   ECHO(SimpleObjectDB<A> sot);
00250   ECHO(const RCP<const A> obj = A::create());
00251   ECHO(const int id1 = sot.storeConstObj(obj));
00252   TEST_EQUALITY(sot.getConstObjRCP(id1).ptr(), obj.ptr());
00253   ECHO(const RCP<const A> obj2 = sot.removeConstObj(id1));
00254   TEST_EQUALITY(obj2.ptr(), obj.ptr());
00255   TEST_EQUALITY_CONST(sot.numObjects(), 0);
00256   ECHO(const int id2 = sot.storeConstObj(obj));
00257   TEST_EQUALITY_CONST(id2, 0);
00258   TEST_EQUALITY(sot.getConstObjRCP(id2).ptr(), obj.ptr());
00259   TEST_EQUALITY_CONST(sot.numObjects(), 1);
00260 }
00261 
00262 
00263 #ifdef TEUCHOS_DEBUG
00264 
00265 
00266 TEUCHOS_UNIT_TEST( SimpleObjectDB, removeNonconstObjInvalid1 )
00267 {
00268   ECHO(SimpleObjectDB<A> sot);
00269   ECHO(int id = -1);
00270   TEST_THROW(sot.removeNonconstObj(id), RangeError);
00271 }
00272 
00273 
00274 TEUCHOS_UNIT_TEST( SimpleObjectDB, removeNonconstObjInvalid2 )
00275 {
00276   ECHO(SimpleObjectDB<A> sot);
00277   ECHO(int id = -2);
00278   TEST_THROW(sot.removeNonconstObj(id), RangeError);
00279 }
00280 
00281 
00282 TEUCHOS_UNIT_TEST( SimpleObjectDB, removeNonconstObjInvalid3 )
00283 {
00284   ECHO(SimpleObjectDB<A> sot);
00285   ECHO(int id = 0);
00286   TEST_THROW(sot.removeNonconstObj(id), RangeError);
00287 }
00288 
00289 
00290 TEUCHOS_UNIT_TEST( SimpleObjectDB, removeObjTwice )
00291 {
00292   ECHO(SimpleObjectDB<A> sot);
00293   ECHO(const int id = sot.storeNonconstObj(A::create()));
00294   ECHO(sot.removeObj(id));
00295   TEST_THROW(sot.removeObj(id), NullReferenceError);
00296 }
00297 
00298 
00299 TEUCHOS_UNIT_TEST( SimpleObjectDB, removeNonconstObjTwice )
00300 {
00301   ECHO(SimpleObjectDB<A> sot);
00302   ECHO(const int id = sot.storeNonconstObj(A::create()));
00303   ECHO(sot.removeNonconstObj(id));
00304   TEST_THROW(sot.removeNonconstObj(id), NullReferenceError);
00305 }
00306 
00307 
00308 TEUCHOS_UNIT_TEST( SimpleObjectDB, removeConstObjTwice )
00309 {
00310   ECHO(SimpleObjectDB<A> sot);
00311   ECHO(const int id = sot.storeNonconstObj(A::create()));
00312   ECHO(sot.removeConstObj(id));
00313   TEST_THROW(sot.removeConstObj(id), NullReferenceError);
00314 }
00315 
00316 
00317 #endif // TEUCHOS_DEBUG
00318 
00319 
00320 //
00321 // SimpleObjectDB::getNonconstObjRCP()
00322 //
00323 
00324 
00325 #ifdef TEUCHOS_DEBUG
00326 
00327 
00328 TEUCHOS_UNIT_TEST( SimpleObjectDB, getNonconstObjRCPInvalid1 )
00329 {
00330   ECHO(SimpleObjectDB<A> sot);
00331   ECHO(int id = -1);
00332   TEST_THROW(sot.getNonconstObjRCP(id), RangeError);
00333 }
00334 
00335 TEUCHOS_UNIT_TEST( SimpleObjectDB, getNonconstObjRCPInvalid2 )
00336 {
00337   ECHO(SimpleObjectDB<A> sot);
00338   ECHO(int id = -2);
00339   TEST_THROW(sot.getNonconstObjRCP(id), RangeError);
00340 }
00341 
00342 TEUCHOS_UNIT_TEST( SimpleObjectDB, getNonconstObjRCPInvalid3 )
00343 {
00344   ECHO(SimpleObjectDB<A> sot);
00345   ECHO(int id = 0);
00346   TEST_THROW(sot.getNonconstObjRCP(id), RangeError);
00347 }
00348 
00349 
00350 #endif // TEUCHOS_DEBUG
00351 
00352 
00353 TEUCHOS_UNIT_TEST( SimpleObjectDB, getNonconstObjRCPInvalid4 )
00354 {
00355   ECHO(SimpleObjectDB<A> sot);
00356   ECHO(int id = sot.storeNonconstObj(A::create()));
00357   TEST_EQUALITY_CONST(id, 0);
00358   ECHO(int id2 = sot.storeNonconstObj(A::create()));
00359   TEST_EQUALITY_CONST(id2, 1);
00360   ECHO(sot.removeNonconstObj(id));
00361 #ifdef HAVE_TEUCHOS_ARRAY_BOUNDSCHECK
00362   TEST_THROW(sot.getNonconstObjRCP(id), NullReferenceError);
00363 #endif // HAVE_TEUCHOS_ARRAY_BOUNDSCHECK
00364 }
00365 
00366 
00367 //
00368 // SimpleObjectDB::storeCastedNonconstObj()
00369 //
00370 
00371 
00372 TEUCHOS_UNIT_TEST_TEMPLATE_2_DECL( SimpleObjectDB, storeCastedNonconstObj, T1, T2 )
00373 {
00374   ECHO(SimpleObjectDB<T2> sot);
00375   ECHO(RCP<T1> rcpT1 = rcp(new T1));
00376   ECHO(T2 *pT2 = dynamic_cast<T2*>(rcpT1.get()));
00377   if (pT2 == NULL) {
00378     TEST_THROW(sot.storeCastedNonconstObj(rcpT1), m_bad_cast);
00379   } else {
00380     ECHO(int id = sot.storeCastedNonconstObj(rcpT1));
00381     TEST_EQUALITY_CONST(id, 0);
00382     TEST_EQUALITY_CONST(nonnull(sot.getNonconstObjRCP(id)), true);
00383     TEST_EQUALITY_CONST(rcpT1.shares_resource(sot.getNonconstObjRCP(id)), true);
00384   }
00385 }
00386 
00387 
00388 //
00389 // SimpleObjectDB::purge()
00390 //
00391 
00392 
00393 #ifdef TEUCHOS_DEBUG
00394 
00395 
00396 TEUCHOS_UNIT_TEST( SimpleObjectDB, purge )
00397 {
00398   ECHO(SimpleObjectDB<A> sot);
00399   ECHO(const RCP<A> a(new A));
00400   ECHO(int id = sot.storeNonconstObj(a));
00401   ECHO(int id2 = sot.storeNonconstObj(a));
00402   TEST_EQUALITY_CONST(nonnull(sot.getNonconstObjRCP(id)), true);
00403   TEST_EQUALITY_CONST(nonnull(sot.getNonconstObjRCP(id2)), true);
00404   TEST_EQUALITY_CONST(sot.tableSize(), 2);
00405   TEST_EQUALITY_CONST(sot.numFreeIndexes(), 0);
00406   TEST_EQUALITY_CONST(sot.numObjects(), 2);
00407   ECHO(sot.removeNonconstObj(id));
00408   TEST_EQUALITY_CONST(sot.tableSize(), 2);
00409   TEST_EQUALITY_CONST(sot.numFreeIndexes(), 1);
00410   TEST_EQUALITY_CONST(sot.numObjects(), 1);
00411   ECHO(sot.purge());
00412   TEST_EQUALITY_CONST(sot.tableSize(), 0);
00413   TEST_EQUALITY_CONST(sot.numFreeIndexes(), 0);
00414   TEST_EQUALITY_CONST(sot.numObjects(), 0);
00415   TEST_THROW(sot.getNonconstObjRCP(id), RangeError);
00416   TEST_EQUALITY_CONST(a.count(), 1); // sot gave up its RCP?
00417 }
00418 
00419 
00420 #endif // TEUCHOS_DEBUG
00421 
00422 
00423 //
00424 // SimpleObjectDB's freedIndices table
00425 //
00426 
00427 
00428 TEUCHOS_UNIT_TEST( SimpleObjectDB, recycleIndex1 )
00429 {
00430   ECHO(SimpleObjectDB<A> sot);
00431   ECHO(int id = sot.storeNonconstObj(A::create()));
00432   TEST_EQUALITY_CONST(id, 0);
00433   TEST_EQUALITY_CONST(sot.tableSize(), 1);
00434   TEST_EQUALITY_CONST(sot.numFreeIndexes(), 0);
00435   TEST_EQUALITY_CONST(sot.numObjects(), 1);
00436   ECHO(sot.removeNonconstObj(id));
00437   TEST_EQUALITY_CONST(sot.tableSize(), 1);
00438   TEST_EQUALITY_CONST(sot.numFreeIndexes(), 1);
00439   TEST_EQUALITY_CONST(sot.numObjects(), 0);
00440   ECHO(int id2 = sot.storeNonconstObj(A::create()));
00441   TEST_EQUALITY_CONST(id2, 0);
00442   TEST_EQUALITY_CONST(sot.tableSize(), 1);
00443   TEST_EQUALITY_CONST(sot.numFreeIndexes(), 0);
00444   TEST_EQUALITY_CONST(sot.numObjects(), 1);
00445 }
00446 
00447 
00448 TEUCHOS_UNIT_TEST( SimpleObjectDB, recycleIndex2 )
00449 {
00450   ECHO(SimpleObjectDB<A> sot);
00451   ECHO(int id = sot.storeNonconstObj(A::create()));
00452   TEST_EQUALITY_CONST(id, 0);
00453   ECHO(int id2 = sot.storeNonconstObj(A::create()));
00454   TEST_EQUALITY_CONST(id2, 1);
00455   TEST_EQUALITY_CONST(sot.tableSize(), 2);
00456   TEST_EQUALITY_CONST(sot.numFreeIndexes(), 0);
00457   TEST_EQUALITY_CONST(sot.numObjects(), 2);
00458   ECHO(sot.removeNonconstObj(id));
00459   TEST_EQUALITY_CONST(sot.tableSize(), 2);
00460   TEST_EQUALITY_CONST(sot.numFreeIndexes(), 1);
00461   TEST_EQUALITY_CONST(sot.numObjects(), 1);
00462   ECHO(int id3 = sot.storeNonconstObj(A::create()));
00463   TEST_EQUALITY_CONST(id3, 0);
00464   TEST_EQUALITY_CONST(sot.tableSize(), 2);
00465   TEST_EQUALITY_CONST(sot.numFreeIndexes(), 0);
00466   TEST_EQUALITY_CONST(sot.numObjects(), 2);
00467 }
00468 
00469 
00470 TEUCHOS_UNIT_TEST( SimpleObjectDB, recycleIndex3 )
00471 {
00472   ECHO(SimpleObjectDB<A> sot);
00473   ECHO(int id = sot.storeNonconstObj(A::create()));
00474   TEST_EQUALITY_CONST(id, 0);
00475   ECHO(int id2 = sot.storeNonconstObj(A::create()));
00476   TEST_EQUALITY_CONST(id2, 1);
00477   ECHO(int id3 = sot.storeNonconstObj(A::create()));
00478   TEST_EQUALITY_CONST(id3, 2);
00479   TEST_EQUALITY_CONST(sot.tableSize(), 3);
00480   TEST_EQUALITY_CONST(sot.numFreeIndexes(), 0);
00481   TEST_EQUALITY_CONST(sot.numObjects(), 3);
00482   ECHO(sot.removeNonconstObj(id2));
00483   TEST_EQUALITY_CONST(sot.tableSize(), 3);
00484   TEST_EQUALITY_CONST(sot.numFreeIndexes(), 1);
00485   TEST_EQUALITY_CONST(sot.numObjects(), 2);
00486   ECHO(int id4 = sot.storeNonconstObj(A::create()));
00487   TEST_EQUALITY_CONST(id4, 1);
00488   TEST_EQUALITY_CONST(sot.tableSize(), 3);
00489   TEST_EQUALITY_CONST(sot.numFreeIndexes(), 0);
00490   TEST_EQUALITY_CONST(sot.numObjects(), 3);
00491   ECHO(int id5 = sot.storeNonconstObj(A::create()));
00492   TEST_EQUALITY_CONST(id5, 3);
00493   TEST_EQUALITY_CONST(sot.tableSize(), 4);
00494   TEST_EQUALITY_CONST(sot.numFreeIndexes(), 0);
00495   TEST_EQUALITY_CONST(sot.numObjects(), 4);
00496 }
00497 
00498 
00499 //
00500 // Template Instantiations
00501 //
00502 
00503 
00504 #define UNIT_TEST_GROUP( T ) \
00505   TEUCHOS_UNIT_TEST_TEMPLATE_1_INSTANT( SimpleObjectDB, defaultConstruct, T ) \
00506   TEUCHOS_UNIT_TEST_TEMPLATE_1_INSTANT( SimpleObjectDB, createSimpleObjectDB, T ) \
00507   TEUCHOS_UNIT_TEST_TEMPLATE_1_INSTANT( SimpleObjectDB, storeNonconstObj, T ) \
00508   TEUCHOS_UNIT_TEST_TEMPLATE_1_INSTANT( SimpleObjectDB, getNonconstObjRCP, T ) \
00509   TEUCHOS_UNIT_TEST_TEMPLATE_1_INSTANT( SimpleObjectDB, getConstObjRCP, T ) \
00510   TEUCHOS_UNIT_TEST_TEMPLATE_1_INSTANT( SimpleObjectDB, getNonconstObjPtr, T ) \
00511   TEUCHOS_UNIT_TEST_TEMPLATE_1_INSTANT( SimpleObjectDB, getConstObjPtr, T ) \
00512   TEUCHOS_UNIT_TEST_TEMPLATE_1_INSTANT( SimpleObjectDB, storeConstObj, T )
00513 
00514 #define UNIT_TEST_GROUP_PAIR( T1, T2 ) \
00515   TEUCHOS_UNIT_TEST_TEMPLATE_2_INSTANT( SimpleObjectDB, storeCastedNonconstObj, T1, T2 )
00516 
00517 #define UNIT_TEST_GROUP_PAIR_SYM( T1, T2 ) \
00518   UNIT_TEST_GROUP_PAIR( T1, T2 ) \
00519   UNIT_TEST_GROUP_PAIR( T2, T1 )
00520 
00521 
00522 UNIT_TEST_GROUP(A)
00523 UNIT_TEST_GROUP(B1)
00524 UNIT_TEST_GROUP(B2)
00525 UNIT_TEST_GROUP(C)
00526 
00527 UNIT_TEST_GROUP_PAIR(A, A)
00528 UNIT_TEST_GROUP_PAIR(B1, B1)
00529 UNIT_TEST_GROUP_PAIR(B2, B2)
00530 UNIT_TEST_GROUP_PAIR(C, C)
00531 
00532 UNIT_TEST_GROUP_PAIR_SYM(A, B1)
00533 UNIT_TEST_GROUP_PAIR_SYM(A, B2)
00534 UNIT_TEST_GROUP_PAIR_SYM(A, C)
00535 UNIT_TEST_GROUP_PAIR_SYM(B1, B2)
00536 UNIT_TEST_GROUP_PAIR_SYM(B1, C)
00537 UNIT_TEST_GROUP_PAIR_SYM(B2, C)
00538 
00539 
00540 } // namespace
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines