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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 6651 - (show annotations)
Wed Feb 7 02:12:08 2018 UTC (19 months, 1 week ago) by jfenwick
File MIME type: text/x-python
File size: 2537 byte(s)
Make everyone sad by touching all the files

Copyright dates update

1
2 ##############################################################################
3 #
4 # Copyright (c) 2003-2018 by The University of Queensland
5 # http://www.uq.edu.au
6 #
7 # Primary Business: Queensland, Australia
8 # Licensed under the Apache License, version 2.0
9 # http://www.apache.org/licenses/LICENSE-2.0
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 from __future__ import print_function, division
18
19 __copyright__="""Copyright (c) 2003-2018 by The University of Queensland
20 http://www.uq.edu.au
21 Primary Business: Queensland, Australia"""
22 __license__="""Licensed under the Apache License, version 2.0
23 http://www.apache.org/licenses/LICENSE-2.0"""
24 __url__="https://launchpad.net/escript-finley"
25
26 """
27 Test to ensure that modification of shared Data does not occur
28 """
29
30 import esys.escriptcore.utestselect as unittest
31 from esys.escript import *
32
33 class Test_Shared(unittest.TestCase):
34 def test_setToZero(self):
35 d=Data(42)
36 e=d.delay()
37 d.setToZero()
38 self.assertTrue(Lsup(e-42)<=self.tol)
39
40 def test_copyConstr(self):
41 d=Data(42)
42 e=Data(d)
43 d+=17
44 self.assertTrue(Lsup(e-42)<=self.tol)
45
46 # This should not fail (even in the old code) but it doesn't hurt to check
47 def test_Copy(self):
48 d=Data(42)
49 e=d.copy()
50 d+=17
51 self.assertTrue(Lsup(e-42)<=self.tol)
52
53 def test_eqops(self):
54 d=Data(42)
55 e=d.delay()
56 d+=17
57 self.assertTrue(Lsup(e-42)<=self.tol)
58 d=Data(42)
59 e=d.delay()
60 d-=1
61 self.assertTrue(Lsup(e-42)<=self.tol)
62 d*=3
63 d=Data(42)
64 e=d.delay()
65 d/=2
66 self.assertTrue(Lsup(e-42)<=self.tol)
67
68 def test_setItem(self):
69 d=Data(42)
70 e=d.delay()
71 d[tuple()]=17
72 self.assertTrue(Lsup(e-42)<=self.tol)
73
74
75 def test_setTaggedValue(self):
76 d=Data(42,self.domain.getX().getFunctionSpace()) # doesn't really matter which non-NULL FS we use
77 d.tag()
78 self.domain.setTagMap("TestTag",2)
79 e=d.delay()
80 d.setTaggedValue("TestTag",17)
81 e.resolve()
82 self.assertTrue(str(e)!=str(d))
83 e=d.delay()
84 d.setTaggedValue(1,12)
85 e.resolve()
86 self.assertTrue(str(e)!=str(d))
87
88
89
90

  ViewVC Help
Powered by ViewVC 1.1.26