/[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 4507 by jfenwick, Wed Jul 24 02:50:22 2013 UTC
# Line 1  Line 1 
1    
2  ########################################################  ##############################################################################
3  #  #
4  # Copyright (c) 2003-2008 by University of Queensland  # Copyright (c) 2003-2013 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 since 2012 by School of Earth Sciences
13    #
14    ##############################################################################
15    
16  __copyright__="""Copyright (c) 2003-2008 by University of Queensland  __copyright__="""Copyright (c) 2003-2013 by University of Queensland
17  Earth Systems Science Computational Center (ESSCC)  http://www.uq.edu.au
 http://www.uq.edu.au/esscc  
18  Primary Business: Queensland, Australia"""  Primary Business: Queensland, Australia"""
19  __license__="""Licensed under the Open Software License version 3.0  __license__="""Licensed under the Open Software License version 3.0
20  http://www.opensource.org/licenses/osl-3.0.php"""  http://www.opensource.org/licenses/osl-3.0.php"""
21  __url__="http://www.uq.edu.au/esscc/escript-finley"  __url__="https://launchpad.net/escript-finley"
22    
23  """  """
24  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 29  from esys.escript import *
29    
30  class Test_Shared(unittest.TestCase):  class Test_Shared(unittest.TestCase):
31    def test_setToZero(self):    def test_setToZero(self):
32      d=Data(42)          d=Data(42)
33      e=d.delay()          e=d.delay()
34      d.setToZero()          d.setToZero()
35      self.failUnless(Lsup(e-42)<=self.tol)          self.assertTrue(Lsup(e-42)<=self.tol)
36                
37    def test_copyConstr(self):    def test_copyConstr(self):
38      d=Data(42)          d=Data(42)
39      e=Data(d)          e=Data(d)
40      d+=17          d+=17
41      self.failUnless(Lsup(e-42)<=self.tol)          self.assertTrue(Lsup(e-42)<=self.tol)
42                
43    # 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
44    def test_Copy(self):    def test_Copy(self):
45      d=Data(42)          d=Data(42)
46      e=d.copy()          e=d.copy()
47      d+=17          d+=17
48      self.failUnless(Lsup(e-42)<=self.tol)          self.assertTrue(Lsup(e-42)<=self.tol)
49                
50    def  test_eqops(self):    def  test_eqops(self):
51      d=Data(42)          d=Data(42)
52      e=d.delay()          e=d.delay()
53      d+=17          d+=17
54      self.failUnless(Lsup(e-42)<=self.tol)          self.assertTrue(Lsup(e-42)<=self.tol)
55      d=Data(42)          d=Data(42)
56      e=d.delay()          e=d.delay()
57      d-=1          d-=1
58      self.failUnless(Lsup(e-42)<=self.tol)          self.assertTrue(Lsup(e-42)<=self.tol)
59      d*=3          d*=3
60      d=Data(42)          d=Data(42)
61      e=d.delay()          e=d.delay()    
62      d/=2          d/=2
63      self.failUnless(Lsup(e-42)<=self.tol)          self.assertTrue(Lsup(e-42)<=self.tol)
64                
65    def test_setItem(self):    def test_setItem(self):
66      d=Data(42)          d=Data(42)
67      e=d.delay()          e=d.delay()
68      d[tuple()]=17          d[tuple()]=17
69      self.failUnless(Lsup(e-42)<=self.tol)          self.assertTrue(Lsup(e-42)<=self.tol)
70    
71    
72    def test_setTaggedValue(self):    def test_setTaggedValue(self):
73      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
74      d.tag()          d.tag()
75      self.domain.setTagMap("TestTag",2)          self.domain.setTagMap("TestTag",2)
76      e=d.delay()          e=d.delay()
77      d.setTaggedValue("TestTag",17)          d.setTaggedValue("TestTag",17)
78      e.resolve()          e.resolve()
79      self.failUnless(str(e)!=str(d))          self.assertTrue(str(e)!=str(d))
80      e=d.delay()          e=d.delay()
81      d.setTaggedValue(1,12)          d.setTaggedValue(1,12)
82      e.resolve()          e.resolve()
83      self.failUnless(str(e)!=str(d))          self.assertTrue(str(e)!=str(d))
84    
85    
       
       
86            
87            

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

  ViewVC Help
Powered by ViewVC 1.1.26