/[escript]/trunk/escriptcore/test/python/test_modulefns.py
ViewVC logotype

Contents of /trunk/escriptcore/test/python/test_modulefns.py

Parent Directory Parent Directory | Revision Log Revision Log


Revision 4984 - (show annotations)
Mon Jun 2 02:50:34 2014 UTC (5 years, 2 months ago) by sshaw
File MIME type: text/x-python
File size: 2376 byte(s)
revamping testrunners, now uses automated discovery and allows running specific tests without modifying files (see escriptcore/py_src/testing.py for more info/examples)

1
2 ##############################################################################
3 #
4 # Copyright (c) 2009-2014 by University of Queensland
5 # http://www.uq.edu.au
6 #
7 # Primary Business: Queensland, Australia
8 # Licensed under the Open Software License version 3.0
9 # http://www.opensource.org/licenses/osl-3.0.php
10 #
11 # Development until 2012 by Earth Systems Science Computational Center (ESSCC)
12 # Development 2012-2013 by School of Earth Sciences
13 # Development from 2014 by Centre for Geoscience Computing (GeoComp)
14 #
15 ##############################################################################
16
17 __copyright__="""Copyright (c) 2009-2014 by University of Queensland
18 http://www.uq.edu.au
19 Primary Business: Queensland, Australia"""
20 __license__="""Licensed under the Open Software License version 3.0
21 http://www.opensource.org/licenses/osl-3.0.php"""
22 __url__="https://launchpad.net/escript-finley"
23
24 import esys.escriptcore.utestselect as unittest
25 from esys.escriptcore.testing import *
26 import esys.escript
27 import sys
28
29 #Just because we are unit testing these functions does not mean we encourage their use.
30 #In many cases these tests are merely testing if the call works, not if it does what
31 #you might expect
32
33 class ModuleFnsTestCase(unittest.TestCase):
34
35 def setUp(self):
36 pass
37
38 def testGlobalMax(self):
39 r=esys.escript.getMPIRankWorld()
40 self.assertEqual(esys.escript.getMPISizeWorld()-1,esys.escript.getMPIWorldMax(r))
41
42
43 def testGlobalSum(self):
44 r=esys.escript.getMPIRankWorld()
45 s=esys.escript.getMPISizeWorld()
46 total=s/2.0*(1+s)-s
47 self.assertEqual(total,esys.escript.getMPIWorldSum(r))
48
49 def testgetMachinePrecision(self):
50 if esys.escript.getMachinePrecision()>1: #Arbitrary value
51 self.fail("Machine precision is not sensible")
52
53 def testMPIBarrier(self):
54 esys.escript.MPIBarrierWorld()
55
56 def testgetMaxFloat(self):
57 self.assertTrue(esys.escript.getMaxFloat()>1) #Arbitrary value
58
59 def testprintParallelThreadCounts(self):
60 esys.escript.printParallelThreadCounts()
61
62 def testgetNumberOfThreads(self):
63 self.assertTrue(esys.escript.getNumberOfThreads()>=1)
64
65
66 def testgetSvnVersion(self):
67 esys.escript.getVersion()
68
69 if __name__ == '__main__':
70 run_tests(__name__, exit_on_failure=True)

  ViewVC Help
Powered by ViewVC 1.1.26