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):