/[escript]/trunk/escript/test/python/test_symbols.py
ViewVC logotype

Diff of /trunk/escript/test/python/test_symbols.py

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

revision 155 by jgs, Wed Nov 9 02:02:19 2005 UTC revision 614 by elspeth, Wed Mar 22 01:37:07 2006 UTC
# Line 1  Line 1 
1  # $Id$  # $Id$
2    
 ## @file test_symbols.py  
   
3  """  """
4    Dummy test_symbols class to keep util.py happy  Test suite for the symbols.py module
5    
6    @remark:
7    
8    @var __author__: name of author
9    @var __license__: licence agreement
10    @var __url__: url entry point on documentation
11    @var __version__: version
12    @var __date__: date of the version
13  """  """
14    
15  class Test_symbols:  __author__="Lutz Gross, l.gross@uq.edu.au"
16      """  __copyright__="""  Copyright (c) 2006 by ACcESS MNRF
17        Dummy test_symbols class to keep util.py happy                      http://www.access.edu.au
18      """                  Primary Business: Queensland, Australia"""
19    __license__="""Licensed under the Open Software License version 3.0
20                 http://www.opensource.org/licenses/osl-3.0.php"""
21    __url__="http://www.iservo.edu.au/esys/escript"
22    __version__="$Revision$"
23    __date__="$Date$"
24    
25    from esys.escript import *
26    from esys.escript.symbols import *
27    import unittest
28    
29      def __init__(self):  class Test_symbols(unittest.TestCase):
       pass  
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.")

Legend:
Removed from v.155  
changed lines
  Added in v.614

  ViewVC Help
Powered by ViewVC 1.1.26