ParameterList_UnitTest.cpp

Go to the documentation of this file.
00001 //@HEADER
00002 // ***********************************************************************
00003 //
00004 //                           Teuchos Package
00005 //                 Copyright (2006) Sandia Corporation
00006 //
00007 // Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive
00008 // license for use of this work by or on behalf of the U.S. Government.
00009 //
00010 // This library is free software; you can redistribute it and/or modify
00011 // it under the terms of the GNU Lesser General Public License as
00012 // published by the Free Software Foundation; either version 2.1 of the
00013 // License, or (at your option) any later version.
00014 //
00015 // This library is distributed in the hope that it will be useful, but
00016 // WITHOUT ANY WARRANTY; without even the implied warranty of
00017 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00018 // Lesser General Public License for more details.
00019 //
00020 // You should have received a copy of the GNU Lesser General Public
00021 // License along with this library; if not, write to the Free Software
00022 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
00023 // USA
00024 // Questions? Contact Todd S. Coffey (tscoffe@sandia.gov)
00025 //
00026 // ***********************************************************************
00027 //@HEADER
00028 
00029 #include "Teuchos_ParameterList.hpp"
00030 #include "Teuchos_UnitTestHarness.hpp"
00031 
00032 namespace Teuchos {
00033 
00034 /*
00035 TEUCHOS_UNIT_TEST( Teuchos_ParameterList, operatorEqualityDifferentNames ) {
00036   // Lists with different names should not be equal
00037   Teuchos::ParameterList A("Tom");
00038   Teuchos::ParameterList B("Bob");
00039   TEST_ASSERT( A != B );
00040   A.set("Hello","World");
00041   B.set("Hello","World");
00042   TEST_ASSERT( A != B );
00043 }
00044 
00045 TEUCHOS_UNIT_TEST( Teuchos_ParameterList, haveSameValuesDifferentNames ) {
00046   Teuchos::ParameterList A("Julie");
00047   Teuchos::ParameterList B("Shannon");
00048   TEST_ASSERT( !haveSameValues(A,B) );
00049   A.set("Hello","World");
00050   B.set("Hello","World");
00051   TEST_ASSERT( !haveSameValues(A,B) );
00052 }
00053 */
00054 
00055 TEUCHOS_UNIT_TEST( Teuchos_ParameterList, operatorEqualityWithEmpty ) {
00056   // An empty list should not be equal to a full list
00057   Teuchos::ParameterList A;
00058   Teuchos::ParameterList B;
00059   TEST_ASSERT( A == B );
00060   A.set("Hello","World");
00061   TEST_ASSERT( A != B );
00062   B.set("Hello","World");
00063   TEST_ASSERT( A == B );
00064 }
00065 
00066 
00067 TEUCHOS_UNIT_TEST( Teuchos_ParameterList, operatorEqualityDifferentSublistNames ) {
00068   // Sublists with different names should not be equal
00069   Teuchos::ParameterList A;
00070   Teuchos::ParameterList B;
00071   A.sublist("Bob");
00072   B.sublist("Tom");
00073   TEST_ASSERT( A != B );
00074 }
00075 
00076 
00077 TEUCHOS_UNIT_TEST( Teuchos_ParameterList, operatorEqualityDifferentLengths ) {
00078   Teuchos::ParameterList A;
00079   Teuchos::ParameterList B;
00080   A.set("A","a");
00081   A.set("B","b");
00082   A.set("C","c");
00083 
00084   B.set("A","a");
00085   B.set("B","b");
00086 
00087   TEST_ASSERT( A != B );
00088 
00089   B.set("C","c");
00090   TEST_ASSERT( A == B );
00091 }
00092 
00093 
00094 TEUCHOS_UNIT_TEST( Teuchos_ParameterList, haveSameValuesWithEmpty ) {
00095   Teuchos::ParameterList A;
00096   Teuchos::ParameterList B;
00097   TEST_ASSERT( haveSameValues(A,B) );
00098   A.set("Hello","World");
00099   TEST_ASSERT( !haveSameValues(A,B) );
00100   B.set("Hello","World");
00101   TEST_ASSERT( haveSameValues(A,B) );
00102 }
00103 
00104 
00105 TEUCHOS_UNIT_TEST( Teuchos_ParameterList, haveSameValuesDifferentSublistNames ) {
00106   Teuchos::ParameterList A;
00107   Teuchos::ParameterList B;
00108   A.sublist("Smith").set("People",4);
00109   B.sublist("Jones").set("People",4);
00110   TEST_ASSERT( !haveSameValues(A,B) ); // sublist names matter
00111 }
00112 
00113 
00114 
00115 } // namespace Teuchos
00116 
00117 
00118 
 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