From 475ebbd166027108c361cda42aa429cffe32a1d5 Mon Sep 17 00:00:00 2001 From: azv Date: Mon, 17 Dec 2018 09:58:23 +0300 Subject: [PATCH] [Code coverage GeomValidators]: Exclude "fool-tolerance" validations --- src/GeomValidators/GeomValidators_BodyShapes.cpp | 2 ++ .../GeomValidators_ConstructionComposite.cpp | 2 ++ src/GeomValidators/GeomValidators_Face.cpp | 2 ++ src/GeomValidators/GeomValidators_Intersected.cpp | 4 ++++ src/GeomValidators/GeomValidators_MinObjectsSelected.cpp | 4 ++++ src/GeomValidators/GeomValidators_NotSelfIntersected.cpp | 8 ++++++++ src/GeomValidators/GeomValidators_ShapeType.cpp | 4 ++++ src/GeomValidators/GeomValidators_ZeroOffset.cpp | 2 ++ 8 files changed, 28 insertions(+) diff --git a/src/GeomValidators/GeomValidators_BodyShapes.cpp b/src/GeomValidators/GeomValidators_BodyShapes.cpp index ff040cecb..90ba00ee0 100644 --- a/src/GeomValidators/GeomValidators_BodyShapes.cpp +++ b/src/GeomValidators/GeomValidators_BodyShapes.cpp @@ -82,9 +82,11 @@ bool GeomValidators_BodyShapes::isValid(const AttributePtr& theAttribute, } } } else { +// LCOV_EXCL_START theError = "Error: Attribute \"%1\" does not supported by this validator."; theError.arg(anAttributeType); return false; +// LCOV_EXCL_STOP } return true; diff --git a/src/GeomValidators/GeomValidators_ConstructionComposite.cpp b/src/GeomValidators/GeomValidators_ConstructionComposite.cpp index c065b0eb8..a53767121 100644 --- a/src/GeomValidators/GeomValidators_ConstructionComposite.cpp +++ b/src/GeomValidators/GeomValidators_ConstructionComposite.cpp @@ -32,10 +32,12 @@ bool GeomValidators_ConstructionComposite::isValid(const AttributePtr& theAttrib { bool aValid = true; if (theAttribute->attributeType() != ModelAPI_AttributeSelection::typeId()) { +// LCOV_EXCL_START aValid = false; theError = "The attribute with the %1 type is not processed"; theError.arg(theAttribute->attributeType()); return aValid; +// LCOV_EXCL_STOP } AttributeSelectionPtr aSelectionAttr = std::dynamic_pointer_cast diff --git a/src/GeomValidators/GeomValidators_Face.cpp b/src/GeomValidators/GeomValidators_Face.cpp index 18cc1b1e6..69170232d 100644 --- a/src/GeomValidators/GeomValidators_Face.cpp +++ b/src/GeomValidators/GeomValidators_Face.cpp @@ -87,9 +87,11 @@ bool GeomValidators_Face::isValid(const AttributePtr& theAttribute, { std::string anAttributeType = theAttribute->attributeType(); if (anAttributeType != ModelAPI_AttributeSelection::typeId()) { +// LCOV_EXCL_START theError = "The attribute with the %1 type is not processed"; theError.arg(theAttribute->attributeType()); return false; +// LCOV_EXCL_STOP } bool aValid = true; diff --git a/src/GeomValidators/GeomValidators_Intersected.cpp b/src/GeomValidators/GeomValidators_Intersected.cpp index aeef9bd12..ed23b6a2b 100644 --- a/src/GeomValidators/GeomValidators_Intersected.cpp +++ b/src/GeomValidators/GeomValidators_Intersected.cpp @@ -31,6 +31,7 @@ bool GeomValidators_Intersected::isValid(const AttributePtr& theAttribute, const std::list& theArguments, Events_InfoMessage& theError) const { +// LCOV_EXCL_START if (!theAttribute) { theError = "Error: empty selection."; return false; @@ -40,6 +41,7 @@ bool GeomValidators_Intersected::isValid(const AttributePtr& theAttribute, theError = "Error: compare with nothing"; return false; } +// LCOV_EXCL_STOP FeaturePtr aFeature = ModelAPI_Feature::feature(theAttribute->owner()); @@ -59,10 +61,12 @@ bool GeomValidators_Intersected::isValid(const AttributePtr& theAttribute, for (std::list::const_iterator anIt = theArguments.begin(); anIt != theArguments.end() && isOk; ++anIt) { aSelection = aFeature->selection(*anIt); +// LCOV_EXCL_START if (!aSelection) { theError = "Error: incorrect type of attribute"; return false; } +// LCOV_EXCL_STOP GeomShapePtr aShape; if (aSelection) diff --git a/src/GeomValidators/GeomValidators_MinObjectsSelected.cpp b/src/GeomValidators/GeomValidators_MinObjectsSelected.cpp index 8a7d171db..cf30db5f9 100644 --- a/src/GeomValidators/GeomValidators_MinObjectsSelected.cpp +++ b/src/GeomValidators/GeomValidators_MinObjectsSelected.cpp @@ -31,17 +31,21 @@ bool GeomValidators_MinObjectsSelected::isValid(const std::shared_ptrselectionList(aSelectionListId); if(!anAttrSelList.get()) { +// LCOV_EXCL_START theError = "Error: Could not get attribute \"%1\"."; theError.arg(aSelectionListId); return false; +// LCOV_EXCL_STOP } int anObjectsNb = anAttrSelList->size(); diff --git a/src/GeomValidators/GeomValidators_NotSelfIntersected.cpp b/src/GeomValidators/GeomValidators_NotSelfIntersected.cpp index aa017935d..c4d491515 100644 --- a/src/GeomValidators/GeomValidators_NotSelfIntersected.cpp +++ b/src/GeomValidators/GeomValidators_NotSelfIntersected.cpp @@ -32,10 +32,12 @@ bool GeomValidators_NotSelfIntersected::isValid(const std::shared_ptr& theArguments, Events_InfoMessage& theError) const { +// LCOV_EXCL_START if (theArguments.empty()) { theError = "Error: empty selection."; return false; } +// LCOV_EXCL_STOP for (std::list::const_iterator anIt = theArguments.cbegin(); anIt != theArguments.cend(); @@ -44,8 +46,10 @@ bool GeomValidators_NotSelfIntersected::isValid(const std::shared_ptrattribute(anArgument); if (!anAttribute.get()) { +// LCOV_EXCL_START theError = std::string("Error: Feature does not contain attribute: ") + anArgument; return false; +// LCOV_EXCL_STOP } if (anAttribute->attributeType() == ModelAPI_AttributeSelectionList::typeId()) { AttributeSelectionListPtr anAttrSelectionList = @@ -53,8 +57,10 @@ bool GeomValidators_NotSelfIntersected::isValid(const std::shared_ptrsize(); ++anIndex) { AttributeSelectionPtr anAttrSelection = anAttrSelectionList->value(anIndex); if (!anAttrSelection.get()) { +// LCOV_EXCL_START theError = "Error: Empty attribute selection."; return false; +// LCOV_EXCL_STOP } ResultPtr aContext = anAttrSelection->context(); if (!aContext.get()) { @@ -80,9 +86,11 @@ bool GeomValidators_NotSelfIntersected::isValid(const std::shared_ptrattributeType(); return false; +// LCOV_EXCL_STOP } } diff --git a/src/GeomValidators/GeomValidators_ShapeType.cpp b/src/GeomValidators/GeomValidators_ShapeType.cpp index a7638e7be..18620d14a 100755 --- a/src/GeomValidators/GeomValidators_ShapeType.cpp +++ b/src/GeomValidators/GeomValidators_ShapeType.cpp @@ -163,8 +163,10 @@ bool GeomValidators_ShapeType::isValidAttribute(const AttributePtr& theAttribute std::string anAttributeType = aRefAttr->attributeType(); aValid = anAttributeType == GeomDataAPI_Point2D::typeId(); if (!aValid) { +// LCOV_EXCL_START theError = "Shape type is \"%1\", it should be \"%2\""; theError.arg(anAttributeType).arg(getShapeTypeDescription(theShapeType)); +// LCOV_EXCL_STOP } } } @@ -189,9 +191,11 @@ bool GeomValidators_ShapeType::isValidAttribute(const AttributePtr& theAttribute } } else { +// LCOV_EXCL_START aValid = false; theError = "The attribute with the %1 type is not processed"; theError.arg(anAttributeType); +// LCOV_EXCL_STOP } if (aValid) theError = ""; diff --git a/src/GeomValidators/GeomValidators_ZeroOffset.cpp b/src/GeomValidators/GeomValidators_ZeroOffset.cpp index d6181783f..c5a1d8243 100644 --- a/src/GeomValidators/GeomValidators_ZeroOffset.cpp +++ b/src/GeomValidators/GeomValidators_ZeroOffset.cpp @@ -40,10 +40,12 @@ bool GeomValidators_ZeroOffset::isValid(const std::shared_ptr& const std::list& theArguments, Events_InfoMessage& theError) const { +// LCOV_EXCL_START if(theArguments.size() != 9) { theError = "Wrong number of validator arguments in xml(expected 9)."; return false; } +// LCOV_EXCL_STOP std::list::const_iterator anIt = theArguments.begin(), aLast = theArguments.end(); -- 2.39.2