/[escript]/branches/symbolic_from_3470/dudley/test/python/run_escriptOnDudley.py
ViewVC logotype

Diff of /branches/symbolic_from_3470/dudley/test/python/run_escriptOnDudley.py

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1185 by gross, Thu May 31 04:33:31 2007 UTC revision 2549 by jfenwick, Mon Jul 20 06:43:47 2009 UTC
# Line 1  Line 1 
 # $Id:$  
1    
2  __copyright__="""  Copyright (c) 2006 by ACcESS MNRF  ########################################################
3                      http://www.access.edu.au  #
4                  Primary Business: Queensland, Australia"""  # Copyright (c) 2003-2009 by University of Queensland
5    # Earth Systems Science Computational Center (ESSCC)
6    # http://www.uq.edu.au/esscc
7    #
8    # Primary Business: Queensland, Australia
9    # Licensed under the Open Software License version 3.0
10    # http://www.opensource.org/licenses/osl-3.0.php
11    #
12    ########################################################
13    
14    __copyright__="""Copyright (c) 2003-2009 by University of Queensland
15    Earth Systems Science Computational Center (ESSCC)
16    http://www.uq.edu.au/esscc
17    Primary Business: Queensland, Australia"""
18  __license__="""Licensed under the Open Software License version 3.0  __license__="""Licensed under the Open Software License version 3.0
19               http://www.opensource.org/licenses/osl-3.0.php"""  http://www.opensource.org/licenses/osl-3.0.php"""
20    __url__="https://launchpad.net/escript-finley"
21    
22  import unittest  import unittest
23  import tempfile  import tempfile
24    
# Line 15  import os Line 29  import os
29  from test_objects import Test_Dump, Test_SetDataPointValue  from test_objects import Test_Dump, Test_SetDataPointValue
30  from test_objects import Test_Domain  from test_objects import Test_Domain
31    
32    from test_shared import Test_Shared
33    
34  try:  try:
35       FINLEY_WORKDIR=os.environ['FINLEY_WORKDIR']       FINLEY_WORKDIR=os.environ['FINLEY_WORKDIR']
36  except KeyError:  except KeyError:
37       FINLEY_WORKDIR='.'       FINLEY_WORKDIR='.'
38    
39  NE=4 # number elements, must be even  NE=4 # number elements, must be even
40    
41    class Test_SharedOnFinley(Test_Shared):
42      def setUp(self):
43        self.domain=Rectangle(NE,NE)
44        self.tol=0.001
45      def tearDown(self):
46        del self.domain
47        del self.tol
48    
49  class Test_DomainOnFinley(Test_Domain):  class Test_DomainOnFinley(Test_Domain):
50     def setUp(self):     def setUp(self):
51           self.boundary_tag_list = [1, 2, 10, 20]
52         self.domain =Rectangle(NE,NE+1,2)         self.domain =Rectangle(NE,NE+1,2)
53     def tearDown(self):     def tearDown(self):
54         del self.domain         del self.domain
55  class Test_DataOpsOnFinley(Test_Dump): # , Test_SetDataPointValue):         del self.boundary_tag_list
56    
57       def test_tagsContinuousFunction(self):
58           ref_tags=[0]
59           tags=ContinuousFunction(self.domain).getListOfTags()
60           self.failUnless(len(tags)==len(ref_tags), "tags list has wrong length.")
61           for i in ref_tags: self.failUnless(i in tags,"tag %s is missing."%i)
62    
63       def test_tagsFunction(self):
64           ref_tags=[0]
65           tags=Function(self.domain).getListOfTags()
66           self.failUnless(len(tags)==len(ref_tags), "tags list has wrong length.")
67           for i in ref_tags: self.failUnless(i in tags,"tag %s is missing."%i)
68       def test_tagsReducedFunction(self):
69           ref_tags=[0]
70           tags=ReducedFunction(self.domain).getListOfTags()
71           self.failUnless(len(tags)==len(ref_tags), "tags list has wrong length.")
72           for i in ref_tags: self.failUnless(i in tags,"tag %s is missing."%i)
73       def test_tagsFunctionOnBoundary(self):
74           ref_tags=[1, 2, 10, 20]
75           tags=FunctionOnBoundary(self.domain).getListOfTags()
76           # For an MPI-distributed domain some tags may be missing
77           if getMPISizeWorld() == 1: self.failUnless(len(tags)==len(ref_tags), "tags list has wrong length.")
78           for i in tags: self.failUnless(i in ref_tags,"tag %s is missing."%i)
79       def test_tagsReducedFunctionOnBoundary(self):
80           ref_tags=[1, 2, 10, 20]
81           tags=ReducedFunctionOnBoundary(self.domain).getListOfTags()
82           # For an MPI-distributed domain some tags may be missing
83           if getMPISizeWorld() == 1: self.failUnless(len(tags)==len(ref_tags), "tags list has wrong length.")
84           for i in tags: self.failUnless(i in ref_tags,"tag %s is missing."%i)
85       def test_tagsFunctionOnContactOne(self):
86           ref_tags=[]
87           tags=FunctionOnContactOne(self.domain).getListOfTags()
88           self.failUnless(len(tags)==len(ref_tags), "tags list has wrong length.")
89           for i in ref_tags: self.failUnless(i in tags,"tag %s is missing."%i)
90       def test_tagsFunctionOnContactZero(self):
91           ref_tags=[]
92           tags=FunctionOnContactZero(self.domain).getListOfTags()
93           self.failUnless(len(tags)==len(ref_tags), "tags list has wrong length.")
94           for i in ref_tags: self.failUnless(i in tags,"tag %s is missing."%i)
95       def test_tagsReducedFunctionOnContactOne(self):
96           ref_tags=[]
97           tags=ReducedFunctionOnContactOne(self.domain).getListOfTags()
98           self.failUnless(len(tags)==len(ref_tags), "tags list has wrong length.")
99           for i in ref_tags: self.failUnless(i in tags,"tag %s is missing."%i)
100       def test_tagsReducedFunctionOnContactZero(self):
101           ref_tags=[]
102           tags=ReducedFunctionOnContactZero(self.domain).getListOfTags()
103           self.failUnless(len(tags)==len(ref_tags), "tags list has wrong length.")
104           for i in ref_tags: self.failUnless(i in tags,"tag %s is missing."%i)
105    
106    class Test_DataOpsOnFinley(Test_Dump, Test_SetDataPointValue):
107     def setUp(self):     def setUp(self):
108         self.domain =Rectangle(NE,NE+1,2)         self.domain =Rectangle(NE,NE+1,2)
109         self.domain_with_different_number_of_samples =Rectangle(2*NE,NE+1,2)         self.domain_with_different_number_of_samples =Rectangle(2*NE,NE+1,2)
110         self.domain_with_different_number_of_data_points_per_sample =Rectangle(2*NE,NE+1,2,integrationOrder=2)         self.domain_with_different_number_of_data_points_per_sample =Rectangle(2*NE,NE+1,2,integrationOrder=2)
111         self.domain_with_different_sample_ordering =Rectangle(1,(NE+1)*NE,2)         self.domain_with_different_sample_ordering =Rectangle(NE,NE+1,2, optimize=True)
112         self.filename_base=FINLEY_WORKDIR         self.filename_base=FINLEY_WORKDIR
113    
114     def tearDown(self):     def tearDown(self):
# Line 42  class Test_DataOpsOnFinley(Test_Dump): # Line 119  class Test_DataOpsOnFinley(Test_Dump): #
119    
120  if __name__ == '__main__':  if __name__ == '__main__':
121     suite = unittest.TestSuite()     suite = unittest.TestSuite()
122       suite.addTest(unittest.makeSuite(Test_SharedOnFinley))
123     suite.addTest(unittest.makeSuite(Test_DataOpsOnFinley))     suite.addTest(unittest.makeSuite(Test_DataOpsOnFinley))
124     suite.addTest(unittest.makeSuite(Test_DomainOnFinley))     suite.addTest(unittest.makeSuite(Test_DomainOnFinley))
125     s=unittest.TextTestRunner(verbosity=2).run(suite)     s=unittest.TextTestRunner(verbosity=2).run(suite)
126     if s.wasSuccessful():     if not s.wasSuccessful(): sys.exit(1)
127       sys.exit(0)  
    else:  
      sys.exit(1)  
     

Legend:
Removed from v.1185  
changed lines
  Added in v.2549

  ViewVC Help
Powered by ViewVC 1.1.26