/[escript]/trunk/escript/py_src/test_symbols.py
ViewVC logotype

Annotation of /trunk/escript/py_src/test_symbols.py

Parent Directory Parent Directory | Revision Log Revision Log


Revision 609 - (hide annotations)
Tue Mar 21 09:46:39 2006 UTC (13 years, 7 months ago) by elspeth
File MIME type: text/x-python
File size: 9212 byte(s)
Updated copyright and licence notices.

1 jgs 154 # $Id$
2    
3     """
4 gross 293 Test suite for the symbols.py module
5    
6     @remark:
7    
8     @var __author__: name of author
9     @var __licence__: licence agreement
10     @var __url__: url entry point on documentation
11     @var __version__: version
12     @var __date__: date of the version
13 jgs 154 """
14    
15 gross 293 __author__="Lutz Gross, l.gross@uq.edu.au"
16 elspeth 609 __copyright__=""" Copyright (c) 2006 by ACcESS MNRF
17     http://www.access.edu.au
18     Primary Business: Queensland, Australia"""
19     __licence__="""Licensed under the Open Software License version 3.0
20     http://www.opensource.org/licences/osl-3.0.php"""
21 gross 293 __url__="http://www.iservo.edu.au/esys/escript"
22     __version__="$Revision$"
23     __date__="$Date$"
24 jgs 154
25 gross 293 from esys.escript import *
26     from esys.escript.symbols import *
27     import unittest
28 jgs 154
29 gross 293 class Test_symbols(unittest.TestCase):
30    
31     def test_Symbol_Scalar_dNone(self):
32     s=ScalarSymbol(dim=None)
33     self.failUnlessEqual(s.getRank(),0,"wrong rank.")
34     self.failUnlessEqual(s.getShape(),(),"wrong shape.")
35     self.failUnlessEqual(s.getDim(),None,"wrong spatial dimension.")
36     self.failUnlessEqual(s.getArgument(),[],"wrong arguments.")
37     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
38     def test_Symbol_Scalar_dd(self):
39     s=ScalarSymbol(dim=self.functionspace)
40     d=self.functionspace.getDim()
41     self.failUnlessEqual(s.getRank(),0,"wrong rank.")
42     self.failUnlessEqual(s.getShape(),(),"wrong shape.")
43     self.failUnlessEqual(s.getDim(),d,"wrong spatial dimension.")
44     self.failUnlessEqual(s.getArgument(),[],"wrong arguments.")
45     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
46     def test_Symbol_Scalar_d1(self):
47     s=ScalarSymbol(dim=1)
48     self.failUnlessEqual(s.getRank(),0,"wrong rank.")
49     self.failUnlessEqual(s.getShape(),(),"wrong shape.")
50     self.failUnlessEqual(s.getDim(),1,"wrong spatial dimension.")
51     self.failUnlessEqual(s.getArgument(),[],"wrong arguments.")
52     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
53     def test_Symbol_Scalar_d2(self):
54     s=ScalarSymbol(dim=2)
55     self.failUnlessEqual(s.getRank(),0,"wrong rank.")
56     self.failUnlessEqual(s.getShape(),(),"wrong shape.")
57     self.failUnlessEqual(s.getDim(),2,"wrong spatial dimension.")
58     self.failUnlessEqual(s.getArgument(),[],"wrong arguments.")
59     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
60     def test_Symbol_Scalar_d3(self):
61     s=ScalarSymbol(dim=3)
62     self.failUnlessEqual(s.getRank(),0,"wrong rank.")
63     self.failUnlessEqual(s.getShape(),(),"wrong shape.")
64     self.failUnlessEqual(s.getDim(),3,"wrong spatial dimension.")
65     self.failUnlessEqual(s.getArgument(),[],"wrong arguments.")
66     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
67     def test_Symbol_Vector_dd(self):
68     s=VectorSymbol(dim=self.functionspace)
69     d=self.functionspace.getDim()
70     self.failUnlessEqual(s.getRank(),1,"wrong rank.")
71     self.failUnlessEqual(s.getShape(),(d,),"wrong shape.")
72     self.failUnlessEqual(s.getDim(),d,"wrong spatial dimension.")
73     self.failUnlessEqual(s.getArgument(),[],"wrong arguments.")
74     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
75     def test_Symbol_Vector_d1(self):
76     s=VectorSymbol(dim=1)
77     self.failUnlessEqual(s.getRank(),1,"wrong rank.")
78     self.failUnlessEqual(s.getShape(),(1,),"wrong shape.")
79     self.failUnlessEqual(s.getDim(),1,"wrong spatial dimension.")
80     self.failUnlessEqual(s.getArgument(),[],"wrong arguments.")
81     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
82     def test_Symbol_Vector_d2(self):
83     s=VectorSymbol(dim=2)
84     self.failUnlessEqual(s.getRank(),1,"wrong rank.")
85     self.failUnlessEqual(s.getShape(),(2,),"wrong shape.")
86     self.failUnlessEqual(s.getDim(),2,"wrong spatial dimension.")
87     self.failUnlessEqual(s.getArgument(),[],"wrong arguments.")
88     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
89     def test_Symbol_Vector_d3(self):
90     s=VectorSymbol(dim=3)
91     self.failUnlessEqual(s.getRank(),1,"wrong rank.")
92     self.failUnlessEqual(s.getShape(),(3,),"wrong shape.")
93     self.failUnlessEqual(s.getDim(),3,"wrong spatial dimension.")
94     self.failUnlessEqual(s.getArgument(),[],"wrong arguments.")
95     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
96     def test_Symbol_Tensor_dd(self):
97     s=TensorSymbol(dim=self.functionspace)
98     d=self.functionspace.getDim()
99     self.failUnlessEqual(s.getRank(),2,"wrong rank.")
100     self.failUnlessEqual(s.getShape(),(d,d),"wrong shape.")
101     self.failUnlessEqual(s.getDim(),d,"wrong spatial dimension.")
102     self.failUnlessEqual(s.getArgument(),[],"wrong arguments.")
103     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
104     def test_Symbol_Tensor_d1(self):
105     s=TensorSymbol(dim=1)
106     self.failUnlessEqual(s.getRank(),2,"wrong rank.")
107     self.failUnlessEqual(s.getShape(),(1, 1),"wrong shape.")
108     self.failUnlessEqual(s.getDim(),1,"wrong spatial dimension.")
109     self.failUnlessEqual(s.getArgument(),[],"wrong arguments.")
110     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
111     def test_Symbol_Tensor_d2(self):
112     s=TensorSymbol(dim=2)
113     self.failUnlessEqual(s.getRank(),2,"wrong rank.")
114     self.failUnlessEqual(s.getShape(),(2, 2),"wrong shape.")
115     self.failUnlessEqual(s.getDim(),2,"wrong spatial dimension.")
116     self.failUnlessEqual(s.getArgument(),[],"wrong arguments.")
117     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
118     def test_Symbol_Tensor_d3(self):
119     s=TensorSymbol(dim=3)
120     self.failUnlessEqual(s.getRank(),2,"wrong rank.")
121     self.failUnlessEqual(s.getShape(),(3, 3),"wrong shape.")
122     self.failUnlessEqual(s.getDim(),3,"wrong spatial dimension.")
123     self.failUnlessEqual(s.getArgument(),[],"wrong arguments.")
124     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
125     def test_Symbol_Tensor3_dd(self):
126     s=Tensor3Symbol(dim=self.functionspace)
127     d=self.functionspace.getDim()
128     self.failUnlessEqual(s.getRank(),3,"wrong rank.")
129     self.failUnlessEqual(s.getShape(),(d,d,d),"wrong shape.")
130     self.failUnlessEqual(s.getDim(),d,"wrong spatial dimension.")
131     self.failUnlessEqual(s.getArgument(),[],"wrong arguments.")
132     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
133     def test_Symbol_Tensor3_d1(self):
134     s=Tensor3Symbol(dim=1)
135     self.failUnlessEqual(s.getRank(),3,"wrong rank.")
136     self.failUnlessEqual(s.getShape(),(1, 1, 1),"wrong shape.")
137     self.failUnlessEqual(s.getDim(),1,"wrong spatial dimension.")
138     self.failUnlessEqual(s.getArgument(),[],"wrong arguments.")
139     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
140     def test_Symbol_Tensor3_d2(self):
141     s=Tensor3Symbol(dim=2)
142     self.failUnlessEqual(s.getRank(),3,"wrong rank.")
143     self.failUnlessEqual(s.getShape(),(2, 2, 2),"wrong shape.")
144     self.failUnlessEqual(s.getDim(),2,"wrong spatial dimension.")
145     self.failUnlessEqual(s.getArgument(),[],"wrong arguments.")
146     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
147     def test_Symbol_Tensor3_d3(self):
148     s=Tensor3Symbol(dim=3)
149     self.failUnlessEqual(s.getRank(),3,"wrong rank.")
150     self.failUnlessEqual(s.getShape(),(3, 3, 3),"wrong shape.")
151     self.failUnlessEqual(s.getDim(),3,"wrong spatial dimension.")
152     self.failUnlessEqual(s.getArgument(),[],"wrong arguments.")
153     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
154     def test_Symbol_Tensor4_dd(self):
155     s=Tensor4Symbol(dim=self.functionspace)
156     d=self.functionspace.getDim()
157     self.failUnlessEqual(s.getRank(),4,"wrong rank.")
158     self.failUnlessEqual(s.getShape(),(d,d,d,d),"wrong shape.")
159     self.failUnlessEqual(s.getDim(),d,"wrong spatial dimension.")
160     self.failUnlessEqual(s.getArgument(),[],"wrong arguments.")
161     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
162     def test_Symbol_Tensor4_d1(self):
163     s=Tensor4Symbol(dim=1)
164     self.failUnlessEqual(s.getRank(),4,"wrong rank.")
165     self.failUnlessEqual(s.getShape(),(1, 1, 1, 1),"wrong shape.")
166     self.failUnlessEqual(s.getDim(),1,"wrong spatial dimension.")
167     self.failUnlessEqual(s.getArgument(),[],"wrong arguments.")
168     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
169     def test_Symbol_Tensor4_d2(self):
170     s=Tensor4Symbol(dim=2)
171     self.failUnlessEqual(s.getRank(),4,"wrong rank.")
172     self.failUnlessEqual(s.getShape(),(2, 2, 2, 2),"wrong shape.")
173     self.failUnlessEqual(s.getDim(),2,"wrong spatial dimension.")
174     self.failUnlessEqual(s.getArgument(),[],"wrong arguments.")
175     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
176     def test_Symbol_Tensor4_d3(self):
177     s=Tensor4Symbol(dim=3)
178     self.failUnlessEqual(s.getRank(),4,"wrong rank.")
179     self.failUnlessEqual(s.getShape(),(3, 3, 3, 3),"wrong shape.")
180     self.failUnlessEqual(s.getDim(),3,"wrong spatial dimension.")
181     self.failUnlessEqual(s.getArgument(),[],"wrong arguments.")

Properties

Name Value
svn:eol-style native
svn:keywords Author Date Id Revision

  ViewVC Help
Powered by ViewVC 1.1.26