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

Contents of /trunk/escript/test/python/escriptTest.py

Parent Directory Parent Directory | Revision Log Revision Log


Revision 614 - (show annotations)
Wed Mar 22 01:37:07 2006 UTC (13 years, 4 months ago) by elspeth
File MIME type: text/x-python
File size: 2304 byte(s)
Corrected spelling of 'license' in url so that the link actually points to the license.

1 # $Id$
2
3 __copyright__=""" Copyright (c) 2006 by ACcESS MNRF
4 http://www.access.edu.au
5 Primary Business: Queensland, Australia"""
6 __license__="""Licensed under the Open Software License version 3.0
7 http://www.opensource.org/licenses/osl-3.0.php"""
8 import sys
9 import unittest
10 import os
11
12 from esys.escript import *
13 from esys import bruce
14 from esys.escript.test_symbols import Test_symbols
15 from esys.escript.test_util import Test_util
16
17 import numarray
18
19 class Test_symbols_OnBruce(Test_symbols):
20 def setUp(self):
21 self.domain = bruce.Brick(5,15,8)
22 self.functionspace=escript.ContinuousFunction(self.domain)
23
24 class Test_util_OnBruce(Test_util):
25 def setUp(self):
26 self.domain = bruce.Brick(5,15,8)
27 self.functionspace=escript.ContinuousFunction(self.domain)
28
29
30 class escriptTestCase(unittest.TestCase):
31
32 def testPow(self):
33 """Test the pow function."""
34 myFuncSpac=escript.FunctionSpace()
35 myVector=numarray.array([[1,2],[3,4]])
36 myData=escript.Data(myVector,myFuncSpac,True)
37 print myData**3
38
39 def testFunctionSpace(self):
40 """Test the creation of FunctionSpace objects."""
41 mesh=bruce.Brick(1,1,1)
42 cFunc=escript.ContinuousFunction(mesh)
43
44 def testDataOperations(self):
45 """Test the operations that may be performed on Data."""
46 myFuncSpac=escript.FunctionSpace()
47 myVector=numarray.array([[1,2],[3,4]])
48 myData=escript.Data(myVector,myFuncSpac,True)
49 myData2=3+myData
50 print myData2
51 myList=[[1,2],[3,4]]
52 myData3=myList+myData
53 print myData3
54 myData3=myData+myData2+myData3
55 print myData3
56 myData4=myList-myData
57 print myData4
58 myData5=0-myData
59 print myData5
60 myData6=1/myData
61 print myData6
62 myData7=5*myData
63 print myData7
64 myData8=(3*myData)/3+2*myData-2*myData
65 print myData8
66 myData9=myData.sin()
67 print myData9
68 myData9=myData.cos()
69 print myData9
70 print myData9.wherePositive()
71 print myData9.whereNegative()
72
73 suite = unittest.TestSuite()
74 suite.addTest(unittest.makeSuite(escriptTestCase))
75 suite.addTest(unittest.makeSuite(Test_symbols_OnBruce))
76 suite.addTest(unittest.makeSuite(Test_util_OnBruce))
77 if unittest.TextTestRunner(verbosity=2).run(suite).wasSuccessful():
78 sys.exit(0)
79 else:
80 sys.exit(1)

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26