ArrayRCP_UnitTests.cpp

Go to the documentation of this file.
00001 #include "Teuchos_UnitTestHarness.hpp"
00002 #include "Array_UnitTest_helpers.hpp"
00003 #include "TestClasses.hpp"
00004 #include "Teuchos_ArrayRCP.hpp"
00005 #include "Teuchos_RCP.hpp"
00006 #include "Teuchos_implicit_cast.hpp"
00007 #include "Teuchos_as.hpp"
00008 #include "Teuchos_getRawPtr.hpp"
00009 
00010 namespace {
00011 
00012 using ArrayUnitTestHelpers::n;
00013 using ArrayUnitTestHelpers::generateArray;
00014 
00015 typedef Teuchos_Ordinal Ordinal;
00016 using Teuchos::getRawPtr;
00017 using Teuchos::as;
00018 using Teuchos::null;
00019 using Teuchos::rcp;
00020 using Teuchos::RCP;
00021 using Teuchos::ArrayRCP;
00022 using Teuchos::Array;
00023 using Teuchos::arcp;
00024 using Teuchos::arcpCloneNode;
00025 using Teuchos::arcp_reinterpret_cast;
00026 using Teuchos::arcp_reinterpret_cast_nonpod;
00027 using Teuchos::ArrayView;
00028 using Teuchos::getConst;
00029 using Teuchos::DuplicateOwningRCPError;
00030 using Teuchos::NullReferenceError;
00031 using Teuchos::DanglingReferenceError;
00032 using Teuchos::RangeError;
00033 using Teuchos::RCP_STRONG;
00034 using Teuchos::RCP_WEAK;
00035 using Teuchos::RCP_STRENGTH_INVALID;
00036 using Teuchos::implicit_ptr_cast;
00037 using Teuchos::getRawPtr;
00038 
00039 
00040 //
00041 // Non templated unit tests
00042 //
00043 
00044 
00045 TEUCHOS_UNIT_TEST( ArrayRCP, memberPointer )
00046 {
00047   ArrayRCP<A> a_arcp = arcp<A>(1);
00048   TEST_EQUALITY_CONST( a_arcp->A_f(), A_f_return );
00049 }
00050 
00051 
00052 TEUCHOS_UNIT_TEST( ArrayRCP, getConst_null )
00053 {
00054   const ArrayRCP<A> a1_arcp;
00055   const ArrayRCP<const A> a2_arcp = a1_arcp.getConst();
00056   TEST_ASSERT(is_null(a2_arcp));
00057 }
00058 
00059 
00060 TEUCHOS_UNIT_TEST( ArrayRCP, operator_parenth_ArrayView_null )
00061 {
00062   const ArrayRCP<A> a_arcp;
00063   const ArrayView<A> av = a_arcp();
00064   TEST_ASSERT(is_null(av));
00065 }
00066 
00067 
00068 TEUCHOS_UNIT_TEST( ArrayRCP, operator_parenth_ArrayView_const_null )
00069 {
00070   const ArrayRCP<const A> a_arcp;
00071   const ArrayView<const A> av = a_arcp();
00072   TEST_ASSERT(is_null(av));
00073 }
00074 
00075 
00076 TEUCHOS_UNIT_TEST( ArrayRCP, implicit_ArrayRCP_const )
00077 {
00078   const ArrayRCP<A> a_arcp;
00079   const ArrayRCP<const A> ac_arcp = a_arcp;
00080   TEST_ASSERT(is_null(ac_arcp));
00081 }
00082 
00083 
00084 TEUCHOS_UNIT_TEST( ArrayRCP, release )
00085 {
00086   ArrayRCP<A> a_arcp = arcp<A>(1);
00087   delete [] a_arcp.release();
00088 }
00089 
00090 
00091 TEUCHOS_UNIT_TEST( ArrayRCP, arcp_null )
00092 {
00093   ArrayRCP<A> a_arcp = arcp<A>(0, 0, -1, false);
00094   TEST_ASSERT(is_null(a_arcp));
00095 }
00096 
00097 
00098 TEUCHOS_UNIT_TEST( ArrayRCP, arcp_dealloc_null )
00099 {
00100   ArrayRCP<A> a_arcp = arcp<A, Teuchos::DeallocNull<A> >(0, 0, -1,
00101     Teuchos::DeallocNull<A>(), false);
00102   TEST_ASSERT(is_null(a_arcp));
00103 }
00104 
00105 
00106 TEUCHOS_UNIT_TEST( ArrayRCP, convert_from_vector_null )
00107 {
00108   const RCP<std::vector<int> > v_rcp;
00109   const ArrayRCP<int> a_arcp = arcp(v_rcp);
00110   TEST_ASSERT(is_null(a_arcp));
00111 }
00112 
00113 
00114 TEUCHOS_UNIT_TEST( ArrayRCP, convert_from_const_vector_null )
00115 {
00116   const RCP<const std::vector<int> > v_rcp;
00117   const ArrayRCP<const int> a_arcp = arcp(v_rcp);
00118   TEST_ASSERT(is_null(a_arcp));
00119 }
00120 
00121 
00122 TEUCHOS_UNIT_TEST( ArrayRCP, convert_from_vector_unsized )
00123 {
00124   const RCP<std::vector<int> > v_rcp = rcp(new std::vector<int>);
00125   const ArrayRCP<int> a_arcp = arcp(v_rcp);
00126   TEST_ASSERT(is_null(a_arcp));
00127 }
00128 
00129 
00130 TEUCHOS_UNIT_TEST( ArrayRCP, convert_from_const_vector_unsized )
00131 {
00132   const RCP<const std::vector<int> > v_rcp = rcp(new std::vector<int>);
00133   const ArrayRCP<const int> a_arcp = arcp(v_rcp);
00134   TEST_ASSERT(is_null(a_arcp));
00135 }
00136 
00137 
00138 TEUCHOS_UNIT_TEST( ArrayRCP, arcpWithEmbeddedObj )
00139 {
00140   const ArrayRCP<const int> a_arcp =
00141     Teuchos::arcpWithEmbeddedObj<int>(new int[1], 0, 1, as<int>(1), true);
00142   const int embeddedObj = Teuchos::getEmbeddedObj<int,int>(a_arcp); 
00143   TEST_EQUALITY_CONST( embeddedObj, as<int>(1) );
00144 }
00145 
00146 
00147 TEUCHOS_UNIT_TEST( ArrayRCP, nonnull )
00148 {
00149   ECHO(ArrayRCP<int> a_arcp = arcp<int>(10));
00150   TEST_EQUALITY_CONST(is_null(a_arcp), false);
00151   TEST_EQUALITY_CONST(nonnull(a_arcp), true);
00152   ECHO(a_arcp = null);
00153   TEST_EQUALITY_CONST(is_null(a_arcp), true);
00154   TEST_EQUALITY_CONST(nonnull(a_arcp), false);
00155 }
00156 
00157 
00158 TEUCHOS_UNIT_TEST( ArrayRCP, weak_strong )
00159 {
00160 
00161   ECHO(ArrayRCP<int> arcp1 = arcp<int>(10));
00162   TEST_EQUALITY_CONST( arcp1.strength(), RCP_STRONG );
00163 
00164   ECHO(ArrayRCP<int> arcp2 = arcp1.create_weak());
00165 
00166   TEST_EQUALITY_CONST( arcp2.strength(), RCP_WEAK );
00167   TEST_EQUALITY_CONST( arcp1.strong_count(), 1 );
00168   TEST_EQUALITY_CONST( arcp1.weak_count(), 1 );
00169   TEST_EQUALITY_CONST( arcp2.strong_count(), 1 );
00170   TEST_EQUALITY_CONST( arcp2.weak_count(), 1 );
00171 
00172   ECHO(ArrayRCP<int> arcp3 = arcp2.create_strong());
00173 
00174   TEST_EQUALITY_CONST( arcp3.strength(), RCP_STRONG );
00175   TEST_EQUALITY_CONST( arcp1.strong_count(), 2 );
00176   TEST_EQUALITY_CONST( arcp1.weak_count(), 1 );
00177   TEST_EQUALITY_CONST( arcp2.strong_count(), 2 );
00178   TEST_EQUALITY_CONST( arcp2.weak_count(), 1 );
00179 
00180   // This will make the underlying object A gets deleted!
00181   ECHO(arcp1 = null);
00182   ECHO(arcp3 = null);
00183 
00184   ECHO(arcp2 = null); // Should make the underlying node go away
00185 
00186 }
00187 
00188 
00189 TEUCHOS_UNIT_TEST( ArrayRCP, arcp_reinterpret_cast_null )
00190 {
00191   ECHO(ArrayRCP<char> arcp_char = null);
00192   ECHO(ArrayRCP<int> arcp_int = arcp_reinterpret_cast<int>(arcp_char));
00193   TEST_EQUALITY_CONST(arcp_int, null);
00194 }
00195 
00196 
00197 TEUCHOS_UNIT_TEST( ArrayRCP, arcp_reinterpret_cast_char_to_int )
00198 {
00199 
00200   const int sizeOfInt = sizeof(int);
00201   const int sizeOfChar = sizeof(char);
00202   const int num_ints = n;
00203   const int num_chars = (num_ints*sizeOfInt)/sizeOfChar;
00204   out << "num_ints = " << num_ints << "\n";
00205   out << "num_chars = " << num_chars << "\n";
00206 
00207   ECHO(ArrayRCP<char> arcp_char = arcp<char>(num_chars));
00208   ECHO(ArrayRCP<int> arcp_int = arcp_reinterpret_cast<int>(arcp_char));
00209   TEST_EQUALITY(arcp_int.size(), num_ints);
00210   TEST_EQUALITY(implicit_ptr_cast<void>(&arcp_int[0]),
00211     implicit_ptr_cast<void>(&arcp_char[0]));
00212   TEST_EQUALITY(implicit_ptr_cast<void>((&arcp_int[num_ints-1])+1),
00213     implicit_ptr_cast<void>((&arcp_char[num_chars-1])+1));
00214 
00215   ECHO(arcp_char+=sizeOfInt);
00216   ECHO(arcp_int = arcp_reinterpret_cast<int>(arcp_char));
00217   TEST_EQUALITY(arcp_int.size(), num_ints);
00218   TEST_EQUALITY_CONST( arcp_int.lowerOffset(), -1);
00219   TEST_EQUALITY( arcp_int.upperOffset(), num_ints-2);
00220   TEST_EQUALITY( implicit_ptr_cast<void>(&arcp_int[-1]),
00221     implicit_ptr_cast<void>(&arcp_char[-sizeOfInt])
00222     );
00223   TEST_EQUALITY( implicit_ptr_cast<void>((&arcp_int[num_ints-2])+1),
00224     implicit_ptr_cast<void>((&arcp_char[num_chars-1-sizeOfInt])+1));
00225 
00226 }
00227 
00228 
00229 TEUCHOS_UNIT_TEST( ArrayRCP, arcp_reinterpret_cast_int_to_char )
00230 {
00231 
00232   const int sizeOfInt = sizeof(int);
00233   const int sizeOfChar = sizeof(char);
00234   const int num_ints = n;
00235   const int num_chars = (num_ints*sizeOfInt)/sizeOfChar;
00236   out << "num_ints = " << num_ints << "\n";
00237   out << "num_chars = " << num_chars << "\n";
00238 
00239   ECHO(ArrayRCP<int> arcp_int = arcp<int>(num_ints));
00240   ECHO(ArrayRCP<char> arcp_char = arcp_reinterpret_cast<char>(arcp_int));
00241   TEST_EQUALITY(arcp_char.size(), num_chars);
00242   TEST_EQUALITY(implicit_ptr_cast<void>(&arcp_int[0]),
00243     implicit_ptr_cast<void>(&arcp_char[0]));
00244   TEST_EQUALITY(implicit_ptr_cast<void>((&arcp_int[num_ints-1])+1),
00245     implicit_ptr_cast<void>((&arcp_char[num_chars-1])+1));
00246   TEST_EQUALITY(implicit_ptr_cast<void>((&arcp_int[num_ints-1])+1),
00247     implicit_ptr_cast<void>((&arcp_char[num_chars-1])+1));
00248 
00249   ECHO(++arcp_int);
00250   ECHO(arcp_char = arcp_reinterpret_cast<char>(arcp_int));
00251   TEST_EQUALITY(as<int>(arcp_char.lowerOffset()), as<int>(-sizeOfInt));
00252   TEST_EQUALITY(as<int>(arcp_char.upperOffset()), as<int>(num_chars-1-sizeOfInt));
00253   TEST_EQUALITY(implicit_ptr_cast<void>(&arcp_int[-1]),
00254     implicit_ptr_cast<void>(&arcp_char[-sizeOfInt]));
00255   TEST_EQUALITY(implicit_ptr_cast<void>((&arcp_int[num_ints-2])+1),
00256     implicit_ptr_cast<void>((&arcp_char[num_chars-1-sizeOfInt])+1));
00257 
00258 }
00259 
00260 
00261 TEUCHOS_UNIT_TEST( ArrayRCP, evil_reinterpret_cast )
00262 {
00263   ECHO(ArrayRCP<ArrayRCP<int> > arcp1 = arcp<ArrayRCP<int> >(n));
00264   ECHO(ArrayRCP<ArrayRCP<const int> > arcp2 =
00265     arcp_reinterpret_cast<ArrayRCP<const int> >(arcp1));
00266   TEST_EQUALITY(arcp2.size(), arcp1.size());
00267   TEST_EQUALITY(implicit_ptr_cast<const void>(&arcp1[0]),
00268     implicit_ptr_cast<const void>(&arcp2[0]));
00269   ECHO(ArrayRCP<const ArrayRCP<const int> > arcp3 = arcp2);
00270   TEST_EQUALITY(arcp3.size(), arcp1.size());
00271   TEST_EQUALITY(implicit_ptr_cast<const void>(&arcp1[0]),
00272     implicit_ptr_cast<const void>(&arcp3[0]));
00273   out << "arcp3 = " << arcp3 << "\n";
00274 }
00275 
00276 
00277 //
00278 // Test arcpCloneNode(...)
00279 //
00280 
00281 
00282 TEUCHOS_UNIT_TEST( ArrayRCP, arcpCloneNode_null )
00283 {
00284   ECHO(ArrayRCP<ArrayRCP<int> > arcp1 = null);
00285   ECHO(ArrayRCP<ArrayRCP<int> > arcp2 = arcpCloneNode(arcp1));
00286   TEST_EQUALITY(arcp2, null);
00287 }
00288 
00289 
00290 TEUCHOS_UNIT_TEST( ArrayRCP, arcpCloneNode_basic )
00291 {
00292 
00293   ECHO(ArrayRCP<int> arcp1 = arcp<int>(n));
00294 
00295   ECHO(ArrayRCP<int> arcp2 = arcpCloneNode(arcp1));
00296   TEST_ASSERT(nonnull(arcp2));
00297   TEST_EQUALITY(arcp1.count(), 2);
00298   TEST_EQUALITY(arcp2.count(), 1);
00299 
00300   ECHO(ArrayRCP<int> arcp3 = arcp2);
00301   TEST_EQUALITY(arcp1.count(), 2);
00302   TEST_EQUALITY(arcp2.count(), 2);
00303   TEST_EQUALITY(arcp3.count(), 2);
00304 
00305   ECHO(ArrayRCP<int> arcp4 = arcp1);
00306   TEST_EQUALITY(arcp1.count(), 3);
00307   TEST_EQUALITY(arcp2.count(), 2);
00308   TEST_EQUALITY(arcp3.count(), 2);
00309 
00310   ECHO(arcp4 = null);
00311   TEST_EQUALITY(arcp1.count(), 2);
00312   TEST_EQUALITY(arcp2.count(), 2);
00313   TEST_EQUALITY(arcp3.count(), 2);
00314   TEST_EQUALITY(arcp4.count(), 0);
00315 
00316   ECHO(arcp1 = null);
00317   TEST_EQUALITY(arcp1.count(), 0);
00318   TEST_EQUALITY(arcp2.count(), 2);
00319   TEST_EQUALITY(arcp3.count(), 2);
00320   TEST_EQUALITY(arcp4.count(), 0);
00321 
00322   ECHO(arcp2 = null);
00323   TEST_EQUALITY(arcp2.count(), 0);
00324   TEST_EQUALITY(arcp3.count(), 1);
00325 
00326   ECHO(arcp3 = null);
00327   TEST_EQUALITY(arcp3.count(), 0);
00328 
00329 }
00330 
00331 
00332 //
00333 // Test arcp_reinterpret_cast_nonpod(...)
00334 //
00335 
00336 
00337 class MockObject {
00338   int member_;
00339 public:
00340 
00341   MockObject(int member_in = -1) : member_(member_in) { ++(numConstructorsCalled()); }
00342   MockObject(const MockObject &mo) : member_(mo.member_) { ++(numCopyConstructorsCalled()); }
00343   ~MockObject() { ++(numDestructorsCalled()); }
00344   int member() const { return member_; }
00345 
00346   static int & numConstructorsCalled()
00347     { static int s_numConstructorsCalled = 0; return s_numConstructorsCalled; }
00348   static int & numCopyConstructorsCalled()
00349     { static int s_numCopyConstructorsCalled = 0; return s_numCopyConstructorsCalled; }
00350   static int & numDestructorsCalled()
00351     { static int s_numDestructorsCalled = 0; return s_numDestructorsCalled; }
00352   static void reset() { numConstructorsCalled() = numCopyConstructorsCalled() = numDestructorsCalled() = 0; }
00353 
00354 };
00355 
00356 
00357 TEUCHOS_UNIT_TEST( ArrayRCP, arcp_reinterpret_cast_nonpod_default_construct )
00358 {
00359 
00360   const int sizeOfMockObject = sizeof(MockObject);
00361   const int sizeOfChar = sizeof(char);
00362   const int num_objs = n;
00363   const int num_chars = (num_objs*sizeOfMockObject)/sizeOfChar;
00364   out << "num_objs = " << num_objs << "\n";
00365   out << "num_chars = " << num_chars << "\n";
00366 
00367   ECHO(ArrayRCP<char> arcp_chars = arcp<char>(num_chars));
00368   
00369   ECHO(MockObject::reset());
00370   TEST_EQUALITY(MockObject::numConstructorsCalled(), 0);
00371   TEST_EQUALITY(MockObject::numCopyConstructorsCalled(), 0);
00372   TEST_EQUALITY(MockObject::numDestructorsCalled(), 0);
00373   ECHO(ArrayRCP<MockObject> arcp_objs =
00374     arcp_reinterpret_cast_nonpod<MockObject>(arcp_chars));
00375   TEST_EQUALITY(arcp_objs.size(), num_objs);
00376   TEST_EQUALITY(MockObject::numConstructorsCalled(), 1);
00377   TEST_EQUALITY(MockObject::numCopyConstructorsCalled(), num_objs);
00378   TEST_EQUALITY(MockObject::numDestructorsCalled(), 1);
00379   {
00380     int sum = 0; for (int i=0; i < num_objs; ++i) sum += arcp_objs[i].member();
00381     TEST_EQUALITY(sum, -num_objs);
00382   }
00383 
00384   ECHO(ArrayRCP<MockObject> arcp_objs2 = arcp_objs);
00385   TEST_EQUALITY(arcp_objs.size(), num_objs);
00386   TEST_EQUALITY(MockObject::numConstructorsCalled(), 1);
00387   TEST_EQUALITY(MockObject::numCopyConstructorsCalled(), num_objs);
00388   TEST_EQUALITY(MockObject::numDestructorsCalled(), 1);
00389   {
00390     int sum = 0; for (int i=0; i < num_objs; ++i) sum += arcp_objs[i].member();
00391     TEST_EQUALITY(sum, -num_objs);
00392   }
00393 
00394   ECHO(arcp_objs = null);
00395   TEST_EQUALITY(MockObject::numConstructorsCalled(), 1);
00396   TEST_EQUALITY(MockObject::numCopyConstructorsCalled(), num_objs);
00397   TEST_EQUALITY(MockObject::numDestructorsCalled(), 1);
00398 
00399   ECHO(arcp_objs2 = null);
00400   TEST_EQUALITY(MockObject::numConstructorsCalled(), 1);
00401   TEST_EQUALITY(MockObject::numCopyConstructorsCalled(), num_objs);
00402   TEST_EQUALITY(MockObject::numDestructorsCalled(), num_objs + 1);
00403 
00404 }
00405 
00406 
00407 TEUCHOS_UNIT_TEST( ArrayRCP, arcp_reinterpret_cast_nonpod_copy_construct )
00408 {
00409 
00410   const int sizeOfMockObject = sizeof(MockObject);
00411   const int sizeOfChar = sizeof(char);
00412   const int num_objs = n;
00413   const int num_chars = (num_objs*sizeOfMockObject)/sizeOfChar;
00414   out << "num_objs = " << num_objs << "\n";
00415   out << "num_chars = " << num_chars << "\n";
00416 
00417   ECHO(ArrayRCP<char> arcp_chars = arcp<char>(num_chars));
00418 
00419   ECHO(MockObject::reset());
00420   TEST_EQUALITY(MockObject::numConstructorsCalled(), 0);
00421   TEST_EQUALITY(MockObject::numCopyConstructorsCalled(), 0);
00422   TEST_EQUALITY(MockObject::numDestructorsCalled(), 0);
00423   ECHO(const MockObject mockObj(1));
00424   TEST_EQUALITY(MockObject::numConstructorsCalled(), 1);
00425   TEST_EQUALITY(MockObject::numCopyConstructorsCalled(), 0);
00426   TEST_EQUALITY(MockObject::numDestructorsCalled(), 0);
00427   
00428   ECHO(MockObject::reset());
00429   TEST_EQUALITY(MockObject::numConstructorsCalled(), 0);
00430   TEST_EQUALITY(MockObject::numCopyConstructorsCalled(), 0);
00431   TEST_EQUALITY(MockObject::numDestructorsCalled(), 0);
00432   ECHO(ArrayRCP<MockObject> arcp_objs =
00433     arcp_reinterpret_cast_nonpod(arcp_chars, mockObj));
00434   TEST_EQUALITY(arcp_objs.size(), num_objs);
00435   TEST_EQUALITY(MockObject::numConstructorsCalled(), 0);
00436   TEST_EQUALITY(MockObject::numCopyConstructorsCalled(), num_objs);
00437   TEST_EQUALITY(MockObject::numDestructorsCalled(), 0);
00438   {
00439     int sum = 0; for (int i=0; i < num_objs; ++i) sum += arcp_objs[i].member();
00440     TEST_EQUALITY(sum, num_objs);
00441   }
00442 
00443   ECHO(ArrayRCP<MockObject> arcp_objs2 = arcp_objs);
00444   TEST_EQUALITY(arcp_objs.size(), num_objs);
00445   TEST_EQUALITY(MockObject::numConstructorsCalled(), 0);
00446   TEST_EQUALITY(MockObject::numCopyConstructorsCalled(), num_objs);
00447   TEST_EQUALITY(MockObject::numDestructorsCalled(), 0);
00448   {
00449     int sum = 0; for (int i=0; i < num_objs; ++i) sum += arcp_objs[i].member();
00450     TEST_EQUALITY(sum, num_objs);
00451   }
00452 
00453   ECHO(arcp_objs = null);
00454   TEST_EQUALITY(MockObject::numConstructorsCalled(), 0);
00455   TEST_EQUALITY(MockObject::numCopyConstructorsCalled(), num_objs);
00456   TEST_EQUALITY(MockObject::numDestructorsCalled(), 0);
00457 
00458   ECHO(arcp_objs2 = null);
00459   TEST_EQUALITY(MockObject::numConstructorsCalled(), 0);
00460   TEST_EQUALITY(MockObject::numCopyConstructorsCalled(), num_objs);
00461   TEST_EQUALITY(MockObject::numDestructorsCalled(), num_objs);
00462 
00463 }
00464 
00465 
00466 //
00467 // Test catching of duplicate owning ArrayRCP objects
00468 //
00469 
00470 
00471 TEUCHOS_UNIT_TEST( ArrayRCP, duplicate_arcp_owning )
00472 {
00473   SET_RCPNODE_TRACING();
00474   ECHO(A *a_ptr = new A[n]);
00475   ECHO(ArrayRCP<A> a_arcp1 = arcp(a_ptr, 0, n)); // Okay
00476 #if defined(TEUCHOS_DEBUG)
00477   // With node tracing turned on, the implementation knows that an RCPNode
00478   // already exists pointing to this same underlying array and will therefore
00479   // throw.
00480   TEST_THROW(ArrayRCP<A> a_arcp2 = arcp(a_ptr, 0, n), DuplicateOwningRCPError);
00481 #else
00482   // Will not determine they are point to the same object!
00483   ECHO(ArrayRCP<A> a_arcp2 = arcp(a_ptr, 0, n));
00484   TEST_EQUALITY(a_arcp2.getRawPtr(), a_ptr);
00485   ECHO(a_arcp2.release()); // Better or we will get a segfault!
00486 #endif
00487 }
00488 
00489 
00490 TEUCHOS_UNIT_TEST( ArrayRCP, dangling_nonowning )
00491 {
00492   SET_RCPNODE_TRACING();
00493   ECHO(A *a_ptr = new A[n]);
00494   ECHO(ArrayRCP<A> a_arcp1 = arcp(a_ptr, 0, n)); // Okay
00495   ECHO(ArrayRCP<A> a_arcp2 = arcp(a_ptr, 0, n, false)); // Okay
00496   a_arcp1 = null;
00497 #if defined(TEUCHOS_DEBUG)
00498   // With node tracing turned on, the implementation knows that the original
00499   // array is deleted and this is a dangling reference!
00500   TEST_THROW(a_arcp2.getRawPtr(), DanglingReferenceError);
00501 #else
00502   // With node tracing turned off, the implemetation does not know the
00503   // original array is deleted and therefore it will return a now invalid
00504   // pointer.
00505   TEST_NOTHROW(a_arcp2.getRawPtr());
00506 #endif
00507 }
00508 
00509 
00510 class WeirdDealloc {
00511   int size_;
00512   RCP<std::ostream > out_;
00513 public:
00514   WeirdDealloc(int size, const RCP<std::ostream> &out) : size_(size), out_(out) {}
00515   void free(void *ptr) const
00516     {
00517       int * const int_ptr = reinterpret_cast<int*>(ptr);
00518       {
00519         // Create an ArrayView that points to the same memory that is being
00520         // deallocated by the owning ArrayRCP.  Here, if RCPNode tracing is
00521         // enabled, this will thrown and there is really no way around it.
00522         ArrayView<const int> tmpav(int_ptr, size_, Teuchos::RCP_DISABLE_NODE_LOOKUP);
00523         assert(tmpav[0] == int_ptr[0]);
00524         *out_ << tmpav << std::endl;
00525         // Create a copy of the ArrayView and make sure that it does not do
00526         // node tracing either.
00527         ArrayView<const int> tmpav2(tmpav);
00528         assert(tmpav2[0] == int_ptr[0]);
00529         *out_ << tmpav2 << std::endl;
00530         // Assign the ArrayView and make sure that it does not do node tracing
00531         // either.
00532         ArrayView<const int> tmpav3;
00533         tmpav3 = tmpav;
00534         assert(tmpav3[0] == int_ptr[0]);
00535         *out_ << tmpav2 << std::endl;
00536       }
00537       delete [] int_ptr;
00538     }
00539 };
00540 
00541 
00542 TEUCHOS_UNIT_TEST( ArrayRCP, weirdDealloc )
00543 {
00544   using Teuchos::rcpFromRef;
00545   const int size = 4;
00546   const bool ownsMem = true;
00547   int *int_ptr = new int[size];
00548   std::fill_n(int_ptr, size, 0);
00549   ArrayRCP<int> a = arcp<int>( int_ptr , 0, size,
00550     WeirdDealloc(size, rcpFromRef(out)), ownsMem );
00551   a = Teuchos::null;
00552 }
00553 
00554 
00555 //
00556 // Templated unit tests
00557 //
00558 
00559 
00560 TEUCHOS_UNIT_TEST_TEMPLATE_1_DECL( ArrayRCP, construct_n, T )
00561 {
00562   std::vector<T> a(n, as<T>(1));
00563   ArrayRCP<T> a_arcp(n, as<T>(1));
00564   TEST_COMPARE_ARRAYS(a, a_arcp);
00565 }
00566 
00567 
00568 TEUCHOS_UNIT_TEST_TEMPLATE_1_DECL( ArrayRCP, assignSelf, T )
00569 {
00570   ArrayRCP<T> a_arcp;
00571   a_arcp = a_arcp;
00572 }
00573 
00574 
00575 TEUCHOS_UNIT_TEST_TEMPLATE_1_DECL( ArrayRCP, assign_n_val, T )
00576 {
00577   const T val = as<T>(1);
00578   std::vector<T> a;
00579   a.assign(n, val);
00580   ArrayRCP<T> a_arcp;
00581   a_arcp.assign(as<Ordinal>(n), val);
00582   TEST_COMPARE_ARRAYS(a, a_arcp);
00583 }
00584 
00585 
00586 TEUCHOS_UNIT_TEST_TEMPLATE_1_DECL( ArrayRCP, assign_begin_end, T )
00587 {
00588   const T val = as<T>(1);
00589   std::vector<T> a;
00590   a.assign(n, val);
00591   ArrayRCP<T> a_arcp;
00592   a_arcp.assign(a.begin(), a.end());
00593   TEST_COMPARE_ARRAYS(a, a_arcp);
00594 }
00595 
00596 
00597 TEUCHOS_UNIT_TEST_TEMPLATE_1_DECL( ArrayRCP, deepCopy, T )
00598 {
00599   const T val = as<T>(1);
00600   std::vector<T> a;
00601   a.assign(n, val);
00602   ArrayRCP<T> a_arcp = arcp<T>(n);
00603   ArrayRCP<T> a_arcp_cpy = a_arcp;
00604   a_arcp.deepCopy(Teuchos::arrayViewFromVector(a));
00605   TEST_COMPARE_ARRAYS(a, a_arcp);
00606   TEST_EQUALITY(a_arcp.getRawPtr(), a_arcp_cpy.getRawPtr());
00607 }
00608 
00609 
00610 TEUCHOS_UNIT_TEST_TEMPLATE_1_DECL( ArrayRCP, resize, T )
00611 {
00612   const T val1 = as<T>(1);
00613   const T val2 = as<T>(2);
00614 
00615   std::vector<T> a;
00616   ArrayRCP<T> a_arcp;
00617 
00618   out << "\nChecking resize(n, val1) ...\n"; 
00619   a.resize(n, val1);
00620   a_arcp.resize(n, val1);
00621   TEST_COMPARE_ARRAYS(a, a_arcp);
00622 
00623   out << "\nChecking resize(2*n, val2) ...\n"; 
00624   a.resize(2*n, val2);
00625   a_arcp.resize(2*n, val2);
00626   TEST_COMPARE_ARRAYS(a, a_arcp);
00627 
00628   out << "\nChecking resize(n/2) ...\n"; 
00629   a.resize(n/2);
00630   a_arcp.resize(n/2);
00631   TEST_COMPARE_ARRAYS(a, a_arcp);
00632 
00633   out << "\nChecking resize(0) ...\n"; 
00634   a.resize(0);
00635   a_arcp.resize(0);
00636   TEST_COMPARE_ARRAYS(a, a_arcp);
00637 
00638 #ifdef TEUCHOS_DEBUG
00639   a_arcp = arcp<T>(n);
00640   ++a_arcp;
00641   TEST_THROW(a_arcp.resize(1), std::out_of_range);
00642 #endif
00643 }
00644 
00645 
00646 TEUCHOS_UNIT_TEST_TEMPLATE_1_DECL( ArrayRCP, clear, T )
00647 {
00648   ArrayRCP<T> a_arcp = arcp<T>(n);
00649   TEST_EQUALITY( a_arcp.size(), n );
00650   a_arcp.clear();
00651   TEST_EQUALITY( a_arcp.size(), 0 );
00652 }
00653 
00654 
00655 TEUCHOS_UNIT_TEST_TEMPLATE_1_DECL( ArrayRCP, nullIterator, T )
00656 {
00657   typedef ArrayRCP<T> iter_t;
00658   ArrayRCP<T> arcp1 = Teuchos::NullIteratorTraits<iter_t>::getNull();
00659   TEST_EQUALITY_CONST(arcp1, Teuchos::null); 
00660 }
00661 
00662 
00663 TEUCHOS_UNIT_TEST_TEMPLATE_1_DECL( ArrayRCP, implicitConversions, T )
00664 {
00665 
00666   ECHO(ArrayRCP<T> arcp1 = arcp<T>(n));
00667   ECHO(ArrayRCP<const T> arcp2 = arcp1);
00668   TEST_ASSERT(arcp1.shares_resource(arcp2));
00669 
00670 }
00671 
00672 
00673 TEUCHOS_UNIT_TEST_TEMPLATE_1_DECL( ArrayRCP, weakDelete, T )
00674 {
00675 
00676   ECHO(ArrayRCP<T> arcp_strong = arcp<T>(n));
00677 
00678   TEST_EQUALITY_CONST( arcp_strong.strength(), RCP_STRONG );
00679   TEST_EQUALITY_CONST( arcp_strong.is_null(), false );
00680   TEST_EQUALITY_CONST( arcp_strong.strong_count(), 1 );
00681   TEST_EQUALITY_CONST( arcp_strong.weak_count(), 0 );
00682   TEST_EQUALITY_CONST( arcp_strong.total_count(), 1 );
00683 
00684   ECHO(ArrayRCP<T> arcp_weak1 = arcp_strong.create_weak());
00685 
00686   TEST_EQUALITY_CONST( arcp_weak1.strength(), RCP_WEAK );
00687   TEST_EQUALITY_CONST( arcp_weak1.is_null(), false );
00688   TEST_EQUALITY_CONST( arcp_weak1.strong_count(), 1 );
00689   TEST_EQUALITY_CONST( arcp_weak1.weak_count(), 1 );
00690   TEST_EQUALITY_CONST( arcp_weak1.total_count(), 2 );
00691 
00692   TEST_EQUALITY_CONST( arcp_strong.strong_count(), 1 );
00693   TEST_EQUALITY_CONST( arcp_strong.is_null(), false );
00694   TEST_EQUALITY_CONST( arcp_strong.weak_count(), 1 );
00695   TEST_EQUALITY_CONST( arcp_strong.total_count(), 2 );
00696 
00697   TEST_EQUALITY_CONST( arcp_weak1.shares_resource(arcp_strong), true );
00698 
00699   TEST_EQUALITY( arcp_weak1.get(), arcp_weak1.getRawPtr() );
00700   TEST_EQUALITY( arcp_weak1.get(), arcp_strong.get() );
00701   TEST_EQUALITY( arcp_weak1.getRawPtr(), arcp_strong.getRawPtr() );
00702 
00703   ECHO(ArrayRCP<T> arcp_weak2 = arcp_weak1);
00704 
00705   TEST_EQUALITY_CONST( arcp_weak2.strength(), RCP_WEAK );
00706   TEST_EQUALITY_CONST( arcp_weak2.is_null(), false );
00707   TEST_EQUALITY_CONST( arcp_weak2.strong_count(), 1 );
00708   TEST_EQUALITY_CONST( arcp_weak2.weak_count(), 2 );
00709   TEST_EQUALITY_CONST( arcp_weak2.total_count(), 3 );
00710 
00711   TEST_EQUALITY_CONST( arcp_strong.strong_count(), 1 );
00712   TEST_EQUALITY_CONST( arcp_strong.is_null(), false );
00713   TEST_EQUALITY_CONST( arcp_strong.weak_count(), 2 );
00714   TEST_EQUALITY_CONST( arcp_strong.total_count(), 3 );
00715 
00716   TEST_EQUALITY_CONST( arcp_weak1.shares_resource(arcp_strong), true );
00717   TEST_EQUALITY_CONST( arcp_weak1.shares_resource(arcp_weak2), true );
00718   TEST_EQUALITY_CONST( arcp_weak2.shares_resource(arcp_strong), true );
00719 
00720   TEST_EQUALITY( arcp_weak2.get(), arcp_strong.get() );
00721   TEST_EQUALITY( arcp_weak2.getRawPtr(), arcp_strong.getRawPtr() );
00722 
00723   ECHO(arcp_strong = null); // This deletes the underlying object of type T!
00724 
00725   TEST_EQUALITY_CONST( arcp_strong.strength(), RCP_STRENGTH_INVALID );
00726   TEST_EQUALITY_CONST( arcp_strong.is_null(), true );
00727   TEST_EQUALITY_CONST( arcp_strong.count(), 0 );
00728   TEST_EQUALITY_CONST( arcp_strong.strong_count(), 0 );
00729   TEST_EQUALITY_CONST( arcp_strong.weak_count(), 0 );
00730   TEST_EQUALITY_CONST( arcp_strong.total_count(), 0 );
00731   TEST_EQUALITY_CONST( arcp_strong.is_valid_ptr(), true );
00732 
00733   TEST_EQUALITY_CONST( arcp_strong.shares_resource(arcp_weak1), false );
00734   TEST_EQUALITY_CONST( arcp_strong.shares_resource(arcp_weak2), false );
00735 
00736   TEST_EQUALITY_CONST( arcp_weak1.has_ownership(), true );
00737   TEST_EQUALITY_CONST( arcp_weak1.count(), 0 );
00738   TEST_EQUALITY_CONST( arcp_weak1.strong_count(), 0 );
00739   TEST_EQUALITY_CONST( arcp_weak1.weak_count(), 2 );
00740   TEST_EQUALITY_CONST( arcp_weak1.total_count(), 2 );
00741   TEST_EQUALITY_CONST( arcp_weak1.is_valid_ptr(), false );
00742 
00743   TEST_EQUALITY_CONST( arcp_weak2.has_ownership(), true );
00744   TEST_EQUALITY_CONST( arcp_weak2.count(), 0 );
00745   TEST_EQUALITY_CONST( arcp_weak2.strong_count(), 0 );
00746   TEST_EQUALITY_CONST( arcp_weak2.weak_count(), 2 );
00747   TEST_EQUALITY_CONST( arcp_weak2.total_count(), 2 );
00748   TEST_EQUALITY_CONST( arcp_weak2.is_valid_ptr(), false );
00749 
00750   TEST_EQUALITY_CONST( arcp_weak1.shares_resource(arcp_weak2), true );
00751 
00752   ECHO(arcp_weak1.assert_not_null()); // Does not throw!
00753   ECHO(arcp_weak2.assert_not_null()); // Does not throw!
00754 
00755   TEST_THROW( arcp_weak1.assert_valid_ptr(), DanglingReferenceError );
00756 #ifdef TEUCHOS_DEBUG
00757   TEST_THROW( arcp_weak1.operator->(), DanglingReferenceError );
00758   TEST_THROW( *arcp_weak1, DanglingReferenceError );
00759   TEST_THROW( arcp_weak1.create_weak(), DanglingReferenceError );
00760   TEST_THROW( arcp_weak1.get(), DanglingReferenceError );
00761   TEST_THROW( arcp_weak1.getRawPtr(), DanglingReferenceError );
00762   TEST_THROW( arcp_weak1[0], DanglingReferenceError );
00763   TEST_THROW( ++arcp_weak1, DanglingReferenceError );
00764   TEST_THROW( arcp_weak1++, DanglingReferenceError );
00765   TEST_THROW( --arcp_weak1, DanglingReferenceError );
00766   TEST_THROW( arcp_weak1--, DanglingReferenceError );
00767   TEST_THROW( arcp_weak1+=1, DanglingReferenceError );
00768   TEST_THROW( arcp_weak1-=1, DanglingReferenceError );
00769   TEST_THROW( arcp_weak1+1, DanglingReferenceError );
00770   TEST_THROW( arcp_weak1-1, DanglingReferenceError );
00771   TEST_THROW( arcp_weak1.getConst(), DanglingReferenceError );
00772   TEST_THROW( arcp_weak1.persistingView(0,n), DanglingReferenceError );
00773   TEST_THROW( arcp_weak1.lowerOffset(), DanglingReferenceError );
00774   TEST_THROW( arcp_weak1.upperOffset(), DanglingReferenceError );
00775   TEST_THROW( arcp_weak1.size(), DanglingReferenceError );
00776   TEST_THROW( arcp_weak1.begin(), DanglingReferenceError );
00777   TEST_THROW( arcp_weak1.end(), DanglingReferenceError );
00778   TEST_THROW( arcp_weak1.view(0,n), DanglingReferenceError );
00779   TEST_THROW( arcp_weak1(0,n), DanglingReferenceError );
00780   TEST_THROW( arcp_weak1(), DanglingReferenceError );
00781   TEST_THROW( {ArrayView<T> av = arcp_weak1();}, DanglingReferenceError );
00782   TEST_THROW( {ArrayRCP<const T> ap = getConst(arcp_weak1);},
00783     DanglingReferenceError );
00784   TEST_THROW( arcp_weak1.release(), DanglingReferenceError );
00785 #endif // TEUCHOS_DEBUG
00786 
00787   ECHO(arcp_weak1 = null); // Just deicrements weak count!
00788 
00789   TEST_EQUALITY_CONST( arcp_weak1.strength(), RCP_STRENGTH_INVALID );
00790   TEST_EQUALITY_CONST( arcp_weak1.is_null(), true );
00791   TEST_EQUALITY_CONST( arcp_weak1.count(), 0 );
00792   TEST_EQUALITY_CONST( arcp_weak1.strong_count(), 0 );
00793   TEST_EQUALITY_CONST( arcp_weak1.weak_count(), 0 );
00794   TEST_EQUALITY_CONST( arcp_weak1.total_count(), 0 );
00795   TEST_EQUALITY_CONST( arcp_weak1.is_valid_ptr(), true );
00796 
00797   TEST_EQUALITY_CONST( arcp_weak2.has_ownership(), true );
00798   TEST_EQUALITY_CONST( arcp_weak2.count(), 0 );
00799   TEST_EQUALITY_CONST( arcp_weak2.strong_count(), 0 );
00800   TEST_EQUALITY_CONST( arcp_weak2.weak_count(), 1 );
00801   TEST_EQUALITY_CONST( arcp_weak2.total_count(), 1 );
00802   TEST_EQUALITY_CONST( arcp_weak2.is_valid_ptr(), false );
00803 
00804   TEST_EQUALITY_CONST( arcp_weak1.shares_resource(arcp_weak2), false );
00805 
00806   TEST_THROW( arcp_weak2.assert_valid_ptr(), DanglingReferenceError );
00807 #ifdef TEUCHOS_DEBUG
00808   // ToDo: Fill in
00809 #endif // TEUCHOS_DEBUG
00810 
00811 }
00812 
00813 
00814 TEUCHOS_UNIT_TEST_TEMPLATE_1_DECL( ArrayRCP, danglingArrayView, T )
00815 {
00816   ArrayView<T> av;
00817   {
00818     ArrayRCP<T> arcp1 = arcp<T>(n);
00819     av = arcp1();
00820   }
00821 #ifdef TEUCHOS_DEBUG
00822   TEST_THROW( av.size(), DanglingReferenceError );
00823   TEST_THROW( av.toString(), DanglingReferenceError );
00824   TEST_THROW( av.getRawPtr(), DanglingReferenceError );
00825   TEST_THROW( av[0], DanglingReferenceError );
00826   TEST_THROW( av.front(), DanglingReferenceError );
00827   TEST_THROW( av.back(), DanglingReferenceError );
00828   TEST_THROW( av.view(0, n), DanglingReferenceError );
00829   TEST_THROW( av(0, n), DanglingReferenceError );
00830   TEST_THROW( av(), DanglingReferenceError );
00831   TEST_THROW( av.getConst(), DanglingReferenceError );
00832   TEST_THROW( av.begin(), DanglingReferenceError );
00833   TEST_THROW( av.end(), DanglingReferenceError );
00834 #endif  
00835 }
00836 
00837 
00838 TEUCHOS_UNIT_TEST_TEMPLATE_1_DECL( ArrayRCP, getRawPtr, T )
00839 {
00840   ArrayRCP<const T> cptr;
00841   ArrayRCP<T> ptr;
00842   TEST_EQUALITY_CONST( getRawPtr(cptr), (const T*)NULL );
00843   TEST_EQUALITY_CONST( getRawPtr(ptr), (T*)NULL );
00844   cptr = arcp<T>(n);
00845   ptr  = arcp<T>(n);
00846   TEST_EQUALITY( getRawPtr(cptr), &cptr[0]);
00847   TEST_EQUALITY( getRawPtr(ptr),  &ptr[0] );
00848 }
00849 
00850 
00851 TEUCHOS_UNIT_TEST_TEMPLATE_1_DECL( CPtr, getRawPtr, T )
00852 {
00853   const T *cptr = NULL;
00854   T *ptr = NULL;
00855   TEST_EQUALITY_CONST( getRawPtr(cptr), (const T*)NULL );
00856   TEST_EQUALITY_CONST( getRawPtr(ptr),  (T*)NULL );
00857   cptr = new T[n];
00858   ptr  = new T[n];
00859   TEST_EQUALITY( getRawPtr(cptr), &cptr[0]);
00860   TEST_EQUALITY( getRawPtr(ptr),  &ptr[0] );
00861   delete [] cptr;
00862   delete [] ptr;
00863 }
00864 
00865 
00866 TEUCHOS_UNIT_TEST_TEMPLATE_1_DECL( ArrayRCP, arcp_zero, T )
00867 {
00868   ArrayRCP<T> arcp_strong = arcp<T>(0);
00869   TEST_EQUALITY(arcp_strong.size(), as<Ordinal>(0));
00870 }
00871 
00872 
00873 TEUCHOS_UNIT_TEST_TEMPLATE_1_DECL( ArrayRCP, arcpFromArrayView, T )
00874 {
00875   Array<T> a = generateArray<T>(n);
00876   ArrayView<T> av = a;
00877   ArrayRCP<T> arcp1 = Teuchos::arcpFromArrayView(av);
00878   TEST_COMPARE_ARRAYS(arcp1, av);
00879 }
00880 
00881 
00882 #ifdef TEUCHOS_DEBUG
00883 
00884 
00885 TEUCHOS_UNIT_TEST_TEMPLATE_1_DECL( ArrayRCP, arcp_neg, T )
00886 {
00887   TEST_THROW(ArrayRCP<T> arcp_strong = arcp<T>(-1),
00888     std::out_of_range);
00889 }
00890 
00891 
00892 TEUCHOS_UNIT_TEST_TEMPLATE_1_DECL( ArrayRCP, outOfBounds, T )
00893 {
00894   ECHO(ArrayRCP<T> arcp1 = arcp<T>(n));
00895   TEST_THROW(arcp1(-1,n), RangeError);
00896   TEST_THROW(arcp1(0,n+1), RangeError);
00897   TEST_THROW(arcp1(0,-1), RangeError);
00898   TEST_THROW(arcp1.view(-1,n), RangeError);
00899   TEST_THROW(arcp1.view(0,n+1), RangeError);
00900   TEST_THROW(arcp1.view(0,-1), RangeError);
00901   TEST_THROW(arcp1.persistingView(-1,n), RangeError);
00902   TEST_THROW(arcp1.persistingView(0,n+1), RangeError);
00903   TEST_THROW(arcp1.persistingView(0,-1), RangeError);
00904 }
00905 
00906 
00907 #endif // TEUCHOS_DEBUG
00908 
00909 
00910 //
00911 // Template Instantiations
00912 //
00913 
00914 
00915 #ifdef TEUCHOS_DEBUG
00916 
00917 #  define DEBUG_UNIT_TEST_GROUP( T ) \
00918   TEUCHOS_UNIT_TEST_TEMPLATE_1_INSTANT( ArrayRCP, arcp_neg, T ) \
00919   TEUCHOS_UNIT_TEST_TEMPLATE_1_INSTANT( ArrayRCP, outOfBounds, T ) \
00920 
00921 #else
00922 
00923 #  define DEBUG_UNIT_TEST_GROUP( T )
00924 
00925 #endif
00926 
00927 
00928 #define UNIT_TEST_GROUP( T ) \
00929   TEUCHOS_UNIT_TEST_TEMPLATE_1_INSTANT( ArrayRCP, construct_n, T ) \
00930   TEUCHOS_UNIT_TEST_TEMPLATE_1_INSTANT( ArrayRCP, assignSelf, T ) \
00931   TEUCHOS_UNIT_TEST_TEMPLATE_1_INSTANT( ArrayRCP, assign_n_val, T ) \
00932   TEUCHOS_UNIT_TEST_TEMPLATE_1_INSTANT( ArrayRCP, assign_begin_end, T ) \
00933   TEUCHOS_UNIT_TEST_TEMPLATE_1_INSTANT( ArrayRCP, deepCopy, T ) \
00934   TEUCHOS_UNIT_TEST_TEMPLATE_1_INSTANT( ArrayRCP, resize, T ) \
00935   TEUCHOS_UNIT_TEST_TEMPLATE_1_INSTANT( ArrayRCP, clear, T ) \
00936   TEUCHOS_UNIT_TEST_TEMPLATE_1_INSTANT( ArrayRCP, nullIterator, T ) \
00937   TEUCHOS_UNIT_TEST_TEMPLATE_1_INSTANT( ArrayRCP, implicitConversions, T ) \
00938   TEUCHOS_UNIT_TEST_TEMPLATE_1_INSTANT( ArrayRCP, weakDelete, T ) \
00939   TEUCHOS_UNIT_TEST_TEMPLATE_1_INSTANT( ArrayRCP, danglingArrayView, T ) \
00940   TEUCHOS_UNIT_TEST_TEMPLATE_1_INSTANT( ArrayRCP, getRawPtr, T) \
00941   TEUCHOS_UNIT_TEST_TEMPLATE_1_INSTANT( CPtr, getRawPtr, T) \
00942   TEUCHOS_UNIT_TEST_TEMPLATE_1_INSTANT( ArrayRCP, arcp_zero, T ) \
00943   TEUCHOS_UNIT_TEST_TEMPLATE_1_INSTANT( ArrayRCP, arcpFromArrayView, T ) \
00944   DEBUG_UNIT_TEST_GROUP(T)
00945 
00946 
00947 UNIT_TEST_GROUP(int)
00948 UNIT_TEST_GROUP(double)
00949 UNIT_TEST_GROUP(float)
00950 
00951 
00952 } // namespace
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
Generated on Wed Apr 13 09:57:28 2011 for Teuchos Package Browser (Single Doxygen Collection) by  doxygen 1.6.3