[cig-commits] r15272 - short/3D/PyLith/trunk/unittests/libtests/materials

brad at geodynamics.org brad at geodynamics.org
Mon Jun 15 13:09:57 PDT 2009


Author: brad
Date: 2009-06-15 13:09:57 -0700 (Mon, 15 Jun 2009)
New Revision: 15272

Modified:
   short/3D/PyLith/trunk/unittests/libtests/materials/TestElasticIsotropic3D.cc
   short/3D/PyLith/trunk/unittests/libtests/materials/TestElasticIsotropic3D.hh
   short/3D/PyLith/trunk/unittests/libtests/materials/TestMaxwellIsotropic3D.cc
   short/3D/PyLith/trunk/unittests/libtests/materials/TestMaxwellIsotropic3D.hh
Log:
Added unit tests for hasProperty() and hasStateVar().

Modified: short/3D/PyLith/trunk/unittests/libtests/materials/TestElasticIsotropic3D.cc
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/materials/TestElasticIsotropic3D.cc	2009-06-15 20:09:34 UTC (rev 15271)
+++ short/3D/PyLith/trunk/unittests/libtests/materials/TestElasticIsotropic3D.cc	2009-06-15 20:09:57 UTC (rev 15272)
@@ -49,5 +49,28 @@
   CPPUNIT_ASSERT_EQUAL(1.0, dt/pylith::PYLITH_MAXDOUBLE);
 } // testStableTimeStepImplicit
 
+// ----------------------------------------------------------------------
+// Test hasProperty().
+void
+pylith::materials::TestElasticIsotropic3D::testHasProperty(void)
+{ // testHasProperty
+  ElasticIsotropic3D material;
 
+  CPPUNIT_ASSERT(material.hasProperty("mu"));
+  CPPUNIT_ASSERT(material.hasProperty("lambda"));
+  CPPUNIT_ASSERT(material.hasProperty("density"));
+  CPPUNIT_ASSERT(!material.hasProperty("aaa"));
+} // testHasProperty
+
+// ----------------------------------------------------------------------
+// Test hasStateVar().
+void
+pylith::materials::TestElasticIsotropic3D::testHasStateVar(void)
+{ // testHasStateVar
+  ElasticIsotropic3D material;
+
+  CPPUNIT_ASSERT(!material.hasStateVar("stress"));
+} // testHasStateVar
+
+
 // End of file 

Modified: short/3D/PyLith/trunk/unittests/libtests/materials/TestElasticIsotropic3D.hh
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/materials/TestElasticIsotropic3D.hh	2009-06-15 20:09:34 UTC (rev 15271)
+++ short/3D/PyLith/trunk/unittests/libtests/materials/TestElasticIsotropic3D.hh	2009-06-15 20:09:57 UTC (rev 15272)
@@ -52,6 +52,9 @@
   CPPUNIT_TEST( test_updateStateVars );
   CPPUNIT_TEST( test_stableTimeStepImplicit );
 
+  CPPUNIT_TEST( testHasProperty );
+  CPPUNIT_TEST( testHasStateVar );
+
   CPPUNIT_TEST_SUITE_END();
 
   // PUBLIC METHODS /////////////////////////////////////////////////////
@@ -63,6 +66,12 @@
   /// Test stableTimeStepImplicit().
   void testStableTimeStepImplicit(void);
 
+  /// Test hasProperty().
+  void testHasProperty(void);
+
+  /// Test hasStateVar().
+  void testHasStateVar(void);
+
 }; // class TestElasticIsotropic3D
 
 #endif // pylith_materials_testelasticisotropic3d_hh

Modified: short/3D/PyLith/trunk/unittests/libtests/materials/TestMaxwellIsotropic3D.cc
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/materials/TestMaxwellIsotropic3D.cc	2009-06-15 20:09:34 UTC (rev 15271)
+++ short/3D/PyLith/trunk/unittests/libtests/materials/TestMaxwellIsotropic3D.cc	2009-06-15 20:09:57 UTC (rev 15272)
@@ -317,5 +317,31 @@
   TestElasticMaterial::test_stableTimeStepImplicit();
 } // test_stableTimeStepImplicit
 
+// ----------------------------------------------------------------------
+// Test hasProperty().
+void
+pylith::materials::TestMaxwellIsotropic3D::testHasProperty(void)
+{ // testHasProperty
+  MaxwellIsotropic3D material;
 
+  CPPUNIT_ASSERT(material.hasProperty("mu"));
+  CPPUNIT_ASSERT(material.hasProperty("lambda"));
+  CPPUNIT_ASSERT(material.hasProperty("density"));
+  CPPUNIT_ASSERT(material.hasProperty("maxwell_time"));
+  CPPUNIT_ASSERT(!material.hasProperty("aaa"));
+} // testHasProperty
+
+// ----------------------------------------------------------------------
+// Test hasStateVar().
+void
+pylith::materials::TestMaxwellIsotropic3D::testHasStateVar(void)
+{ // testHasStateVar
+  MaxwellIsotropic3D material;
+
+  CPPUNIT_ASSERT(material.hasStateVar("total_strain"));
+  CPPUNIT_ASSERT(material.hasStateVar("viscous_strain"));
+  CPPUNIT_ASSERT(!material.hasStateVar("stress"));
+} // testHasStateVar
+
+
 // End of file 

Modified: short/3D/PyLith/trunk/unittests/libtests/materials/TestMaxwellIsotropic3D.hh
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/materials/TestMaxwellIsotropic3D.hh	2009-06-15 20:09:34 UTC (rev 15271)
+++ short/3D/PyLith/trunk/unittests/libtests/materials/TestMaxwellIsotropic3D.hh	2009-06-15 20:09:57 UTC (rev 15272)
@@ -62,6 +62,9 @@
   CPPUNIT_TEST( test_updateStateVarsElastic );
   CPPUNIT_TEST( test_updateStateVarsTimeDep );
 
+  CPPUNIT_TEST( testHasProperty );
+  CPPUNIT_TEST( testHasStateVar );
+
   CPPUNIT_TEST_SUITE_END();
 
   // PUBLIC METHODS /////////////////////////////////////////////////////
@@ -100,6 +103,12 @@
   /// Test _stableTimeStepImplicit()
   void test_stableTimeStepImplicit(void);
 
+  /// Test hasProperty().
+  void testHasProperty(void);
+
+  /// Test hasStateVar().
+  void testHasStateVar(void);
+
 }; // class TestMaxwellIsotropic3D
 
 #endif // pylith_materials_testmaxwellisotropic3d_hh



More information about the CIG-COMMITS mailing list