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

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

Parent Directory Parent Directory | Revision Log Revision Log


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