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

Diff of /trunk/escriptcore/test/python/test_shared.py

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

branches/arrexp_2137_win/escript/test/python/test_shared.py revision 2212 by jfenwick, Wed Jan 14 00:15:00 2009 UTC trunk/escriptcore/test/python/test_shared.py revision 4657 by jfenwick, Thu Feb 6 06:12:20 2014 UTC
# Line 1  Line 1 
1    
2  ########################################################  ##############################################################################
3  #  #
4  # Copyright (c) 2003-2008 by University of Queensland  # Copyright (c) 2003-2014 by University of Queensland
5  # Earth Systems Science Computational Center (ESSCC)  # http://www.uq.edu.au
 # http://www.uq.edu.au/esscc  
6  #  #
7  # Primary Business: Queensland, Australia  # Primary Business: Queensland, Australia
8  # Licensed under the Open Software License version 3.0  # Licensed under the Open Software License version 3.0
9  # http://www.opensource.org/licenses/osl-3.0.php  # 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) 2003-2008 by University of Queensland  __copyright__="""Copyright (c) 2003-2014 by University of Queensland
18  Earth Systems Science Computational Center (ESSCC)  http://www.uq.edu.au
 http://www.uq.edu.au/esscc  
19  Primary Business: Queensland, Australia"""  Primary Business: Queensland, Australia"""
20  __license__="""Licensed under the Open Software License version 3.0  __license__="""Licensed under the Open Software License version 3.0
21  http://www.opensource.org/licenses/osl-3.0.php"""  http://www.opensource.org/licenses/osl-3.0.php"""
22  __url__="http://www.uq.edu.au/esscc/escript-finley"  __url__="https://launchpad.net/escript-finley"
23    
24  """  """
25  Test to ensure that modification of shared Data does not occur  Test to ensure that modification of shared Data does not occur
# Line 28  from esys.escript import * Line 30  from esys.escript import *
30    
31  class Test_Shared(unittest.TestCase):  class Test_Shared(unittest.TestCase):
32    def test_setToZero(self):    def test_setToZero(self):
33      d=Data(42)          d=Data(42)
34      e=d.delay()          e=d.delay()
35      d.setToZero()          d.setToZero()
36      self.failUnless(Lsup(e-42)<=self.tol)          self.assertTrue(Lsup(e-42)<=self.tol)
37                
38    def test_copyConstr(self):    def test_copyConstr(self):
39      d=Data(42)          d=Data(42)
40      e=Data(d)          e=Data(d)
41      d+=17          d+=17
42      self.failUnless(Lsup(e-42)<=self.tol)          self.assertTrue(Lsup(e-42)<=self.tol)
43                
44    # This should not fail (even in the old code) but it doesn't hurt to check    # This should not fail (even in the old code) but it doesn't hurt to check
45    def test_Copy(self):    def test_Copy(self):
46      d=Data(42)          d=Data(42)
47      e=d.copy()          e=d.copy()
48      d+=17          d+=17
49      self.failUnless(Lsup(e-42)<=self.tol)          self.assertTrue(Lsup(e-42)<=self.tol)
50                
51    def  test_eqops(self):    def  test_eqops(self):
52      d=Data(42)          d=Data(42)
53      e=d.delay()          e=d.delay()
54      d+=17          d+=17
55      self.failUnless(Lsup(e-42)<=self.tol)          self.assertTrue(Lsup(e-42)<=self.tol)
56      d=Data(42)          d=Data(42)
57      e=d.delay()          e=d.delay()
58      d-=1          d-=1
59      self.failUnless(Lsup(e-42)<=self.tol)          self.assertTrue(Lsup(e-42)<=self.tol)
60      d*=3          d*=3
61      d=Data(42)          d=Data(42)
62      e=d.delay()          e=d.delay()    
63      d/=2          d/=2
64      self.failUnless(Lsup(e-42)<=self.tol)          self.assertTrue(Lsup(e-42)<=self.tol)
65                
66    def test_setItem(self):    def test_setItem(self):
67      d=Data(42)          d=Data(42)
68      e=d.delay()          e=d.delay()
69      d[tuple()]=17          d[tuple()]=17
70      self.failUnless(Lsup(e-42)<=self.tol)          self.assertTrue(Lsup(e-42)<=self.tol)
71    
72    
73    def test_setTaggedValue(self):    def test_setTaggedValue(self):
74      d=Data(42,self.domain.getX().getFunctionSpace())    # doesn't really matter which non-NULL FS we use          d=Data(42,self.domain.getX().getFunctionSpace())        # doesn't really matter which non-NULL FS we use
75      d.tag()          d.tag()
76      self.domain.setTagMap("TestTag",2)          self.domain.setTagMap("TestTag",2)
77      e=d.delay()          e=d.delay()
78      d.setTaggedValue("TestTag",17)          d.setTaggedValue("TestTag",17)
79      e.resolve()          e.resolve()
80      self.failUnless(str(e)!=str(d))          self.assertTrue(str(e)!=str(d))
81      e=d.delay()          e=d.delay()
82      d.setTaggedValue(1,12)          d.setTaggedValue(1,12)
83      e.resolve()          e.resolve()
84      self.failUnless(str(e)!=str(d))          self.assertTrue(str(e)!=str(d))
85    
86    
       
       
87            
88            

Legend:
Removed from v.2212  
changed lines
  Added in v.4657

  ViewVC Help
Powered by ViewVC 1.1.26