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

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

Parent Directory Parent Directory | Revision Log Revision Log


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

1
2 ########################################################
3 #
4 # Copyright (c) 2003-2010 by University of Queensland
5 # 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 __copyright__="""Copyright (c) 2003-2010 by University of Queensland
15 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 """
23 Test to ensure that modification of shared Data does not occur
24 """
25
26 import unittest
27 from esys.escript import *
28
29 class Test_Shared(unittest.TestCase):
30 def test_setToZero(self):
31 d=Data(42)
32 e=d.delay()
33 d.setToZero()
34 self.failUnless(Lsup(e-42)<=self.tol)
35
36 def test_copyConstr(self):
37 d=Data(42)
38 e=Data(d)
39 d+=17
40 self.failUnless(Lsup(e-42)<=self.tol)
41
42 # This should not fail (even in the old code) but it doesn't hurt to check
43 def test_Copy(self):
44 d=Data(42)
45 e=d.copy()
46 d+=17
47 self.failUnless(Lsup(e-42)<=self.tol)
48
49 def test_eqops(self):
50 d=Data(42)
51 e=d.delay()
52 d+=17
53 self.failUnless(Lsup(e-42)<=self.tol)
54 d=Data(42)
55 e=d.delay()
56 d-=1
57 self.failUnless(Lsup(e-42)<=self.tol)
58 d*=3
59 d=Data(42)
60 e=d.delay()
61 d/=2
62 self.failUnless(Lsup(e-42)<=self.tol)
63
64 def test_setItem(self):
65 d=Data(42)
66 e=d.delay()
67 d[tuple()]=17
68 self.failUnless(Lsup(e-42)<=self.tol)
69
70
71 def test_setTaggedValue(self):
72 d=Data(42,self.domain.getX().getFunctionSpace()) # doesn't really matter which non-NULL FS we use
73 d.tag()
74 self.domain.setTagMap("TestTag",2)
75 e=d.delay()
76 d.setTaggedValue("TestTag",17)
77 e.resolve()
78 self.failUnless(str(e)!=str(d))
79 e=d.delay()
80 d.setTaggedValue(1,12)
81 e.resolve()
82 self.failUnless(str(e)!=str(d))
83
84
85
86

  ViewVC Help
Powered by ViewVC 1.1.26