/[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 293 - (hide annotations)
Fri Dec 2 03:46:39 2005 UTC (13 years, 10 months ago) by gross
File MIME type: text/x-python
File size: 9352 byte(s)
updated
1 jgs 154 # $Id$
2    
3 gross 293 #
4     # COPYRIGHT ACcESS 2004 - All Rights Reserved
5     #
6     # This software is the property of ACcESS. No part of this code
7     # may be copied in any form or by any means without the expressed written
8     # consent of ACcESS. Copying, use or modification of this software
9     # by any unauthorised person is illegal unless that
10     # person has a software license agreement with ACcESS.
11     #
12 jgs 154
13     """
14 gross 293 Test suite for the symbols.py module
15    
16     @remark:
17    
18     @var __author__: name of author
19     @var __licence__: licence agreement
20     @var __url__: url entry point on documentation
21     @var __version__: version
22     @var __date__: date of the version
23 jgs 154 """
24    
25 gross 293 __author__="Lutz Gross, l.gross@uq.edu.au"
26     __licence__="contact: esys@access.uq.edu.au"
27     __url__="http://www.iservo.edu.au/esys/escript"
28     __version__="$Revision$"
29     __date__="$Date$"
30 jgs 154
31 gross 293 from esys.escript import *
32     from esys.escript.symbols import *
33     import unittest
34 jgs 154
35 gross 293 class Test_symbols(unittest.TestCase):
36    
37     def test_Symbol_Scalar_dNone(self):
38     s=ScalarSymbol(dim=None)
39     self.failUnlessEqual(s.getRank(),0,"wrong rank.")
40     self.failUnlessEqual(s.getShape(),(),"wrong shape.")
41     self.failUnlessEqual(s.getDim(),None,"wrong spatial dimension.")
42     self.failUnlessEqual(s.getArgument(),[],"wrong arguments.")
43     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
44     def test_Symbol_Scalar_dd(self):
45     s=ScalarSymbol(dim=self.functionspace)
46     d=self.functionspace.getDim()
47     self.failUnlessEqual(s.getRank(),0,"wrong rank.")
48     self.failUnlessEqual(s.getShape(),(),"wrong shape.")
49     self.failUnlessEqual(s.getDim(),d,"wrong spatial dimension.")
50     self.failUnlessEqual(s.getArgument(),[],"wrong arguments.")
51     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
52     def test_Symbol_Scalar_d1(self):
53     s=ScalarSymbol(dim=1)
54     self.failUnlessEqual(s.getRank(),0,"wrong rank.")
55     self.failUnlessEqual(s.getShape(),(),"wrong shape.")
56     self.failUnlessEqual(s.getDim(),1,"wrong spatial dimension.")
57     self.failUnlessEqual(s.getArgument(),[],"wrong arguments.")
58     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
59     def test_Symbol_Scalar_d2(self):
60     s=ScalarSymbol(dim=2)
61     self.failUnlessEqual(s.getRank(),0,"wrong rank.")
62     self.failUnlessEqual(s.getShape(),(),"wrong shape.")
63     self.failUnlessEqual(s.getDim(),2,"wrong spatial dimension.")
64     self.failUnlessEqual(s.getArgument(),[],"wrong arguments.")
65     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
66     def test_Symbol_Scalar_d3(self):
67     s=ScalarSymbol(dim=3)
68     self.failUnlessEqual(s.getRank(),0,"wrong rank.")
69     self.failUnlessEqual(s.getShape(),(),"wrong shape.")
70     self.failUnlessEqual(s.getDim(),3,"wrong spatial dimension.")
71     self.failUnlessEqual(s.getArgument(),[],"wrong arguments.")
72     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
73     def test_Symbol_Vector_dd(self):
74     s=VectorSymbol(dim=self.functionspace)
75     d=self.functionspace.getDim()
76     self.failUnlessEqual(s.getRank(),1,"wrong rank.")
77     self.failUnlessEqual(s.getShape(),(d,),"wrong shape.")
78     self.failUnlessEqual(s.getDim(),d,"wrong spatial dimension.")
79     self.failUnlessEqual(s.getArgument(),[],"wrong arguments.")
80     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
81     def test_Symbol_Vector_d1(self):
82     s=VectorSymbol(dim=1)
83     self.failUnlessEqual(s.getRank(),1,"wrong rank.")
84     self.failUnlessEqual(s.getShape(),(1,),"wrong shape.")
85     self.failUnlessEqual(s.getDim(),1,"wrong spatial dimension.")
86     self.failUnlessEqual(s.getArgument(),[],"wrong arguments.")
87     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
88     def test_Symbol_Vector_d2(self):
89     s=VectorSymbol(dim=2)
90     self.failUnlessEqual(s.getRank(),1,"wrong rank.")
91     self.failUnlessEqual(s.getShape(),(2,),"wrong shape.")
92     self.failUnlessEqual(s.getDim(),2,"wrong spatial dimension.")
93     self.failUnlessEqual(s.getArgument(),[],"wrong arguments.")
94     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
95     def test_Symbol_Vector_d3(self):
96     s=VectorSymbol(dim=3)
97     self.failUnlessEqual(s.getRank(),1,"wrong rank.")
98     self.failUnlessEqual(s.getShape(),(3,),"wrong shape.")
99     self.failUnlessEqual(s.getDim(),3,"wrong spatial dimension.")
100     self.failUnlessEqual(s.getArgument(),[],"wrong arguments.")
101     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
102     def test_Symbol_Tensor_dd(self):
103     s=TensorSymbol(dim=self.functionspace)
104     d=self.functionspace.getDim()
105     self.failUnlessEqual(s.getRank(),2,"wrong rank.")
106     self.failUnlessEqual(s.getShape(),(d,d),"wrong shape.")
107     self.failUnlessEqual(s.getDim(),d,"wrong spatial dimension.")
108     self.failUnlessEqual(s.getArgument(),[],"wrong arguments.")
109     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
110     def test_Symbol_Tensor_d1(self):
111     s=TensorSymbol(dim=1)
112     self.failUnlessEqual(s.getRank(),2,"wrong rank.")
113     self.failUnlessEqual(s.getShape(),(1, 1),"wrong shape.")
114     self.failUnlessEqual(s.getDim(),1,"wrong spatial dimension.")
115     self.failUnlessEqual(s.getArgument(),[],"wrong arguments.")
116     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
117     def test_Symbol_Tensor_d2(self):
118     s=TensorSymbol(dim=2)
119     self.failUnlessEqual(s.getRank(),2,"wrong rank.")
120     self.failUnlessEqual(s.getShape(),(2, 2),"wrong shape.")
121     self.failUnlessEqual(s.getDim(),2,"wrong spatial dimension.")
122     self.failUnlessEqual(s.getArgument(),[],"wrong arguments.")
123     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
124     def test_Symbol_Tensor_d3(self):
125     s=TensorSymbol(dim=3)
126     self.failUnlessEqual(s.getRank(),2,"wrong rank.")
127     self.failUnlessEqual(s.getShape(),(3, 3),"wrong shape.")
128     self.failUnlessEqual(s.getDim(),3,"wrong spatial dimension.")
129     self.failUnlessEqual(s.getArgument(),[],"wrong arguments.")
130     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
131     def test_Symbol_Tensor3_dd(self):
132     s=Tensor3Symbol(dim=self.functionspace)
133     d=self.functionspace.getDim()
134     self.failUnlessEqual(s.getRank(),3,"wrong rank.")
135     self.failUnlessEqual(s.getShape(),(d,d,d),"wrong shape.")
136     self.failUnlessEqual(s.getDim(),d,"wrong spatial dimension.")
137     self.failUnlessEqual(s.getArgument(),[],"wrong arguments.")
138     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
139     def test_Symbol_Tensor3_d1(self):
140     s=Tensor3Symbol(dim=1)
141     self.failUnlessEqual(s.getRank(),3,"wrong rank.")
142     self.failUnlessEqual(s.getShape(),(1, 1, 1),"wrong shape.")
143     self.failUnlessEqual(s.getDim(),1,"wrong spatial dimension.")
144     self.failUnlessEqual(s.getArgument(),[],"wrong arguments.")
145     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
146     def test_Symbol_Tensor3_d2(self):
147     s=Tensor3Symbol(dim=2)
148     self.failUnlessEqual(s.getRank(),3,"wrong rank.")
149     self.failUnlessEqual(s.getShape(),(2, 2, 2),"wrong shape.")
150     self.failUnlessEqual(s.getDim(),2,"wrong spatial dimension.")
151     self.failUnlessEqual(s.getArgument(),[],"wrong arguments.")
152     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
153     def test_Symbol_Tensor3_d3(self):
154     s=Tensor3Symbol(dim=3)
155     self.failUnlessEqual(s.getRank(),3,"wrong rank.")
156     self.failUnlessEqual(s.getShape(),(3, 3, 3),"wrong shape.")
157     self.failUnlessEqual(s.getDim(),3,"wrong spatial dimension.")
158     self.failUnlessEqual(s.getArgument(),[],"wrong arguments.")
159     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
160     def test_Symbol_Tensor4_dd(self):
161     s=Tensor4Symbol(dim=self.functionspace)
162     d=self.functionspace.getDim()
163     self.failUnlessEqual(s.getRank(),4,"wrong rank.")
164     self.failUnlessEqual(s.getShape(),(d,d,d,d),"wrong shape.")
165     self.failUnlessEqual(s.getDim(),d,"wrong spatial dimension.")
166     self.failUnlessEqual(s.getArgument(),[],"wrong arguments.")
167     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
168     def test_Symbol_Tensor4_d1(self):
169     s=Tensor4Symbol(dim=1)
170     self.failUnlessEqual(s.getRank(),4,"wrong rank.")
171     self.failUnlessEqual(s.getShape(),(1, 1, 1, 1),"wrong shape.")
172     self.failUnlessEqual(s.getDim(),1,"wrong spatial dimension.")
173     self.failUnlessEqual(s.getArgument(),[],"wrong arguments.")
174     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
175     def test_Symbol_Tensor4_d2(self):
176     s=Tensor4Symbol(dim=2)
177     self.failUnlessEqual(s.getRank(),4,"wrong rank.")
178     self.failUnlessEqual(s.getShape(),(2, 2, 2, 2),"wrong shape.")
179     self.failUnlessEqual(s.getDim(),2,"wrong spatial dimension.")
180     self.failUnlessEqual(s.getArgument(),[],"wrong arguments.")
181     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
182     def test_Symbol_Tensor4_d3(self):
183     s=Tensor4Symbol(dim=3)
184     self.failUnlessEqual(s.getRank(),4,"wrong rank.")
185     self.failUnlessEqual(s.getShape(),(3, 3, 3, 3),"wrong shape.")
186     self.failUnlessEqual(s.getDim(),3,"wrong spatial dimension.")
187     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