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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 613 - (show annotations)
Wed Mar 22 01:12:32 2006 UTC (14 years, 8 months ago) by elspeth
File MIME type: text/x-python
File size: 2137 byte(s)
More copyright information inserted.

1 """
2
3 Random interactive escript/Data tests.
4
5 Version $Id$
6
7 """
8
9 __copyright__=""" Copyright (c) 2006 by ACcESS MNRF
10 http://www.access.edu.au
11 Primary Business: Queensland, Australia"""
12 __licence__="""Licensed under the Open Software License version 3.0
13 http://www.opensource.org/licences/osl-3.0.php"""
14 import os
15 import sys
16 import unittest
17 import math
18
19 from esys.escript import *
20 from esys import bruce
21
22 arglist = [ \
23 3.0, \
24 [3,4], \
25 [[1,2],[3,4]], \
26 [[15,8],[12,8]], \
27 [[[15,8],[12,8]],[[-9,9],[13,8]]] \
28 ]
29
30 #
31 # ==============================================================
32
33 class escriptTestCase(unittest.TestCase):
34
35 def setUp(self):
36 self.msh=bruce.Rectangle()
37
38 def prepareArg(self,val,ex,wh):
39 if ex=="Expanded":
40 exx=True
41 else:
42 exx=False
43 out=Data(val,what=wh,expand=exx)
44 if ex=="Tagged":
45 out.tag()
46 return out
47
48 def testAlina1(self):
49 P1 = 10.0
50 assert log10(P1) == math.log10(10.0)
51 assert log(P1) == math.log(10.0,math.e)
52
53 def testAlina2(self):
54 P = 10.0*Scalar(1.0, ContinuousFunction(self.msh))
55 assert log10(P).convertToNumArray()[0] == math.log10(10.0)
56 assert log(P).convertToNumArray()[0] == math.log(10.0,math.e)
57
58 def testLog(self):
59 for wh in [ContinuousFunction(self.msh),Function(self.msh)]:
60 for ex in ["Constant","Tagged","Expanded"]:
61 for a in arglist:
62 #print "\n", ex, a, "==>"
63 arg=self.prepareArg(a,ex,wh)
64 #print "\nlog"
65 result = arg._log10()
66
67 def testLn(self):
68 for wh in [ContinuousFunction(self.msh),Function(self.msh)]:
69 for ex in ["Constant","Tagged","Expanded"]:
70 for a in arglist:
71 #print "\n", ex, a, "==>"
72 arg=self.prepareArg(a,ex,wh)
73 #print "\nln"
74 result = arg._log()
75
76 def testEmptyOp(self):
77 emptyData=Data()
78 emptyData._sin()
79 emptyData2=Data()
80 emptyData3=emptyData+emptyData2
81
82 if __name__ == '__main__':
83 suite=unittest.TestSuite()
84 suite.addTest(unittest.makeSuite(escriptTestCase))
85 unittest.TextTestRunner(verbosity=2).run(suite)
86
87 sys.exit(0)
88 # end

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26