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

Annotation of /trunk/escript/test/python/test_modulefns.py

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2881 - (hide annotations)
Thu Jan 28 02:03:15 2010 UTC (9 years, 2 months ago) by jfenwick
File MIME type: text/x-python
File size: 2175 byte(s)
Don't panic.
Updating copyright stamps

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

  ViewVC Help
Powered by ViewVC 1.1.26