[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
This commit is contained in:
@@ -48,7 +48,7 @@ TEST_F(FeaturePartCommonTest, testIntersecting)
|
||||
// EXPECT_EQ(bb.MaxY, 2);
|
||||
// EXPECT_EQ(bb.MaxZ, 3);
|
||||
double volume = PartTestHelpers::getVolume(ts.getShape());
|
||||
EXPECT_DOUBLE_EQ(volume,3.0);
|
||||
EXPECT_DOUBLE_EQ(volume, 3.0);
|
||||
}
|
||||
|
||||
TEST_F(FeaturePartCommonTest, testNonIntersecting)
|
||||
@@ -65,7 +65,7 @@ TEST_F(FeaturePartCommonTest, testNonIntersecting)
|
||||
// Assert
|
||||
EXPECT_FALSE(bb.IsValid());
|
||||
double volume = PartTestHelpers::getVolume(ts.getShape());
|
||||
EXPECT_DOUBLE_EQ(volume,0.0);
|
||||
EXPECT_DOUBLE_EQ(volume, 0.0);
|
||||
}
|
||||
|
||||
TEST_F(FeaturePartCommonTest, testTouching)
|
||||
@@ -82,7 +82,7 @@ TEST_F(FeaturePartCommonTest, testTouching)
|
||||
// Assert
|
||||
EXPECT_FALSE(bb.IsValid());
|
||||
double volume = PartTestHelpers::getVolume(ts.getShape());
|
||||
EXPECT_DOUBLE_EQ(volume,0.0);
|
||||
EXPECT_DOUBLE_EQ(volume, 0.0);
|
||||
}
|
||||
|
||||
TEST_F(FeaturePartCommonTest, testAlmostTouching)
|
||||
@@ -99,7 +99,7 @@ TEST_F(FeaturePartCommonTest, testAlmostTouching)
|
||||
// Assert
|
||||
EXPECT_FALSE(bb.IsValid());
|
||||
double volume = PartTestHelpers::getVolume(ts.getShape());
|
||||
EXPECT_DOUBLE_EQ(volume,0.0);
|
||||
EXPECT_DOUBLE_EQ(volume, 0.0);
|
||||
}
|
||||
|
||||
TEST_F(FeaturePartCommonTest, testBarelyIntersecting)
|
||||
@@ -123,7 +123,7 @@ TEST_F(FeaturePartCommonTest, testBarelyIntersecting)
|
||||
double volume = PartTestHelpers::getVolume(ts.getShape());
|
||||
double target = Base::Precision::Confusion() * 3 * 1000;
|
||||
// FLOAT, not DOUBLE here, because ULP accuracy would be too precise.
|
||||
EXPECT_FLOAT_EQ(volume,target); // 0.00029999999999996696);
|
||||
EXPECT_FLOAT_EQ(volume, target); // 0.00029999999999996696);
|
||||
}
|
||||
|
||||
TEST_F(FeaturePartCommonTest, testMustExecute)
|
||||
|
||||
@@ -39,7 +39,7 @@ TEST_F(FeaturePartCutTest, testIntersecting)
|
||||
_cut->execute();
|
||||
Part::TopoShape ts = _cut->Shape.getValue();
|
||||
double volume = PartTestHelpers::getVolume(ts.getShape());
|
||||
EXPECT_DOUBLE_EQ(volume,3.0);
|
||||
EXPECT_DOUBLE_EQ(volume, 3.0);
|
||||
}
|
||||
|
||||
TEST_F(FeaturePartCutTest, testNonIntersecting)
|
||||
@@ -52,7 +52,7 @@ TEST_F(FeaturePartCutTest, testNonIntersecting)
|
||||
_cut->execute();
|
||||
Part::TopoShape ts = _cut->Shape.getValue();
|
||||
double volume = PartTestHelpers::getVolume(ts.getShape());
|
||||
EXPECT_DOUBLE_EQ(volume,6.0);
|
||||
EXPECT_DOUBLE_EQ(volume, 6.0);
|
||||
}
|
||||
|
||||
TEST_F(FeaturePartCutTest, testTouching)
|
||||
@@ -67,7 +67,7 @@ TEST_F(FeaturePartCutTest, testTouching)
|
||||
double volume = PartTestHelpers::getVolume(ts.getShape());
|
||||
|
||||
// Assert
|
||||
EXPECT_DOUBLE_EQ(volume,6.0);
|
||||
EXPECT_DOUBLE_EQ(volume, 6.0);
|
||||
}
|
||||
|
||||
TEST_F(FeaturePartCutTest, testAlmostTouching)
|
||||
@@ -80,7 +80,7 @@ TEST_F(FeaturePartCutTest, testAlmostTouching)
|
||||
_cut->execute();
|
||||
Part::TopoShape ts = _cut->Shape.getValue();
|
||||
double volume = PartTestHelpers::getVolume(ts.getShape());
|
||||
EXPECT_DOUBLE_EQ(volume,6.0);
|
||||
EXPECT_DOUBLE_EQ(volume, 6.0);
|
||||
}
|
||||
|
||||
TEST_F(FeaturePartCutTest, testBarelyIntersecting)
|
||||
@@ -94,7 +94,7 @@ TEST_F(FeaturePartCutTest, testBarelyIntersecting)
|
||||
Part::TopoShape ts = _cut->Shape.getValue();
|
||||
double volume = PartTestHelpers::getVolume(ts.getShape());
|
||||
double target = 6 - Base::Precision::Confusion() * 3 * 1000;
|
||||
EXPECT_FLOAT_EQ(volume,target);
|
||||
EXPECT_FLOAT_EQ(volume, target);
|
||||
}
|
||||
|
||||
TEST_F(FeaturePartCutTest, testMustExecute)
|
||||
|
||||
@@ -39,7 +39,7 @@ TEST_F(FeaturePartFuseTest, testIntersecting)
|
||||
_fuse->execute();
|
||||
Part::TopoShape ts = _fuse->Shape.getValue();
|
||||
double volume = PartTestHelpers::getVolume(ts.getShape());
|
||||
EXPECT_DOUBLE_EQ(volume,9.0);
|
||||
EXPECT_DOUBLE_EQ(volume, 9.0);
|
||||
}
|
||||
|
||||
TEST_F(FeaturePartFuseTest, testNonIntersecting)
|
||||
@@ -52,7 +52,7 @@ TEST_F(FeaturePartFuseTest, testNonIntersecting)
|
||||
_fuse->execute();
|
||||
Part::TopoShape ts = _fuse->Shape.getValue();
|
||||
double volume = PartTestHelpers::getVolume(ts.getShape());
|
||||
EXPECT_DOUBLE_EQ(volume,12.0);
|
||||
EXPECT_DOUBLE_EQ(volume, 12.0);
|
||||
}
|
||||
|
||||
TEST_F(FeaturePartFuseTest, testTouching)
|
||||
@@ -65,7 +65,7 @@ TEST_F(FeaturePartFuseTest, testTouching)
|
||||
_fuse->execute();
|
||||
Part::TopoShape ts = _fuse->Shape.getValue();
|
||||
double volume = PartTestHelpers::getVolume(ts.getShape());
|
||||
EXPECT_DOUBLE_EQ(volume,12.0);
|
||||
EXPECT_DOUBLE_EQ(volume, 12.0);
|
||||
}
|
||||
|
||||
TEST_F(FeaturePartFuseTest, testAlmostTouching)
|
||||
@@ -78,7 +78,7 @@ TEST_F(FeaturePartFuseTest, testAlmostTouching)
|
||||
_fuse->execute();
|
||||
Part::TopoShape ts = _fuse->Shape.getValue();
|
||||
double volume = PartTestHelpers::getVolume(ts.getShape());
|
||||
EXPECT_FLOAT_EQ(volume,12.0);
|
||||
EXPECT_FLOAT_EQ(volume, 12.0);
|
||||
}
|
||||
|
||||
TEST_F(FeaturePartFuseTest, testBarelyIntersecting)
|
||||
@@ -92,7 +92,7 @@ TEST_F(FeaturePartFuseTest, testBarelyIntersecting)
|
||||
Part::TopoShape ts = _fuse->Shape.getValue();
|
||||
double volume = PartTestHelpers::getVolume(ts.getShape());
|
||||
double target = 12 - Base::Precision::Confusion() * 3 * 1000;
|
||||
EXPECT_FLOAT_EQ(volume,target);
|
||||
EXPECT_FLOAT_EQ(volume, target);
|
||||
}
|
||||
|
||||
TEST_F(FeaturePartFuseTest, testMustExecute)
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
|
||||
#include "PartTestHelpers.h"
|
||||
|
||||
namespace PartTestHelpers {
|
||||
namespace PartTestHelpers
|
||||
{
|
||||
|
||||
double getVolume(TopoDS_Shape shape)
|
||||
{
|
||||
@@ -12,35 +13,35 @@ double getVolume(TopoDS_Shape shape)
|
||||
|
||||
void PartTestHelperClass::createTestFile()
|
||||
{
|
||||
_docName = App::GetApplication().getUniqueDocumentName("test");
|
||||
_doc = App::GetApplication().newDocument(_docName.c_str(), "testUser");
|
||||
_box1obj = static_cast<Part::Box*>(_doc->addObject("Part::Box"));
|
||||
_box2obj = static_cast<Part::Box*>(_doc->addObject("Part::Box"));
|
||||
_box3obj = static_cast<Part::Box*>(_doc->addObject("Part::Box"));
|
||||
_box4obj = static_cast<Part::Box*>(_doc->addObject("Part::Box"));
|
||||
_box5obj = static_cast<Part::Box*>(_doc->addObject("Part::Box"));
|
||||
_box6obj = static_cast<Part::Box*>(_doc->addObject("Part::Box"));
|
||||
for ( auto _box : {_box1obj, _box2obj, _box3obj, _box4obj, _box5obj, _box6obj} ) {
|
||||
_box->Length.setValue(1);
|
||||
_box->Width.setValue(2);
|
||||
_box->Height.setValue(3);
|
||||
}
|
||||
_box1obj->Placement.setValue(
|
||||
Base::Placement(Base::Vector3d(), Base::Rotation(), Base::Vector3d()));
|
||||
_box2obj->Placement.setValue(
|
||||
Base::Placement(Base::Vector3d(0, 1, 0), Base::Rotation(), Base::Vector3d()));
|
||||
_box3obj->Placement.setValue(
|
||||
Base::Placement(Base::Vector3d(0, 3, 0), Base::Rotation(), Base::Vector3d()));
|
||||
_box4obj->Placement.setValue(
|
||||
Base::Placement(Base::Vector3d(0, 2, 0), Base::Rotation(), Base::Vector3d()));
|
||||
_box5obj->Placement.setValue(
|
||||
Base::Placement(Base::Vector3d(0, 2 + Base::Precision::Confusion(), 0),
|
||||
Base::Rotation(),
|
||||
Base::Vector3d()));
|
||||
_box6obj->Placement.setValue(
|
||||
Base::Placement(Base::Vector3d(0, 2 - Base::Precision::Confusion() * 1000, 0),
|
||||
Base::Rotation(),
|
||||
Base::Vector3d()));
|
||||
_docName = App::GetApplication().getUniqueDocumentName("test");
|
||||
_doc = App::GetApplication().newDocument(_docName.c_str(), "testUser");
|
||||
_box1obj = static_cast<Part::Box*>(_doc->addObject("Part::Box"));
|
||||
_box2obj = static_cast<Part::Box*>(_doc->addObject("Part::Box"));
|
||||
_box3obj = static_cast<Part::Box*>(_doc->addObject("Part::Box"));
|
||||
_box4obj = static_cast<Part::Box*>(_doc->addObject("Part::Box"));
|
||||
_box5obj = static_cast<Part::Box*>(_doc->addObject("Part::Box"));
|
||||
_box6obj = static_cast<Part::Box*>(_doc->addObject("Part::Box"));
|
||||
for (auto _box : {_box1obj, _box2obj, _box3obj, _box4obj, _box5obj, _box6obj}) {
|
||||
_box->Length.setValue(1);
|
||||
_box->Width.setValue(2);
|
||||
_box->Height.setValue(3);
|
||||
}
|
||||
_box1obj->Placement.setValue(
|
||||
Base::Placement(Base::Vector3d(), Base::Rotation(), Base::Vector3d()));
|
||||
_box2obj->Placement.setValue(
|
||||
Base::Placement(Base::Vector3d(0, 1, 0), Base::Rotation(), Base::Vector3d()));
|
||||
_box3obj->Placement.setValue(
|
||||
Base::Placement(Base::Vector3d(0, 3, 0), Base::Rotation(), Base::Vector3d()));
|
||||
_box4obj->Placement.setValue(
|
||||
Base::Placement(Base::Vector3d(0, 2, 0), Base::Rotation(), Base::Vector3d()));
|
||||
_box5obj->Placement.setValue(
|
||||
Base::Placement(Base::Vector3d(0, 2 + Base::Precision::Confusion(), 0),
|
||||
Base::Rotation(),
|
||||
Base::Vector3d()));
|
||||
_box6obj->Placement.setValue(
|
||||
Base::Placement(Base::Vector3d(0, 2 - Base::Precision::Confusion() * 1000, 0),
|
||||
Base::Rotation(),
|
||||
Base::Vector3d()));
|
||||
}
|
||||
|
||||
}
|
||||
} // namespace PartTestHelpers
|
||||
|
||||
@@ -6,11 +6,13 @@
|
||||
#include "Mod/Part/App/FeatureFillet.h"
|
||||
#include <BRepGProp.hxx>
|
||||
|
||||
namespace PartTestHelpers {
|
||||
namespace PartTestHelpers
|
||||
{
|
||||
|
||||
double getVolume(TopoDS_Shape shape);
|
||||
|
||||
class PartTestHelperClass {
|
||||
class PartTestHelperClass
|
||||
{
|
||||
public:
|
||||
App::Document* _doc;
|
||||
std::string _docName;
|
||||
@@ -19,4 +21,4 @@ public:
|
||||
void createTestFile();
|
||||
};
|
||||
|
||||
}
|
||||
} // namespace PartTestHelpers
|
||||
|
||||
Reference in New Issue
Block a user