[cig-commits] r5201 - in short/3D/PyLith/trunk: . libsrc/meshio
unittests/pytests unittests/pytests/meshio
brad at geodynamics.org
brad at geodynamics.org
Tue Nov 7 17:11:17 PST 2006
Author: brad
Date: 2006-11-07 17:11:16 -0800 (Tue, 07 Nov 2006)
New Revision: 5201
Added:
short/3D/PyLith/trunk/unittests/pytests/meshio/
short/3D/PyLith/trunk/unittests/pytests/meshio/Makefile.am
short/3D/PyLith/trunk/unittests/pytests/meshio/TestMeshIO.py
short/3D/PyLith/trunk/unittests/pytests/meshio/TestMeshIOAscii.py
short/3D/PyLith/trunk/unittests/pytests/meshio/testmeshio.py
Modified:
short/3D/PyLith/trunk/configure.ac
short/3D/PyLith/trunk/libsrc/meshio/README.txt
short/3D/PyLith/trunk/unittests/pytests/Makefile.am
Log:
Started implementing pytests for MeshIO.
Modified: short/3D/PyLith/trunk/configure.ac
===================================================================
--- short/3D/PyLith/trunk/configure.ac 2006-11-08 01:09:03 UTC (rev 5200)
+++ short/3D/PyLith/trunk/configure.ac 2006-11-08 01:11:16 UTC (rev 5201)
@@ -158,6 +158,7 @@
unittests/libtests/meshio/Makefile
unittests/pytests/Makefile
unittests/pytests/feassemble/Makefile
+ unittests/pytests/meshio/Makefile
doc/Makefile])
# libsrc/materials/Makefile
Modified: short/3D/PyLith/trunk/libsrc/meshio/README.txt
===================================================================
--- short/3D/PyLith/trunk/libsrc/meshio/README.txt 2006-11-08 01:09:03 UTC (rev 5200)
+++ short/3D/PyLith/trunk/libsrc/meshio/README.txt 2006-11-08 01:11:16 UTC (rev 5201)
@@ -1,24 +0,0 @@
-Abstract
-
- public
-
- read(ALE::PetscMesh*)
- write(const ALE::PetscMesh&)
-
- protected, pure virtual
-
- _open(filename)
- _readMeshInfo(dimension)
- _writeMeshInfo(dimension)
- _readVertices(coordinates, numVertices, numDims)
- _writeVertices(coordinates, numVertices, numDims)
- _readElements(elements, numElements, numCorners)
- _writeElements(elements, numElements, numCorners)
- _readGroup()
- _writeGroup()
- _close()
-
- protected
-
- _addGroup(name, dimension, entries, numEntries)
- _getGroup(name, dimension, entries, numEntries)
Modified: short/3D/PyLith/trunk/unittests/pytests/Makefile.am
===================================================================
--- short/3D/PyLith/trunk/unittests/pytests/Makefile.am 2006-11-08 01:09:03 UTC (rev 5200)
+++ short/3D/PyLith/trunk/unittests/pytests/Makefile.am 2006-11-08 01:11:16 UTC (rev 5201)
@@ -11,6 +11,7 @@
#
SUBDIRS = \
- feassemble
+ feassemble \
+ meshio
# End of file
Added: short/3D/PyLith/trunk/unittests/pytests/meshio/Makefile.am
===================================================================
--- short/3D/PyLith/trunk/unittests/pytests/meshio/Makefile.am 2006-11-08 01:09:03 UTC (rev 5200)
+++ short/3D/PyLith/trunk/unittests/pytests/meshio/Makefile.am 2006-11-08 01:11:16 UTC (rev 5201)
@@ -0,0 +1,52 @@
+# -*- Makefile -*-
+#
+# ----------------------------------------------------------------------
+#
+# Brad T. Aagaard
+# U.S. Geological Survey
+#
+# <LicenseText>
+#
+# ----------------------------------------------------------------------
+#
+
+subpackage = meshio
+include $(top_srcdir)/subpackage.am
+
+TESTS = testmeshio.py
+
+check_SCRIPTS = testmeshio.py
+
+noinst_PYTHON = \
+ TestMeshIO.py \
+ TestMeshIOAscii.py
+
+
+# module
+#subpkgpyexec_LTLIBRARIES = testmeshiomodule.la
+
+#testmeshiomodule_la_LDFLAGS = -module
+
+#testmeshiomodule_la_SOURCES = testmeshio.pyxe
+
+#nodist_testmeshiomodule_la_SOURCES = \
+# testmeshio.c testmeshio_embed.cpp testmeshio_embed.h
+
+#testmeshiomodule_la_LIBADD = \
+# $(PETSC_LIB)
+
+#INCLUDES += -I$(PYTHON_INCDIR) $(PETSC_INCLUDE)
+
+#testmeshio.pyx testmeshio_embed.cpp testmeshio_embed.h: testmeshio.pyxe
+# cp $< . && pyrexembed testmeshio.pyxe && rm -f testmeshio.pyxe
+#testmeshio_embed.cpp: testmeshio_embed.h
+#testmeshio_embed.h: testmeshio.pyx
+
+#.pyx.c:
+# pyrexc $<
+
+#CLEANFILES = \
+# testmeshio.pyx testmeshio.c *_embed.* \
+# $(am__installdirs)/testmeshiomodule.*
+
+# End of file
Added: short/3D/PyLith/trunk/unittests/pytests/meshio/TestMeshIO.py
===================================================================
--- short/3D/PyLith/trunk/unittests/pytests/meshio/TestMeshIO.py 2006-11-08 01:09:03 UTC (rev 5200)
+++ short/3D/PyLith/trunk/unittests/pytests/meshio/TestMeshIO.py 2006-11-08 01:11:16 UTC (rev 5201)
@@ -0,0 +1,42 @@
+#!/usr/bin/env python
+#
+# ======================================================================
+#
+# Brad T. Aagaard
+# U.S. Geological Survey
+#
+# {LicenseText}
+#
+# ======================================================================
+#
+
+## @file unittests/pytests/meshio/TestMeshIO.py
+
+## @brief Unit testing of MeshIO object.
+
+import unittest
+
+# ----------------------------------------------------------------------
+class TestMeshIO(unittest.TestCase):
+ """
+ Unit testing of MeshIO object.
+ """
+
+
+ def test_interpolate(self):
+ """
+ Test interpolate access.
+ """
+ from pylith.meshio.MeshIO import MeshIO
+ iohandler = MeshIO()
+
+ value = False # default is False
+ self.assertEqual(value, iohandler.interpolate)
+
+ value = True
+ iohandler.interpolate = value
+ self.assertEqual(value, iohandler.interpolate)
+ return
+
+
+# End of file
Added: short/3D/PyLith/trunk/unittests/pytests/meshio/TestMeshIOAscii.py
===================================================================
--- short/3D/PyLith/trunk/unittests/pytests/meshio/TestMeshIOAscii.py 2006-11-08 01:09:03 UTC (rev 5200)
+++ short/3D/PyLith/trunk/unittests/pytests/meshio/TestMeshIOAscii.py 2006-11-08 01:11:16 UTC (rev 5201)
@@ -0,0 +1,55 @@
+#!/usr/bin/env python
+#
+# ======================================================================
+#
+# Brad T. Aagaard
+# U.S. Geological Survey
+#
+# {LicenseText}
+#
+# ======================================================================
+#
+
+## @file unittests/pytests/meshio/TestMeshIOAscii.py
+
+## @brief Unit testing of Python MeshIOAscii object.
+
+import unittest
+from pylith.meshio.MeshIOAscii import MeshIOAscii
+
+# ----------------------------------------------------------------------
+class TestMeshIOAscii(unittest.TestCase):
+ """
+ Unit testing of Python MeshIOAscii object.
+ """
+
+ def test_constructor(self):
+ """
+ Test constructor.
+ """
+ iohandler = MeshIOAscii()
+ self.failIf(None == iohandler.cppHandle)
+ return
+
+
+ def test_filename(self):
+ """
+ Test filename().
+ """
+ filename = "hi.txt"
+ iohandler = MeshIOAscii()
+ iohandler.filename = filename
+ self.assertEqual(filename, iohandler.filename)
+ return
+
+
+ def test_writeread(self):
+ """
+ Test write() and read().
+ """
+
+ self.assertEqual(0,1)
+ return
+
+
+# End of file
Added: short/3D/PyLith/trunk/unittests/pytests/meshio/testmeshio.py
===================================================================
--- short/3D/PyLith/trunk/unittests/pytests/meshio/testmeshio.py 2006-11-08 01:09:03 UTC (rev 5200)
+++ short/3D/PyLith/trunk/unittests/pytests/meshio/testmeshio.py 2006-11-08 01:11:16 UTC (rev 5201)
@@ -0,0 +1,68 @@
+#!/usr/bin/env python
+#
+# ======================================================================
+#
+# Brad T. Aagaard
+# U.S. Geological Survey
+#
+# {LicenseText}
+#
+# ======================================================================
+#
+
+## @file unittests/meshio/testmeshio.py
+
+## @brief Python application for testing meshio 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.
+ """
+ unittest.TextTestRunner(verbosity=2).run(self._suite())
+ return
+
+
+ # PRIVATE METHODS ////////////////////////////////////////////////////
+
+ def _suite(self):
+ """
+ Setup the test suite.
+ """
+
+ suite = unittest.TestSuite()
+
+ from TestMeshIO import TestMeshIO
+ suite.addTest(unittest.makeSuite(TestMeshIO))
+
+ from TestMeshIOAscii import TestMeshIOAscii
+ suite.addTest(unittest.makeSuite(TestMeshIOAscii))
+
+ return suite
+
+
+# ----------------------------------------------------------------------
+if __name__ == '__main__':
+ app = TestApp()
+ app.run()
+
+
+# End of file
Property changes on: short/3D/PyLith/trunk/unittests/pytests/meshio/testmeshio.py
___________________________________________________________________
Name: svn:executable
+ *
More information about the cig-commits
mailing list