/[escript]/branches/intelc_win32/bruce/test/python/run_bruce.py
ViewVC logotype

Contents of /branches/intelc_win32/bruce/test/python/run_bruce.py

Parent Directory Parent Directory | Revision Log Revision Log


Revision 752 - (show annotations)
Mon Jun 26 02:25:41 2006 UTC (13 years, 3 months ago) by woo409
File MIME type: text/x-python
File size: 3350 byte(s)
+ Added a qsort.c file which contains a drop in replacement for qsort (call it as qsortG). This one appears to be a stable implementation and the test .msh files on windows have been set up to be the same as unix again except for the exponent digits (3 instead of 2).
With ALL the qsorts replaced with qsortG only two tests fail now on win32:
test_normal_onFunctionOnContactOne
test_normal_onFunctionOnContactZero

Both give wrong result errors.

I will check this same code on the altix (including the use of qsortG and see if Altix has the same problem.
1 # $Id: BruceTest.py 627 2006-03-23 02:22:46Z elspeth $
2 """
3
4 Some simple tests of Bruce.
5
6 """
7
8 __copyright__=""" Copyright (c) 2006 by ACcESS MNRF
9 http://www.access.edu.au
10 Primary Business: Queensland, Australia"""
11 __license__="""Licensed under the Open Software License version 3.0
12 http://www.opensource.org/licenses/osl-3.0.php"""
13
14 import os
15 import sys
16 import unittest
17
18 from esys.escript import *
19 from esys.bruce import *
20
21 class bruceTestCase(unittest.TestCase):
22
23 def setUp(self):
24 self.b = Rectangle(11,11,10,10)
25
26 def tearDown(self):
27 del self.b
28
29 def testGetDescription(self):
30 assert (self.b.getDescription()=="Bruce")
31
32 def testValidFunctionSpace(self):
33 assert (self.b.isValidFunctionSpaceType(0))
34 assert (self.b.isValidFunctionSpaceType(1))
35 assert (not(self.b.isValidFunctionSpaceType(2)))
36
37 def testFunctionCode(self):
38 assert (self.b.getContinuousFunctionCode()==0)
39 assert (self.b.getFunctionCode()==1)
40
41 def testFunctionSpaceTypeAsString(self):
42 assert (self.b.functionSpaceTypeAsString(0) == "Bruce_ContinuousFunction")
43 assert (self.b.functionSpaceTypeAsString(1) == "Bruce_Function")
44
45 def testGetDim(self):
46 assert (self.b.getDim()==2)
47
48 def testGetNumSamples(self):
49 numSamples = self.b.getNumSamples(0)
50 assert (numSamples == 121)
51 numSamples = self.b.getNumSamples(1)
52 assert (numSamples == 100)
53
54 def testGetNumDataPointsPerSample(self):
55 numDataPointsPerSample = self.b.getNumDataPointsPerSample(0)
56 assert (numDataPointsPerSample == 1)
57 numDataPointsPerSample = self.b.getNumDataPointsPerSample(1)
58 assert (numDataPointsPerSample == 1)
59
60 def testGetReferenceNoFromSampleNo(self):
61 numSamples = self.b.getNumSamples(0)
62 for sampleNo in range(numSamples):
63 assert (sampleNo == self.b.getReferenceNoFromSampleNo(0,sampleNo))
64 numSamples = self.b.getNumSamples(1)
65 for sampleNo in range(numSamples):
66 assert (sampleNo == self.b.getReferenceNoFromSampleNo(1,sampleNo))
67
68 def testTagFromSampleNo(self):
69 numSamples = self.b.getNumSamples(0)
70 for sampleNo in range(numSamples):
71 assert (0 == self.b.getTagFromSampleNo(0,sampleNo))
72 numSamples = self.b.getNumSamples(1)
73 for sampleNo in range(numSamples):
74 assert (0 == self.b.getTagFromSampleNo(1,sampleNo))
75
76 def testBrick(self):
77 brick = Brick(11,11,11,10,10,10)
78 assert (brick.getDim()==3)
79
80 def testRectangle(self):
81 rectangle = Rectangle(11,11,10,10)
82 assert (rectangle.getDim()==2)
83
84 def testSaveVTK(self):
85 filename = os.environ['BRUCE_WORKDIR']+"/testVTK.xml"
86 fs1 = ContinuousFunction(self.b)
87 fs2 = Function(self.b)
88 testData1 = Scalar(1.0, fs1)
89 testData2 = Scalar(2.0, fs2)
90 testData3 = Vector(3.0, fs1)
91 testData4 = Vector(4.0, fs2)
92 testData5 = Tensor(5.0, fs1)
93 testData6 = Tensor(6.0, fs2)
94 dict = {'testData1':testData1,
95 'testData2':testData2,
96 # 'testData3':testData3,
97 'testData4':testData4,
98 'testData5':testData5,
99 'testData6':testData6}
100 self.b.saveVTK(filename, dict)
101
102 if __name__ == '__main__':
103 suite=unittest.TestSuite()
104 suite.addTest(unittest.makeSuite(bruceTestCase))
105 s=unittest.TextTestRunner(verbosity=2).run(suite)
106 if s.wasSuccessful():
107 sys.exit(0)
108 else:
109 sys.exit(1)

  ViewVC Help
Powered by ViewVC 1.1.26