From: ageay Date: Fri, 4 Jan 2013 07:35:56 +0000 (+0000) Subject: More additionnal tests X-Git-Tag: V6_main_FINAL~433 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=c07f5d47fdd6d805b8f698ade89a17e4f12e666f;p=tools%2Fmedcoupling.git More additionnal tests --- diff --git a/src/MEDCoupling_Swig/MEDCouplingBasicsTest.py b/src/MEDCoupling_Swig/MEDCouplingBasicsTest.py index c467ed71e..3a418e0a6 100644 --- a/src/MEDCoupling_Swig/MEDCouplingBasicsTest.py +++ b/src/MEDCoupling_Swig/MEDCouplingBasicsTest.py @@ -10579,6 +10579,58 @@ class MEDCouplingBasicsTest(unittest.TestCase): d.pushBackSilent(555) d.pushBackSilent(666) self.assertTrue(d.isEqual(DataArrayInt([444,555,666]))) + # + d=DataArrayInt() + d.alloc(10,1) + d.setInfoOnComponent(0,"ABC") + d.setName("dEf") + d.iota(7) + e=DataArrayInt([7,8,9,10,11,12,13,14,15,16]) ; e.copyStringInfoFrom(d) ; self.assertTrue(d.isEqual(e)) + self.assertEqual(10,d.getNbOfElemAllocated()) + d.pushBackSilent(55) + e=DataArrayInt([7,8,9,10,11,12,13,14,15,16,55]) ; e.copyStringInfoFrom(d) ; self.assertTrue(d.isEqual(e)) + self.assertEqual(20,d.getNbOfElemAllocated()) + d.reserve(4) + e=DataArrayInt([7,8,9,10]) ; e.copyStringInfoFrom(d) ; self.assertTrue(d.isEqual(e)) + self.assertEqual(4,d.getNbOfElemAllocated()) + d.pushBackSilent(5) + e=DataArrayInt([7,8,9,10,5]) ; e.copyStringInfoFrom(d) ; self.assertTrue(d.isEqual(e)) + self.assertEqual(8,d.getNbOfElemAllocated()) + self.assertEqual(5,d.popBackSilent()) + e=DataArrayInt([7,8,9,10]) ; e.copyStringInfoFrom(d) ; self.assertTrue(d.isEqual(e)) + self.assertEqual(8,d.getNbOfElemAllocated()) + self.assertRaises(InterpKernelException,d.reserve,-1) + e=DataArrayInt([7,8,9,10]) ; e.copyStringInfoFrom(d) ; self.assertTrue(d.isEqual(e)) + self.assertEqual(8,d.getNbOfElemAllocated()) + d.reserve(0) + e=DataArrayInt([]) ; e.setInfoOnComponent(0,"ABC") ; e.setName("dEf") ; self.assertTrue(d.isEqual(e)) + self.assertEqual(0,d.getNbOfElemAllocated()) + # + d=DataArrayDouble() + d.alloc(10,1) + d.setInfoOnComponent(0,"ABC") + d.setName("dEf") + d.iota(7) + e=DataArrayDouble([7,8,9,10,11,12,13,14,15,16]) ; e.copyStringInfoFrom(d) ; self.assertTrue(d.isEqual(e,1e-14)) + self.assertEqual(10,d.getNbOfElemAllocated()) + d.pushBackSilent(55) + e=DataArrayDouble([7,8,9,10,11,12,13,14,15,16,55]) ; e.copyStringInfoFrom(d) ; self.assertTrue(d.isEqual(e,1e-14)) + self.assertEqual(20,d.getNbOfElemAllocated()) + d.reserve(4) + e=DataArrayDouble([7,8,9,10]) ; e.copyStringInfoFrom(d) ; self.assertTrue(d.isEqual(e,1e-14)) + self.assertEqual(4,d.getNbOfElemAllocated()) + d.pushBackSilent(5) + e=DataArrayDouble([7,8,9,10,5]) ; e.copyStringInfoFrom(d) ; self.assertTrue(d.isEqual(e,1e-14)) + self.assertEqual(8,d.getNbOfElemAllocated()) + self.assertEqual(5.,d.popBackSilent()) + e=DataArrayDouble([7,8,9,10]) ; e.copyStringInfoFrom(d) ; self.assertTrue(d.isEqual(e,1e-14)) + self.assertEqual(8,d.getNbOfElemAllocated()) + self.assertRaises(InterpKernelException,d.reserve,-1) + e=DataArrayDouble([7,8,9,10]) ; e.copyStringInfoFrom(d) ; self.assertTrue(d.isEqual(e,1e-14)) + self.assertEqual(8,d.getNbOfElemAllocated()) + d.reserve(0) + e=DataArrayDouble([]) ; e.setInfoOnComponent(0,"ABC") ; e.setName("dEf") ; self.assertTrue(d.isEqual(e,1e-14)) + self.assertEqual(0,d.getNbOfElemAllocated()) pass def setUp(self):