[cig-commits] r18494 - short/3D/PyLith/trunk/unittests/pytests/materials

willic3 at geodynamics.org willic3 at geodynamics.org
Mon May 30 14:45:34 PDT 2011


Author: willic3
Date: 2011-05-30 14:45:33 -0700 (Mon, 30 May 2011)
New Revision: 18494

Added:
   short/3D/PyLith/trunk/unittests/pytests/materials/TestGenMaxwellPlaneStrain.py
Modified:
   short/3D/PyLith/trunk/unittests/pytests/materials/Makefile.am
   short/3D/PyLith/trunk/unittests/pytests/materials/testmaterials.py
Log:
Added pytests for GenMaxwellPlaneStrain.



Modified: short/3D/PyLith/trunk/unittests/pytests/materials/Makefile.am
===================================================================
--- short/3D/PyLith/trunk/unittests/pytests/materials/Makefile.am	2011-05-30 21:40:35 UTC (rev 18493)
+++ short/3D/PyLith/trunk/unittests/pytests/materials/Makefile.am	2011-05-30 21:45:33 UTC (rev 18494)
@@ -38,6 +38,7 @@
 	TestMaxwellIsotropic3D.py \
 	TestMaxwellPlaneStrain.py \
 	TestGenMaxwellIsotropic3D.py \
+	TestGenMaxwellPlaneStrain.py \
 	TestGenMaxwellQpQsIsotropic3D.py \
 	TestPowerLaw3D.py \
 	TestDruckerPrager3D.py

Added: short/3D/PyLith/trunk/unittests/pytests/materials/TestGenMaxwellPlaneStrain.py
===================================================================
--- short/3D/PyLith/trunk/unittests/pytests/materials/TestGenMaxwellPlaneStrain.py	                        (rev 0)
+++ short/3D/PyLith/trunk/unittests/pytests/materials/TestGenMaxwellPlaneStrain.py	2011-05-30 21:45:33 UTC (rev 18494)
@@ -0,0 +1,90 @@
+#!/usr/bin/env python
+#
+# ======================================================================
+#
+# Brad T. Aagaard, U.S. Geological Survey
+# Charles A. Williams, GNS Science
+# Matthew G. Knepley, University of Chicago
+#
+# This code was developed as part of the Computational Infrastructure
+# for Geodynamics (http://geodynamics.org).
+#
+# Copyright (c) 2010 University of California, Davis
+#
+# See COPYING for license information.
+#
+# ======================================================================
+#
+
+## @file unittests/pytests/materials/TestGenMaxwellPlaneStrain.py
+
+## @brief Unit testing of GenMaxwellPlaneStrain object.
+
+import unittest
+
+from pylith.materials.GenMaxwellPlaneStrain import GenMaxwellPlaneStrain
+
+# ----------------------------------------------------------------------
+class TestGenMaxwellPlaneStrain(unittest.TestCase):
+  """
+  Unit testing of GenMaxwellPlaneStrain object.
+  """
+
+  def setUp(self):
+    """
+    Setup test subject.
+    """
+    self.material = GenMaxwellPlaneStrain()
+    return
+  
+
+  def test_constructor(self):
+    """
+    Test constructor.
+    """
+    self.assertEqual(2, self.material.dimension())
+    return
+
+
+  def test_useElasticBehavior(self):
+    """
+    Test useElasticBehavior().
+    """
+    self.material.useElasticBehavior(False)
+    return
+
+
+  def testHasStateVars(self):
+    self.failUnless(self.material.hasStateVars())
+    return
+
+
+  def testTensorSize(self):
+    self.assertEqual(3, self.material.tensorSize())
+    return
+
+
+  def testNeedNewJacobian(self):
+    """
+    Test needNewJacobian().
+    """
+    # Default should be False.
+    self.failIf(self.material.needNewJacobian())
+
+    # Changing time step should require new Jacobian.
+    self.material.timeStep(1.0)
+    self.material.timeStep(2.0)
+    self.failUnless(self.material.needNewJacobian())
+    return
+  
+
+  def test_factory(self):
+    """
+    Test factory method.
+    """
+    from pylith.materials.GenMaxwellPlaneStrain import material
+    m = material()
+    return
+
+
+# End of file 

Modified: short/3D/PyLith/trunk/unittests/pytests/materials/testmaterials.py
===================================================================
--- short/3D/PyLith/trunk/unittests/pytests/materials/testmaterials.py	2011-05-30 21:40:35 UTC (rev 18493)
+++ short/3D/PyLith/trunk/unittests/pytests/materials/testmaterials.py	2011-05-30 21:45:33 UTC (rev 18494)
@@ -86,6 +86,9 @@
     from TestGenMaxwellIsotropic3D import TestGenMaxwellIsotropic3D
     suite.addTest(unittest.makeSuite(TestGenMaxwellIsotropic3D))
 
+    from TestGenMaxwellPlaneStrain import TestGenMaxwellPlaneStrain
+    suite.addTest(unittest.makeSuite(TestGenMaxwellPlaneStrain))
+
     from TestGenMaxwellQpQsIsotropic3D import TestGenMaxwellQpQsIsotropic3D
     suite.addTest(unittest.makeSuite(TestGenMaxwellQpQsIsotropic3D))
 



More information about the CIG-COMMITS mailing list