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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 4657 - (hide annotations)
Thu Feb 6 06:12:20 2014 UTC (5 years, 7 months ago) by jfenwick
File MIME type: text/x-python
File size: 2467 byte(s)
I changed some files.
Updated copyright notices, added GeoComp.



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

  ViewVC Help
Powered by ViewVC 1.1.26