[Scipy-svn] r3834 - trunk/scipy/sandbox/multigrid/gallery/tests

scipy-svn@scip... scipy-svn@scip...
Mon Jan 14 15:31:17 CST 2008


Author: wnbell
Date: 2008-01-14 15:31:13 -0600 (Mon, 14 Jan 2008)
New Revision: 3834

Modified:
   trunk/scipy/sandbox/multigrid/gallery/tests/test_laplacian.py
Log:
expanded poisson() unittest


Modified: trunk/scipy/sandbox/multigrid/gallery/tests/test_laplacian.py
===================================================================
--- trunk/scipy/sandbox/multigrid/gallery/tests/test_laplacian.py	2008-01-14 20:27:02 UTC (rev 3833)
+++ trunk/scipy/sandbox/multigrid/gallery/tests/test_laplacian.py	2008-01-14 21:31:13 UTC (rev 3834)
@@ -8,6 +8,7 @@
     def test_poisson(self):
         cases = []
 
+        # 1D
         cases.append( ((1,),matrix([[2]])) )
         cases.append( ((2,),matrix([[ 2,-1],
                                     [-1, 2]])) )
@@ -16,10 +17,35 @@
                                     [ 0,-1, 2,-1],
                                     [ 0, 0,-1, 2]])) )
         
+        # 2D        
+        cases.append( ((1,1), matrix([[4]])) )
+        cases.append( ((2,1), matrix([[ 4,-1],
+                                      [-1, 4]])) )
+        cases.append( ((1,2), matrix([[ 4,-1],
+                                      [-1, 4]])) )
+        cases.append( ((1,3), matrix([[ 4,-1, 0],
+                                      [-1, 4,-1],
+                                      [ 0,-1, 4]])) )
+        cases.append( ((2,2), matrix([[ 4,-1,-1, 0],
+                                      [-1, 4, 0,-1],
+                                      [-1, 0, 4,-1],
+                                      [ 0,-1,-1, 4]])) )
+        # 3D
+        cases.append( ((2,2,1), matrix([[ 6,-1,-1, 0],
+                                        [-1, 6, 0,-1],
+                                        [-1, 0, 6,-1],
+                                        [ 0,-1,-1, 6]])) )
+        cases.append( ((2,2,2), matrix([[ 6,-1,-1, 0,-1, 0, 0, 0],
+                                        [-1, 6, 0,-1, 0,-1, 0, 0],
+                                        [-1, 0, 6,-1, 0, 0,-1, 0],
+                                        [ 0,-1,-1, 6, 0, 0, 0,-1],
+                                        [-1, 0, 0, 0, 6,-1,-1, 0],
+                                        [ 0,-1, 0, 0,-1, 6, 0,-1],
+                                        [ 0, 0,-1, 0,-1, 0, 6,-1],
+                                        [ 0, 0, 0,-1, 0,-1,-1, 6]])) )
+
         for grid,expected in cases:
             assert_equal( poisson(grid).todense(), expected )
 
-
-
 if __name__ == '__main__':
     unittest.main()



More information about the Scipy-svn mailing list