[cig-commits] r13070 - cs/cigma/trunk/tests/pytests

luis at geodynamics.org luis at geodynamics.org
Wed Oct 15 02:08:19 PDT 2008


Author: luis
Date: 2008-10-15 02:08:19 -0700 (Wed, 15 Oct 2008)
New Revision: 13070

Added:
   cs/cigma/trunk/tests/pytests/test_quadrature.py
Log:
Python unit test for _cigma.Quadrature class

Added: cs/cigma/trunk/tests/pytests/test_quadrature.py
===================================================================
--- cs/cigma/trunk/tests/pytests/test_quadrature.py	                        (rev 0)
+++ cs/cigma/trunk/tests/pytests/test_quadrature.py	2008-10-15 09:08:19 UTC (rev 13070)
@@ -0,0 +1,28 @@
+#!/usr/bin/env python
+
+import numpy
+from _cigma import Quadrature
+
+import unittest
+class QuadratureTest(unittest.TestCase):
+    def __init__(self, *args):
+        unittest.TestCase.__init__(self, *args)
+    def test_quadrature_setters(self):
+        Q = Quadrature(10,3)
+        x = numpy.random.rand(10,3)
+        w = numpy.random.rand(10)
+        Q.points = x
+        Q.weights = w
+        #Q.set_points(x)
+        #Q.set_weights(w)
+        for q in xrange(10):
+            self.assertEqual(Q.getWeight(q), w[q])
+            for j in xrange(3):
+                self.assertEqual(Q.getPoint(q,j), x[q,j])
+        return
+
+def create_suite():
+    suite = unittest.TestSuite()
+    suite.addTest(unittest.makeSuite(QuadratureTest))
+    return suite
+



More information about the cig-commits mailing list