[cig-commits] r6572 - in short/3D/PyLith/trunk: . pylith/faults
unittests/libtests unittests/libtests/faults
unittests/pytests unittests/pytests/faults
unittests/pytests/faults/data
brad at geodynamics.org
brad at geodynamics.org
Sat Apr 14 16:19:27 PDT 2007
Author: brad
Date: 2007-04-14 16:19:25 -0700 (Sat, 14 Apr 2007)
New Revision: 6572
Added:
short/3D/PyLith/trunk/unittests/libtests/faults/
short/3D/PyLith/trunk/unittests/libtests/faults/Makefile.am
short/3D/PyLith/trunk/unittests/libtests/faults/TestFault.cc
short/3D/PyLith/trunk/unittests/libtests/faults/TestFault.hh
short/3D/PyLith/trunk/unittests/libtests/faults/TestFaultCohesive.cc
short/3D/PyLith/trunk/unittests/libtests/faults/TestFaultCohesive.hh
short/3D/PyLith/trunk/unittests/libtests/faults/TestFaultCohesiveKin.cc
short/3D/PyLith/trunk/unittests/libtests/faults/TestFaultCohesiveKin.hh
short/3D/PyLith/trunk/unittests/libtests/faults/test_faults.cc
short/3D/PyLith/trunk/unittests/pytests/faults/
short/3D/PyLith/trunk/unittests/pytests/faults/Makefile.am
short/3D/PyLith/trunk/unittests/pytests/faults/TestFault.py
short/3D/PyLith/trunk/unittests/pytests/faults/TestFaultCohesive.py
short/3D/PyLith/trunk/unittests/pytests/faults/TestFaultCohesiveKin.py
short/3D/PyLith/trunk/unittests/pytests/faults/data/
short/3D/PyLith/trunk/unittests/pytests/faults/data/Makefile.am
short/3D/PyLith/trunk/unittests/pytests/faults/testfaults.py
Modified:
short/3D/PyLith/trunk/TODO
short/3D/PyLith/trunk/configure.ac
short/3D/PyLith/trunk/pylith/faults/FaultCohesiveKin.py
short/3D/PyLith/trunk/unittests/libtests/Makefile.am
short/3D/PyLith/trunk/unittests/pytests/Makefile.am
Log:
Started work on basic unit tests for faults. Tests not implemented are forced to fail via throwing an exception.
Modified: short/3D/PyLith/trunk/TODO
===================================================================
--- short/3D/PyLith/trunk/TODO 2007-04-14 04:14:57 UTC (rev 6571)
+++ short/3D/PyLith/trunk/TODO 2007-04-14 23:19:25 UTC (rev 6572)
@@ -2,6 +2,14 @@
MAIN PRIORITIES (Brad)
======================================================================
+Cleanup
+
+ Use pylith/utils/sievefwd.hh and pylith/utils/sievetypes.hh in unit
+ tests. Remove typedefs when possible (take advantage of typedefs in
+ seivefwd.hh).
+
+ Use MeshIOAscii to get mesh information into Python tests?
+
0. Start implementing faults
a. Create Faults object
b. Add creation of cohesive elements
@@ -37,7 +45,7 @@
d. bindings
e. unit tests at Python level
-3. Implement MeshIOHDF5 & HDF5
+3. Implement MeshIOHDF5 & HDF5 (helper class)
a. C++ objects
b. unit tests at C++ level
c. Python object (MeshIOHDF5)
Modified: short/3D/PyLith/trunk/configure.ac
===================================================================
--- short/3D/PyLith/trunk/configure.ac 2007-04-14 04:14:57 UTC (rev 6571)
+++ short/3D/PyLith/trunk/configure.ac 2007-04-14 23:19:25 UTC (rev 6572)
@@ -161,11 +161,14 @@
applications/Makefile
unittests/Makefile
unittests/libtests/Makefile
+ unittests/libtests/faults/Makefile
unittests/libtests/feassemble/Makefile
unittests/libtests/materials/Makefile
unittests/libtests/materials/data/Makefile
unittests/libtests/meshio/Makefile
unittests/pytests/Makefile
+ unittests/pytests/faults/Makefile
+ unittests/pytests/faults/data/Makefile
unittests/pytests/feassemble/Makefile
unittests/pytests/materials/Makefile
unittests/pytests/materials/data/Makefile
Modified: short/3D/PyLith/trunk/pylith/faults/FaultCohesiveKin.py
===================================================================
--- short/3D/PyLith/trunk/pylith/faults/FaultCohesiveKin.py 2007-04-14 04:14:57 UTC (rev 6571)
+++ short/3D/PyLith/trunk/pylith/faults/FaultCohesiveKin.py 2007-04-14 23:19:25 UTC (rev 6572)
@@ -21,7 +21,7 @@
from FaultCohesive import FaultCohesive
# FaultCohesiveKin class
-class FaultCohesiveKin(Fault):
+class FaultCohesiveKin(FaultCohesive):
"""
Python object for a fault surface with kinematic (prescribed) slip
implemented with cohesive elements.
Modified: short/3D/PyLith/trunk/unittests/libtests/Makefile.am
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/Makefile.am 2007-04-14 04:14:57 UTC (rev 6571)
+++ short/3D/PyLith/trunk/unittests/libtests/Makefile.am 2007-04-14 23:19:25 UTC (rev 6572)
@@ -11,8 +11,10 @@
#
SUBDIRS = \
+ faults \
feassemble \
materials \
meshio
+
# End of file
Added: short/3D/PyLith/trunk/unittests/libtests/faults/Makefile.am
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/faults/Makefile.am 2007-04-14 04:14:57 UTC (rev 6571)
+++ short/3D/PyLith/trunk/unittests/libtests/faults/Makefile.am 2007-04-14 23:19:25 UTC (rev 6572)
@@ -0,0 +1,47 @@
+# -*- Makefile -*-
+#
+# ----------------------------------------------------------------------
+#
+# Brad T. Aagaard
+# U.S. Geological Survey
+#
+# <LicenseText>
+#
+# ----------------------------------------------------------------------
+#
+
+subpackage = faults
+include $(top_srcdir)/subpackage.am
+
+#SUBDIRS = data
+
+TESTS = testfaults
+
+check_PROGRAMS = testfaults
+
+# Primary source files
+testfaults_SOURCES = \
+ TestFault.cc \
+ TestFaultCohesive.cc \
+ TestFaultCohesiveKin.cc \
+ test_faults.cc
+
+noinst_HEADERS = \
+ TestFault.hh
+
+# Source files associated with testing data
+testfaults_SOURCES +=
+
+noinst_HEADERS +=
+
+testfaults_LDFLAGS = $(PETSC_LIB)
+
+AM_CPPFLAGS = $(PETSC_SIEVE_FLAGS) $(PETSC_INCLUDE)
+
+testfaults_LDADD = \
+ -lcppunit -ldl \
+ $(top_builddir)/libsrc/libpylith.la \
+ -lspatialdata
+
+
+# End of file
Added: short/3D/PyLith/trunk/unittests/libtests/faults/TestFault.cc
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/faults/TestFault.cc 2007-04-14 04:14:57 UTC (rev 6571)
+++ short/3D/PyLith/trunk/unittests/libtests/faults/TestFault.cc 2007-04-14 23:19:25 UTC (rev 6572)
@@ -0,0 +1,58 @@
+// -*- C++ -*-
+//
+// ----------------------------------------------------------------------
+//
+// Brad T. Aagaard
+// U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ----------------------------------------------------------------------
+//
+
+#include <portinfo>
+
+#include "TestFault.hh" // Implementation of class methods
+
+#include "pylith/faults/FaultCohesiveKin.hh" // USES FaultCohesiveKin
+
+#include <string> // USES std::string
+#include <stdexcept> // USES std::logic_error TEMPORARY
+
+// ----------------------------------------------------------------------
+CPPUNIT_TEST_SUITE_REGISTRATION( pylith::faults::TestFault );
+
+// ----------------------------------------------------------------------
+// Test id()
+void
+pylith::faults::TestFault::testID(void)
+{ // testID
+ const int id = 346;
+ FaultCohesiveKin fault;
+ fault.id(id);
+
+ CPPUNIT_ASSERT(id == fault.id());
+} // testID
+
+// ----------------------------------------------------------------------
+// Test label()
+void
+pylith::faults::TestFault::testLabel(void)
+{ // testLabel
+ const std::string label = "the_database";
+ FaultCohesiveKin fault;
+ fault.label(label.c_str());
+
+ CPPUNIT_ASSERT_EQUAL(label, fault.label());
+} // testLabel
+
+// ----------------------------------------------------------------------
+// Test initialize()
+void
+pylith::faults::TestFault::testInitialize(void)
+{ // testInitialize
+ throw std::logic_error("Need to implement test.");
+} // testInitialize
+
+
+// End of file
Added: short/3D/PyLith/trunk/unittests/libtests/faults/TestFault.hh
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/faults/TestFault.hh 2007-04-14 04:14:57 UTC (rev 6571)
+++ short/3D/PyLith/trunk/unittests/libtests/faults/TestFault.hh 2007-04-14 23:19:25 UTC (rev 6572)
@@ -0,0 +1,61 @@
+// -*- C++ -*-
+//
+// ----------------------------------------------------------------------
+//
+// Brad T. Aagaard
+// U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ----------------------------------------------------------------------
+//
+
+/**
+ * @file unittests/libtests/faults/TestFault.hh
+ *
+ * @brief C++ TestFault object
+ *
+ * C++ unit testing for Fault.
+ */
+
+#if !defined(pylith_faults_testfault_hh)
+#define pylith_faults_testfault_hh
+
+#include <cppunit/extensions/HelperMacros.h>
+
+/// Namespace for pylith package
+namespace pylith {
+ namespace faults {
+ class Fault;
+ class TestFault;
+ } // faults
+} // pylith
+
+/// C++ unit testing for Fault
+class pylith::faults::TestFault : public CppUnit::TestFixture
+{ // class TestFault
+
+ // CPPUNIT TEST SUITE /////////////////////////////////////////////////
+ CPPUNIT_TEST_SUITE( TestFault );
+ CPPUNIT_TEST( testID );
+ CPPUNIT_TEST( testLabel );
+ CPPUNIT_TEST( testInitialize );
+ CPPUNIT_TEST_SUITE_END();
+
+ // PUBLIC METHODS /////////////////////////////////////////////////////
+public :
+
+ /// Test id()
+ void testID(void);
+
+ /// Test label()
+ void testLabel(void);
+
+ /// Test initialize()
+ void testInitialize(void);
+
+}; // class TestFault
+
+#endif // pylith_faults_testfault_hh
+
+// End of file
Added: short/3D/PyLith/trunk/unittests/libtests/faults/TestFaultCohesive.cc
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/faults/TestFaultCohesive.cc 2007-04-14 04:14:57 UTC (rev 6571)
+++ short/3D/PyLith/trunk/unittests/libtests/faults/TestFaultCohesive.cc 2007-04-14 23:19:25 UTC (rev 6572)
@@ -0,0 +1,56 @@
+// -*- C++ -*-
+//
+// ----------------------------------------------------------------------
+//
+// Brad T. Aagaard
+// U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ----------------------------------------------------------------------
+//
+
+#include <portinfo>
+
+#include "TestFaultCohesive.hh" // Implementation of class methods
+
+//#include "data/FaultCohesiveData.hh" // USES FaultCohesiveData
+
+#include "pylith/faults/FaultCohesiveKin.hh" // USES FaultsCohesiveKin
+
+#include "pylith/utils/sievetypes.hh" // USES PETSc Mesh
+
+// ----------------------------------------------------------------------
+CPPUNIT_TEST_SUITE_REGISTRATION( pylith::faults::TestFaultCohesive );
+
+// ----------------------------------------------------------------------
+// Test adjustTopology() with 1-D line element.
+void
+pylith::faults::TestFaultCohesive::testAdjustTopologyLine(void)
+{ // testAdjustTopologyLine
+ //FaultDataLine data;
+ //_testAdjustTopologyLine(data);
+} // testAdjustTopologyLine
+
+// ----------------------------------------------------------------------
+// Test adjustTopology().
+void
+pylith::faults::TestFaultCohesive::_testAdjustTopologyLine(
+ const FaultData& data)
+{ // _testAdjustTopologyLine
+ //ALE::Obj<ALE::Mesh> mesh(new ALE::Mesh);
+ //_createMesh(&mesh, data);
+
+ FaultCohesiveKin fault;
+} // _testAdjustTopologyLine
+
+// ----------------------------------------------------------------------
+// Create mesh.
+void
+pylith::faults::TestFaultCohesive::_createMesh(ALE::Obj<ALE::Mesh>* mesh,
+ const FaultData& data)
+{ // _createMesh
+} // _createMesh
+
+
+// End of file
Added: short/3D/PyLith/trunk/unittests/libtests/faults/TestFaultCohesive.hh
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/faults/TestFaultCohesive.hh 2007-04-14 04:14:57 UTC (rev 6571)
+++ short/3D/PyLith/trunk/unittests/libtests/faults/TestFaultCohesive.hh 2007-04-14 23:19:25 UTC (rev 6572)
@@ -0,0 +1,66 @@
+// -*- C++ -*-
+//
+// ----------------------------------------------------------------------
+//
+// Brad T. Aagaard
+// U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ----------------------------------------------------------------------
+//
+
+/**
+ * @file unittests/libtests/faults/TestFaultCohesive.hh
+ *
+ * @brief C++ TestFaultCohesive object
+ *
+ * C++ unit testing for Fault.
+ */
+
+#if !defined(pylith_faults_testfaultcohesive_hh)
+#define pylith_faults_testfaultcohesive_hh
+
+#include <cppunit/extensions/HelperMacros.h>
+
+#include "pylith/utils/sievefwd.hh" // USES PETSc Mesh
+
+/// Namespace for pylith package
+namespace pylith {
+ namespace faults {
+ class Fault;
+ class TestFaultCohesive;
+ class FaultData;
+ } // faults
+} // pylith
+
+/// C++ unit testing for Fault
+class pylith::faults::TestFaultCohesive : public CppUnit::TestFixture
+{ // class TestFaultCohesive
+
+ // CPPUNIT TEST SUITE /////////////////////////////////////////////////
+ CPPUNIT_TEST_SUITE( TestFaultCohesive );
+ CPPUNIT_TEST( testAdjustTopologyLine );
+ CPPUNIT_TEST_SUITE_END();
+
+ // PUBLIC METHODS /////////////////////////////////////////////////////
+public :
+
+ /// Test adjustTopology() with 1-D line element.
+ void testAdjustTopologyLine(void);
+
+ // PROTECTED METHODS //////////////////////////////////////////////////
+public :
+
+ /// Test adjustTopology().
+ void _testAdjustTopologyLine(const FaultData& data);
+
+ /// Create mesh.
+ void _createMesh(ALE::Obj<ALE::Mesh>* mesh,
+ const FaultData& data);
+
+}; // class TestFaultCohesive
+
+#endif // pylith_faults_testfaultcohesive_hh
+
+// End of file
Added: short/3D/PyLith/trunk/unittests/libtests/faults/TestFaultCohesiveKin.cc
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/faults/TestFaultCohesiveKin.cc 2007-04-14 04:14:57 UTC (rev 6571)
+++ short/3D/PyLith/trunk/unittests/libtests/faults/TestFaultCohesiveKin.cc 2007-04-14 23:19:25 UTC (rev 6572)
@@ -0,0 +1,42 @@
+// -*- C++ -*-
+//
+// ----------------------------------------------------------------------
+//
+// Brad T. Aagaard
+// U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ----------------------------------------------------------------------
+//
+
+#include <portinfo>
+
+#include "TestFaultCohesiveKin.hh" // Implementation of class methods
+
+#include "pylith/faults/FaultCohesiveKin.hh" // USES FaultCohesiveKin
+
+// ----------------------------------------------------------------------
+CPPUNIT_TEST_SUITE_REGISTRATION( pylith::faults::TestFaultCohesiveKin );
+
+// ----------------------------------------------------------------------
+// Test clone()
+void
+pylith::faults::TestFaultCohesiveKin::testClone(void)
+{ // testClone
+ const int id = 65;
+ const std::string label = "fault ABC";
+
+ FaultCohesiveKin fault;
+ fault.id(id);
+ fault.label(label.c_str());
+
+ Fault* faultCopy = fault.clone();
+ CPPUNIT_ASSERT(0 != faultCopy);
+
+ CPPUNIT_ASSERT_EQUAL(id, faultCopy->id());
+ CPPUNIT_ASSERT_EQUAL(label, faultCopy->label());
+} // testClone
+
+
+// End of file
Added: short/3D/PyLith/trunk/unittests/libtests/faults/TestFaultCohesiveKin.hh
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/faults/TestFaultCohesiveKin.hh 2007-04-14 04:14:57 UTC (rev 6571)
+++ short/3D/PyLith/trunk/unittests/libtests/faults/TestFaultCohesiveKin.hh 2007-04-14 23:19:25 UTC (rev 6572)
@@ -0,0 +1,53 @@
+// -*- C++ -*-
+//
+// ----------------------------------------------------------------------
+//
+// Brad T. Aagaard
+// U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ----------------------------------------------------------------------
+//
+
+/**
+ * @file unittests/libtests/faults/TestFaultCohesiveKin.hh
+ *
+ * @brief C++ TestFaultCohesiveKin object
+ *
+ * C++ unit testing for FaultCohesiveKin.
+ */
+
+#if !defined(pylith_faults_testfaultcohesivekin_hh)
+#define pylith_faults_testfaultcohesivekin_hh
+
+#include "TestFaultCohesive.hh"
+
+/// Namespace for pylith package
+namespace pylith {
+ namespace faults {
+ class TestFaultCohesiveKin;
+ } // faults
+} // pylith
+
+/// C++ unit testing for FaultCohesiveKin
+class pylith::faults::TestFaultCohesiveKin : public TestFaultCohesive
+{ // class TestFaultCohesiveKin
+
+ // CPPUNIT TEST SUITE /////////////////////////////////////////////////
+ CPPUNIT_TEST_SUITE( TestFaultCohesiveKin );
+ CPPUNIT_TEST( testClone );
+ CPPUNIT_TEST_SUITE_END();
+
+ // PUBLIC METHODS /////////////////////////////////////////////////////
+public :
+
+ /// Test clone()
+ void testClone(void);
+
+}; // class TestFaultCohesiveKin
+
+#endif // pylith_faults_testfaultcohesivekin_hh
+
+
+// End of file
Added: short/3D/PyLith/trunk/unittests/libtests/faults/test_faults.cc
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/faults/test_faults.cc 2007-04-14 04:14:57 UTC (rev 6571)
+++ short/3D/PyLith/trunk/unittests/libtests/faults/test_faults.cc 2007-04-14 23:19:25 UTC (rev 6572)
@@ -0,0 +1,67 @@
+// -*- C++ -*-
+//
+// ----------------------------------------------------------------------
+//
+// Brad T. Aagaard
+// U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ----------------------------------------------------------------------
+//
+
+#include "petsc.h"
+
+#include <cppunit/extensions/TestFactoryRegistry.h>
+
+#include <cppunit/BriefTestProgressListener.h>
+#include <cppunit/extensions/TestFactoryRegistry.h>
+#include <cppunit/TestResult.h>
+#include <cppunit/TestResultCollector.h>
+#include <cppunit/TestRunner.h>
+#include <cppunit/TextOutputter.h>
+
+#include <stdlib.h> // USES abort()
+
+int
+main(int argc,
+ char* argv[])
+{ // main
+ CppUnit::TestResultCollector result;
+
+ try {
+ // Initialize PETSc
+ PetscErrorCode err = PetscInitialize(&argc, &argv, PETSC_NULL, PETSC_NULL);
+ CHKERRQ(err);
+
+ // Create event manager and test controller
+ CppUnit::TestResult controller;
+
+ // Add listener to collect test results
+ controller.addListener(&result);
+
+ // Add listener to show progress as tests run
+ CppUnit::BriefTestProgressListener progress;
+ controller.addListener(&progress);
+
+ // Add top suite to test runner
+ CppUnit::TestRunner runner;
+ runner.addTest(CppUnit::TestFactoryRegistry::getRegistry().makeTest());
+ runner.run(controller);
+
+ // Print tests
+ CppUnit::TextOutputter outputter(&result, std::cerr);
+ outputter.write();
+
+ // Finalize PETSc
+ err = PetscFinalize();
+ CHKERRQ(err);
+ } catch (...) {
+ abort();
+ } // catch
+
+ return (result.wasSuccessful() ? 0 : 1);
+} // main
+
+
+// End of file
Modified: short/3D/PyLith/trunk/unittests/pytests/Makefile.am
===================================================================
--- short/3D/PyLith/trunk/unittests/pytests/Makefile.am 2007-04-14 04:14:57 UTC (rev 6571)
+++ short/3D/PyLith/trunk/unittests/pytests/Makefile.am 2007-04-14 23:19:25 UTC (rev 6572)
@@ -11,10 +11,12 @@
#
SUBDIRS = \
+ faults \
feassemble \
materials \
meshio \
topology \
utils
+
# End of file
Added: short/3D/PyLith/trunk/unittests/pytests/faults/Makefile.am
===================================================================
--- short/3D/PyLith/trunk/unittests/pytests/faults/Makefile.am 2007-04-14 04:14:57 UTC (rev 6571)
+++ short/3D/PyLith/trunk/unittests/pytests/faults/Makefile.am 2007-04-14 23:19:25 UTC (rev 6572)
@@ -0,0 +1,28 @@
+# -*- Makefile -*-
+#
+# ----------------------------------------------------------------------
+#
+# Brad T. Aagaard
+# U.S. Geological Survey
+#
+# <LicenseText>
+#
+# ----------------------------------------------------------------------
+#
+
+subpackage = faults
+include $(top_srcdir)/subpackage.am
+
+SUBDIRS = data
+
+TESTS = testfaults.py
+
+check_SCRIPTS = testfaults.py
+
+noinst_PYTHON = \
+ TestFault.py \
+ TestFaultCohesive.py \
+ TestFaultCohesiveKin.py
+
+
+# End of file
Added: short/3D/PyLith/trunk/unittests/pytests/faults/TestFault.py
===================================================================
--- short/3D/PyLith/trunk/unittests/pytests/faults/TestFault.py 2007-04-14 04:14:57 UTC (rev 6571)
+++ short/3D/PyLith/trunk/unittests/pytests/faults/TestFault.py 2007-04-14 23:19:25 UTC (rev 6572)
@@ -0,0 +1,44 @@
+#!/usr/bin/env python
+#
+# ======================================================================
+#
+# Brad T. Aagaard
+# U.S. Geological Survey
+#
+# {LicenseText}
+#
+# ======================================================================
+#
+
+## @file unittests/pytests/faults/TestFault.py
+
+## @brief Unit testing of Fault object.
+
+import unittest
+
+from pylith.faults.Fault import Fault
+
+# ----------------------------------------------------------------------
+class TestFault(unittest.TestCase):
+ """
+ Unit testing of Fault object.
+ """
+
+ def test_constructor(self):
+ """
+ Test constructor.
+ """
+ fault = Fault()
+ self.assertEqual(None, fault.cppHandle)
+ return
+
+
+ def test_initialize(self):
+ """
+ Test initialize().
+ """
+ raise NotImplementedError("Need to implement unit test.")
+ return
+
+
+# End of file
Added: short/3D/PyLith/trunk/unittests/pytests/faults/TestFaultCohesive.py
===================================================================
--- short/3D/PyLith/trunk/unittests/pytests/faults/TestFaultCohesive.py 2007-04-14 04:14:57 UTC (rev 6571)
+++ short/3D/PyLith/trunk/unittests/pytests/faults/TestFaultCohesive.py 2007-04-14 23:19:25 UTC (rev 6572)
@@ -0,0 +1,44 @@
+#!/usr/bin/env python
+#
+# ======================================================================
+#
+# Brad T. Aagaard
+# U.S. Geological Survey
+#
+# {LicenseText}
+#
+# ======================================================================
+#
+
+## @file unittests/pytests/faults/TestFaultCohesive.py
+
+## @brief Unit testing of Fault object.
+
+import unittest
+
+from pylith.faults.FaultCohesive import FaultCohesive
+
+# ----------------------------------------------------------------------
+class TestFaultCohesive(unittest.TestCase):
+ """
+ Unit testing of Fault object.
+ """
+
+ def test_constructor(self):
+ """
+ Test constructor.
+ """
+ fault = FaultCohesive()
+ self.assertEqual(None, fault.cppHandle)
+ return
+
+
+ def test_adjustTopology(self):
+ """
+ Test initialize().
+ """
+ raise NotImplementedError("Need to implement unit test.")
+ return
+
+
+# End of file
Added: short/3D/PyLith/trunk/unittests/pytests/faults/TestFaultCohesiveKin.py
===================================================================
--- short/3D/PyLith/trunk/unittests/pytests/faults/TestFaultCohesiveKin.py 2007-04-14 04:14:57 UTC (rev 6571)
+++ short/3D/PyLith/trunk/unittests/pytests/faults/TestFaultCohesiveKin.py 2007-04-14 23:19:25 UTC (rev 6572)
@@ -0,0 +1,36 @@
+#!/usr/bin/env python
+#
+# ======================================================================
+#
+# Brad T. Aagaard
+# U.S. Geological Survey
+#
+# {LicenseText}
+#
+# ======================================================================
+#
+
+## @file unittests/pytests/faults/TestFault.py
+
+## @brief Unit testing of Fault object.
+
+import unittest
+
+from pylith.faults.FaultCohesiveKin import FaultCohesiveKin
+
+# ----------------------------------------------------------------------
+class TestFaultCohesiveKin(unittest.TestCase):
+ """
+ Unit testing of Fault object.
+ """
+
+ def test_constructor(self):
+ """
+ Test constructor.
+ """
+ fault = FaultCohesiveKin()
+ self.failIfEqual(None, fault.cppHandle)
+ return
+
+
+# End of file
Added: short/3D/PyLith/trunk/unittests/pytests/faults/data/Makefile.am
===================================================================
--- short/3D/PyLith/trunk/unittests/pytests/faults/data/Makefile.am 2007-04-14 04:14:57 UTC (rev 6571)
+++ short/3D/PyLith/trunk/unittests/pytests/faults/data/Makefile.am 2007-04-14 23:19:25 UTC (rev 6572)
@@ -0,0 +1,29 @@
+# -*- Makefile -*-
+#
+# ----------------------------------------------------------------------
+#
+# Brad T. Aagaard
+# U.S. Geological Survey
+#
+# <LicenseText>
+#
+# ----------------------------------------------------------------------
+#
+
+noinst_DATA =
+
+noinst_TMP =
+
+# 'export' the input files by performing a mock install
+export_datadir = $(top_builddir)/unittests/pytests/materials/data
+export-data: $(noinst_DATA)
+ for f in $(noinst_DATA); do $(install_sh_DATA) $(srcdir)/$$f $(export_datadir); done
+
+BUILT_SOURCES = export-data
+
+CLEANFILES = \
+ $(export_datadir)/$(noinst_DATA) \
+ $(export_datadir)/$(noinst_TMP)
+
+
+# End of file
Added: short/3D/PyLith/trunk/unittests/pytests/faults/testfaults.py
===================================================================
--- short/3D/PyLith/trunk/unittests/pytests/faults/testfaults.py 2007-04-14 04:14:57 UTC (rev 6571)
+++ short/3D/PyLith/trunk/unittests/pytests/faults/testfaults.py 2007-04-14 23:19:25 UTC (rev 6572)
@@ -0,0 +1,77 @@
+#!/usr/bin/env python
+#
+# ======================================================================
+#
+# Brad T. Aagaard
+# U.S. Geological Survey
+#
+# {LicenseText}
+#
+# ======================================================================
+#
+
+## @file unittests/faults/testfaults.py
+
+## @brief Python application for testing faults code.
+
+from pyre.applications.Script import Script
+
+import unittest
+
+class TestApp(Script):
+ """
+ Test application.
+ """
+
+ # PUBLIC METHODS /////////////////////////////////////////////////////
+
+ def __init__(self, name="testapp"):
+ """
+ Constructor.
+ """
+ Script.__init__(self, name)
+ return
+
+
+ def main(self):
+ """
+ Run the application.
+ """
+ from pylith.utils.PetscManager import PetscManager
+ petsc = PetscManager()
+ petsc.initialize()
+
+ unittest.TextTestRunner(verbosity=2).run(self._suite())
+
+ petsc.finalize()
+ return
+
+
+ # PRIVATE METHODS ////////////////////////////////////////////////////
+
+ def _suite(self):
+ """
+ Setup the test suite.
+ """
+
+ suite = unittest.TestSuite()
+
+ from TestFault import TestFault
+ suite.addTest(unittest.makeSuite(TestFault))
+
+ from TestFaultCohesive import TestFaultCohesive
+ suite.addTest(unittest.makeSuite(TestFaultCohesive))
+
+ from TestFaultCohesiveKin import TestFaultCohesiveKin
+ suite.addTest(unittest.makeSuite(TestFaultCohesiveKin))
+
+ return suite
+
+
+# ----------------------------------------------------------------------
+if __name__ == '__main__':
+ app = TestApp()
+ app.run()
+
+
+# End of file
Property changes on: short/3D/PyLith/trunk/unittests/pytests/faults/testfaults.py
___________________________________________________________________
Name: svn:executable
+ *
More information about the cig-commits
mailing list