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

  ViewVC Help
Powered by ViewVC 1.1.26