void MEDCouplingBasicsTest5::testDataArrayAbs1()
{
DataArrayDouble *d1=DataArrayDouble::New();
- const double val1[12]={2.,-3.,-5.,6.,-7.,-8.,9.,10.,-11.,-12.};
- const double expected1[12]={2.,3.,5.,6.,7.,8.,9.,10.,11.,12.};
+ const double val1[12]={2.,-3.,-5.,6.,-7.,-8.,9.,10.,-11.,-12.,-13.,-15.};
+ const double expected1[12]={2.,3.,5.,6.,7.,8.,9.,10.,11.,12.,13.,15.};
d1->alloc(6,2);
std::copy(val1,val1+12,d1->getPointer());
DataArrayInt *d2=d1->convertToIntArr();
for(int i=0;i<12;i++)
CPPUNIT_ASSERT_DOUBLES_EQUAL(expected1[i],d1->getIJ(0,i),1e-14);
//
- const int expected2[12]={2,3,5,6,7,8,9,10,11,12};
+ const int expected2[12]={2,3,5,6,7,8,9,10,11,12,13,15};
d2->abs();
for(int i=0;i<12;i++)
CPPUNIT_ASSERT_EQUAL(expected2[i],d2->getIJ(0,i));
self.assertEqual([0],res.getValues());
pass
pass
+
+ def testDataArrayAbs1(self):
+ d1=DataArrayDouble.New();
+ val1=[2.,-3.,-5.,6.,-7.,-8.,9.,10.,-11.,-12.,-13.,-15.]
+ expected1=[2.,3.,5.,6.,7.,8.,9.,10.,11.,12.,13.,15.]
+ d1.setValues(val1,6,2);
+ d2=d1.convertToIntArr();
+ #
+ d1.abs();
+ for i in xrange(12):
+ self.assertAlmostEqual(expected1[i],d1.getIJ(0,i),14);
+ pass
+ #
+ expected2=[2,3,5,6,7,8,9,10,11,12,13,15]
+ d2.abs();
+ for i in xrange(12):
+ self.assertEqual(expected2[i],d2.getIJ(0,i));
+ pass
+ #
+ pass
def setUp(self):
pass