Salome HOME
[bos #37644] changed precision to avoid random test failure in SHAPER_TestConstraintT...
[modules/shaper.git] / src / ModelHighAPI / ModelHighAPI_FeatureStore.cpp
index 97523e429ee19d62ca0159376a03c8773cc9d0b9..e6b73dcdc5fd9c4ad596f67be66abbe6cda71bf4 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2023  CEA, EDF
+// Copyright (C) 2014-2024  CEA, EDF
 //
 // This library is free software; you can redistribute it and/or
 // modify it under the terms of the GNU Lesser General Public
@@ -54,8 +54,8 @@
 #include <sstream>
 #include <iomanip>
 
-#define PRECISION 6
-#define TOLERANCE (1.e-7)
+#define PRECISION 5
+#define TOLERANCE (1.e-6)
 
 ModelHighAPI_FeatureStore::ModelHighAPI_FeatureStore(ObjectPtr theObject) {
   storeData(theObject->data(), myAttrs);
@@ -411,9 +411,12 @@ std::string ModelHighAPI_FeatureStore::dumpShape(std::shared_ptr<GeomAPI_Shape>&
   GeomAPI_Shape::ShapeType aType = GeomAPI_Shape::COMPOUND;
   for (; aType <= GeomAPI_Shape::VERTEX; aType = GeomAPI_Shape::ShapeType((int)aType + 1)) {
     GeomAPI_ShapeExplorer anExp(theShape, aType);
-    int aCount = 0;
-    for (; anExp.more(); anExp.next()) aCount++;
-    aResult << anExp.current()->shapeTypeStr().c_str() <<  ": " << aCount << std::endl;
+    if (anExp.more()) {
+      std::string aTypeStr = anExp.current()->shapeTypeStr();
+      int aCount = 0;
+      for (; anExp.more(); anExp.next()) aCount++;
+      aResult << aTypeStr.c_str() <<  ": " << aCount << std::endl;
+    }
   }
   // output the main characteristics
   double aVolume = GeomAlgoAPI_ShapeTools::volume(theShape);