From a9f4bbc213a491cae8e7cc777569e9f2b8eb2ffb Mon Sep 17 00:00:00 2001 From: Anthony Geay Date: Thu, 16 Jun 2016 17:58:55 +0200 Subject: [PATCH] Still a bug in DataArrayInt::sortEachPairToMakeALinkedList --- src/MEDCoupling/MEDCouplingMemArray.cxx | 3 ++- src/MEDCoupling_Swig/MEDCouplingBasicsTest5.py | 3 +++ 2 files changed, 5 insertions(+), 1 deletion(-) 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): -- 2.39.2