/[escript]/trunk/finley/test/python/run_escriptOnFinley.py
ViewVC logotype

Contents of /trunk/finley/test/python/run_escriptOnFinley.py

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1809 - (show annotations)
Thu Sep 25 06:43:44 2008 UTC (11 years, 4 months ago) by ksteube
File MIME type: text/x-python
File size: 4743 byte(s)
Copyright updated in all python files

1
2 ########################################################
3 #
4 # Copyright (c) 2003-2008 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-2008 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
19 http://www.opensource.org/licenses/osl-3.0.php"""
20 __url__="http://www.uq.edu.au/esscc/escript-finley"
21
22 import unittest
23 import tempfile
24
25 from esys.escript import *
26 from esys.finley import Rectangle
27 import sys
28 import os
29 from test_objects import Test_Dump, Test_SetDataPointValue
30 from test_objects import Test_Domain
31
32 try:
33 FINLEY_WORKDIR=os.environ['FINLEY_WORKDIR']
34 except KeyError:
35 FINLEY_WORKDIR='.'
36
37 NE=4 # number elements, must be even
38 class Test_DomainOnFinley(Test_Domain):
39 def setUp(self):
40 self.domain =Rectangle(NE,NE+1,2)
41 def tearDown(self):
42 del self.domain
43
44 def test_tagsContinuousFunction(self):
45 ref_tags=[0]
46 tags=ContinuousFunction(self.domain).getListOfTags()
47 self.failUnless(len(tags)==len(ref_tags), "tags list has wrong length.")
48 for i in ref_tags: self.failUnless(i in tags,"tag %s is missing."%i)
49
50 def test_tagsFunction(self):
51 ref_tags=[0]
52 tags=Function(self.domain).getListOfTags()
53 self.failUnless(len(tags)==len(ref_tags), "tags list has wrong length.")
54 for i in ref_tags: self.failUnless(i in tags,"tag %s is missing."%i)
55 def test_tagsReducedFunction(self):
56 ref_tags=[0]
57 tags=ReducedFunction(self.domain).getListOfTags()
58 self.failUnless(len(tags)==len(ref_tags), "tags list has wrong length.")
59 for i in ref_tags: self.failUnless(i in tags,"tag %s is missing."%i)
60 def test_tagsFunctionOnBoundary(self):
61 ref_tags=[1, 2, 10, 20]
62 tags=FunctionOnBoundary(self.domain).getListOfTags()
63 self.failUnless(len(tags)==len(ref_tags), "tags list has wrong length.")
64 for i in ref_tags: self.failUnless(i in tags,"tag %s is missing."%i)
65 def test_tagsReducedFunctionOnBoundary(self):
66 ref_tags=[1, 2, 10, 20]
67 tags=ReducedFunctionOnBoundary(self.domain).getListOfTags()
68 self.failUnless(len(tags)==len(ref_tags), "tags list has wrong length.")
69 for i in ref_tags: self.failUnless(i in tags,"tag %s is missing."%i)
70 def test_tagsFunctionOnContactOne(self):
71 ref_tags=[]
72 tags=FunctionOnContactOne(self.domain).getListOfTags()
73 self.failUnless(len(tags)==len(ref_tags), "tags list has wrong length.")
74 for i in ref_tags: self.failUnless(i in tags,"tag %s is missing."%i)
75 def test_tagsFunctionOnContactZero(self):
76 ref_tags=[]
77 tags=FunctionOnContactZero(self.domain).getListOfTags()
78 self.failUnless(len(tags)==len(ref_tags), "tags list has wrong length.")
79 for i in ref_tags: self.failUnless(i in tags,"tag %s is missing."%i)
80 def test_tagsReducedFunctionOnContactOne(self):
81 ref_tags=[]
82 tags=ReducedFunctionOnContactOne(self.domain).getListOfTags()
83 self.failUnless(len(tags)==len(ref_tags), "tags list has wrong length.")
84 for i in ref_tags: self.failUnless(i in tags,"tag %s is missing."%i)
85 def test_tagsReducedFunctionOnContactZero(self):
86 ref_tags=[]
87 tags=ReducedFunctionOnContactZero(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
91 class Test_DataOpsOnFinley(Test_Dump, Test_SetDataPointValue):
92 def setUp(self):
93 self.domain =Rectangle(NE,NE+1,2)
94 self.domain_with_different_number_of_samples =Rectangle(2*NE,NE+1,2)
95 self.domain_with_different_number_of_data_points_per_sample =Rectangle(2*NE,NE+1,2,integrationOrder=2)
96 self.domain_with_different_sample_ordering =Rectangle(1,(NE+1)*NE,2)
97 self.filename_base=FINLEY_WORKDIR
98
99 def tearDown(self):
100 del self.domain
101 del self.domain_with_different_number_of_samples
102 del self.domain_with_different_number_of_data_points_per_sample
103 del self.domain_with_different_sample_ordering
104
105 if __name__ == '__main__':
106 suite = unittest.TestSuite()
107 suite.addTest(unittest.makeSuite(Test_DataOpsOnFinley))
108 suite.addTest(unittest.makeSuite(Test_DomainOnFinley))
109 s=unittest.TextTestRunner(verbosity=2).run(suite)
110 if not s.wasSuccessful(): sys.exit(1)
111

  ViewVC Help
Powered by ViewVC 1.1.26