[cig-commits] r16587 - short/3D/PyLith/trunk/unittests/pytests/materials
willic3 at geodynamics.org
willic3 at geodynamics.org
Tue Apr 27 18:28:21 PDT 2010
Author: willic3
Date: 2010-04-27 18:28:20 -0700 (Tue, 27 Apr 2010)
New Revision: 16587
Added:
short/3D/PyLith/trunk/unittests/pytests/materials/TestDruckerPrager3D.py
Modified:
short/3D/PyLith/trunk/unittests/pytests/materials/Makefile.am
short/3D/PyLith/trunk/unittests/pytests/materials/testmaterials.py
Log:
Added python unit tests for DruckerPrager3D.
Modified: short/3D/PyLith/trunk/unittests/pytests/materials/Makefile.am
===================================================================
--- short/3D/PyLith/trunk/unittests/pytests/materials/Makefile.am 2010-04-28 00:09:17 UTC (rev 16586)
+++ short/3D/PyLith/trunk/unittests/pytests/materials/Makefile.am 2010-04-28 01:28:20 UTC (rev 16587)
@@ -32,7 +32,8 @@
TestMaxwellIsotropic3D.py \
TestMaxwellPlaneStrain.py \
TestGenMaxwellIsotropic3D.py \
- TestPowerLaw3D.py
+ TestPowerLaw3D.py \
+ TestDruckerPrager3D.py
# End of file
Added: short/3D/PyLith/trunk/unittests/pytests/materials/TestDruckerPrager3D.py
===================================================================
--- short/3D/PyLith/trunk/unittests/pytests/materials/TestDruckerPrager3D.py (rev 0)
+++ short/3D/PyLith/trunk/unittests/pytests/materials/TestDruckerPrager3D.py 2010-04-28 01:28:20 UTC (rev 16587)
@@ -0,0 +1,88 @@
+#!/usr/bin/env python
+#
+# ======================================================================
+#
+# Brad T. Aagaard
+# U.S. Geological Survey
+#
+# {LicenseText}
+#
+# ======================================================================
+#
+
+## @file unittests/pytests/materials/TestDruckerPrager3D.py
+
+## @brief Unit testing of DruckerPrager3D object.
+
+import unittest
+
+from pylith.materials.DruckerPrager3D import DruckerPrager3D
+
+# ----------------------------------------------------------------------
+class TestDruckerPrager3D(unittest.TestCase):
+ """
+ Unit testing of DruckerPrager3D object.
+ """
+
+ def setUp(self):
+ """
+ Setup test subject.
+ """
+ self.material = DruckerPrager3D()
+ return
+
+
+ def test_constructor(self):
+ """
+ Test constructor.
+ """
+ self.assertEqual(3, 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(6, self.material.tensorSize())
+ return
+
+
+ def testNeedNewJacobian(self):
+ """
+ Test needNewJacobian().
+ """
+ # Default should be False.
+ self.failIf(self.material.needNewJacobian())
+
+ # Should require a new Jacobian even if time step is the same.
+ self.material.timeStep(1.0)
+ self.failUnless(self.material.needNewJacobian())
+ self.material.timeStep(2.0)
+ self.failUnless(self.material.needNewJacobian())
+
+ self.material.timeStep(2.0)
+ self.failUnless(self.material.needNewJacobian())
+ return
+
+
+ def test_factory(self):
+ """
+ Test factory method.
+ """
+ from pylith.materials.DruckerPrager3D 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 2010-04-28 00:09:17 UTC (rev 16586)
+++ short/3D/PyLith/trunk/unittests/pytests/materials/testmaterials.py 2010-04-28 01:28:20 UTC (rev 16587)
@@ -83,6 +83,9 @@
from TestPowerLaw3D import TestPowerLaw3D
suite.addTest(unittest.makeSuite(TestPowerLaw3D))
+ from TestDruckerPrager3D import TestDruckerPrager3D
+ suite.addTest(unittest.makeSuite(TestDruckerPrager3D))
+
from TestMaterial import TestMaterial
suite.addTest(unittest.makeSuite(TestMaterial))
More information about the CIG-COMMITS
mailing list