5 |
import os |
import os |
6 |
|
|
7 |
from esys.escript import * |
from esys.escript import * |
8 |
from esys import finley |
from esys import bruce |
9 |
|
from esys.escript.test_symbols import Test_symbols |
10 |
|
from esys.escript.test_util import Test_util |
11 |
|
|
12 |
import numarray |
import numarray |
13 |
|
|
14 |
|
class Test_symbols_OnBruce(Test_symbols): |
15 |
|
def setUp(self): |
16 |
|
self.domain = bruce.Brick(5,15,8) |
17 |
|
self.functionspace=escript.ContinuousFunction(self.domain) |
18 |
|
|
19 |
|
class Test_util_OnBruce(Test_util): |
20 |
|
def setUp(self): |
21 |
|
self.domain = bruce.Brick(5,15,8) |
22 |
|
self.functionspace=escript.ContinuousFunction(self.domain) |
23 |
|
|
24 |
|
|
25 |
class escriptTestCase(unittest.TestCase): |
class escriptTestCase(unittest.TestCase): |
26 |
|
|
27 |
def testPow(self): |
def testPow(self): |
33 |
|
|
34 |
def testFunctionSpace(self): |
def testFunctionSpace(self): |
35 |
"""Test the creation of FunctionSpace objects.""" |
"""Test the creation of FunctionSpace objects.""" |
36 |
mesh=finley.Brick(1,1,1,1,1.,1.,1.,1,1,1,1,1) |
mesh=bruce.Brick(1,1,1) |
37 |
cFunc=escript.ContinuousFunction(mesh) |
cFunc=escript.ContinuousFunction(mesh) |
38 |
|
|
39 |
def testDataOperations(self): |
def testDataOperations(self): |
64 |
print myData9 |
print myData9 |
65 |
print myData9.wherePositive() |
print myData9.wherePositive() |
66 |
print myData9.whereNegative() |
print myData9.whereNegative() |
|
# |
|
|
# Lsup test for DataExpanded |
|
|
assert (myData.Lsup()==4) |
|
|
assert (myData.inf()==1) |
|
|
assert (myData.Lsup()==myData.sup()) |
|
|
assert ((myData*-1).sup()!=(myData*-1).Lsup()) |
|
|
# |
|
|
# Lsup test for DataConstant |
|
|
myData10=escript.Data(myVector,myFuncSpac,False) |
|
|
myData11=-1.0*myData10 |
|
|
assert(myData10.Lsup()==myData11.Lsup()) |
|
67 |
|
|
68 |
suite=unittest.TestSuite() |
suite = unittest.TestSuite() |
69 |
suite.addTest(unittest.makeSuite(escriptTestCase)) |
suite.addTest(unittest.makeSuite(escriptTestCase)) |
70 |
unittest.TextTestRunner(verbosity=2).run(suite) |
suite.addTest(unittest.makeSuite(Test_symbols_OnBruce)) |
71 |
|
suite.addTest(unittest.makeSuite(Test_util_OnBruce)) |
72 |
sys.exit(0) |
if unittest.TextTestRunner(verbosity=2).run(suite).wasSuccessful(): |
73 |
|
sys.exit(0) |
74 |
|
else: |
75 |
|
sys.exit(1) |