From: Anthony Geay Date: Thu, 16 Jun 2016 15:58:55 +0000 (+0200) Subject: Still a bug in DataArrayInt::sortEachPairToMakeALinkedList X-Git-Tag: V8_1_0a1~9 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=a9f4bbc213a491cae8e7cc777569e9f2b8eb2ffb;p=tools%2Fmedcoupling.git Still a bug in DataArrayInt::sortEachPairToMakeALinkedList --- diff --git a/src/MEDCoupling/MEDCouplingMemArray.cxx b/src/MEDCoupling/MEDCouplingMemArray.cxx index 8f90e1e17..8ccb92e54 100644 --- a/src/MEDCoupling/MEDCouplingMemArray.cxx +++ b/src/MEDCoupling/MEDCouplingMemArray.cxx @@ -10757,7 +10757,8 @@ void DataArrayInt::sortEachPairToMakeALinkedList() } else {//here we are sure to have (std::count(conn,conn+4,conn[1])==2) - std::swap(conn[2],conn[3]); + if(conn[1]==conn[3]) + std::swap(conn[2],conn[3]); } } } diff --git a/src/MEDCoupling_Swig/MEDCouplingBasicsTest5.py b/src/MEDCoupling_Swig/MEDCouplingBasicsTest5.py index a9b6541fb..e3abefdd0 100644 --- a/src/MEDCoupling_Swig/MEDCouplingBasicsTest5.py +++ b/src/MEDCoupling_Swig/MEDCouplingBasicsTest5.py @@ -3730,6 +3730,9 @@ class MEDCouplingBasicsTest5(unittest.TestCase): d=DataArrayInt([(0,2),(1,2),(3,1)]) d.sortEachPairToMakeALinkedList() self.assertTrue(d.isEqual(DataArrayInt([(0,2),(2,1),(1,3)]))) + d=DataArrayInt([(8,6062),(6062,472),(472,6292),(6292,960)]) + d.sortEachPairToMakeALinkedList() + self.assertTrue(d.isEqual(DataArrayInt([(8,6062),(6062,472),(472,6292),(6292,960)]))) pass def testSwig2DAIIsRange(self):