From: ageay Date: Fri, 29 Jun 2012 09:21:07 +0000 (+0000) Subject: Add non regression test. The testSwigBugNonRegressionZipDA lead to a mem corruption... X-Git-Tag: V6_main_FINAL~616 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=ac1021ba3d328142f21e883eb2a1f9bfe01bf2e1;p=tools%2Fmedcoupling.git Add non regression test. The testSwigBugNonRegressionZipDA lead to a mem corruption in 6.5.0. --- diff --git a/src/MEDCoupling_Swig/MEDCouplingBasicsTest.py b/src/MEDCoupling_Swig/MEDCouplingBasicsTest.py index 9d0dd6711..a853cf7f6 100644 --- a/src/MEDCoupling_Swig/MEDCouplingBasicsTest.py +++ b/src/MEDCoupling_Swig/MEDCouplingBasicsTest.py @@ -9953,6 +9953,32 @@ class MEDCouplingBasicsTest(unittest.TestCase): self.assertTrue(m2.getCoords().isEqual(DataArrayDouble.New(expected1[pos],4,2),1e-12)) pass pass + + def testSwigBugNonRegressionZipDA(self): + angles=map(lambda x:pi/3*x,xrange(6)) + radius=3 + # + dad=DataArrayDouble.New(6, 2) + dad[:,0]=radius + dad[:,1]=angles + # + dad2=dad.fromPolarToCart() + dads=[dad2.deepCpy() for elt in 7*[None]] + # + translationToPerform=[[0.01,0.02],[3./2.*radius,-radius*sqrt(3.)/2],[3./2.*radius,radius*sqrt(3.)/2],[0.,radius*sqrt(3.)],[-3./2.*radius,radius*sqrt(3.)/2],[-3./2.*radius,-radius*sqrt(3.)/2],[0.,-radius*sqrt(3.)]] + for d,t in zip(dads,translationToPerform): + d+=t + pass + for elt in dads: + self.assertTrue(not dad2.isEqual(elt,1e-12)) + pass + for d,t in zip(dads,translationToPerform): + d-=t + pass + for elt in dads: + self.assertTrue(dad2.isEqual(elt,1e-12)) + pass + pass def setUp(self): pass