From 906826c1c8cb428df76d6034c04266a97a89137d Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Fri, 22 Dec 2023 21:17:02 +0000 Subject: [PATCH] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- tests/src/Mod/Part/App/FeaturePartCommon.cpp | 10 ++-- tests/src/Mod/Part/App/FeaturePartCut.cpp | 10 ++-- tests/src/Mod/Part/App/FeaturePartFuse.cpp | 10 ++-- tests/src/Mod/Part/App/PartTestHelpers.cpp | 63 ++++++++++---------- tests/src/Mod/Part/App/PartTestHelpers.h | 8 ++- 5 files changed, 52 insertions(+), 49 deletions(-) diff --git a/tests/src/Mod/Part/App/FeaturePartCommon.cpp b/tests/src/Mod/Part/App/FeaturePartCommon.cpp index 839c0dc45c..f4487b4dcb 100644 --- a/tests/src/Mod/Part/App/FeaturePartCommon.cpp +++ b/tests/src/Mod/Part/App/FeaturePartCommon.cpp @@ -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) diff --git a/tests/src/Mod/Part/App/FeaturePartCut.cpp b/tests/src/Mod/Part/App/FeaturePartCut.cpp index a788691402..1da983a4b9 100644 --- a/tests/src/Mod/Part/App/FeaturePartCut.cpp +++ b/tests/src/Mod/Part/App/FeaturePartCut.cpp @@ -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) diff --git a/tests/src/Mod/Part/App/FeaturePartFuse.cpp b/tests/src/Mod/Part/App/FeaturePartFuse.cpp index 7e666de6b0..c0694ac23a 100644 --- a/tests/src/Mod/Part/App/FeaturePartFuse.cpp +++ b/tests/src/Mod/Part/App/FeaturePartFuse.cpp @@ -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) diff --git a/tests/src/Mod/Part/App/PartTestHelpers.cpp b/tests/src/Mod/Part/App/PartTestHelpers.cpp index 1de59e7cfd..11e6b17999 100644 --- a/tests/src/Mod/Part/App/PartTestHelpers.cpp +++ b/tests/src/Mod/Part/App/PartTestHelpers.cpp @@ -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(_doc->addObject("Part::Box")); - _box2obj = static_cast(_doc->addObject("Part::Box")); - _box3obj = static_cast(_doc->addObject("Part::Box")); - _box4obj = static_cast(_doc->addObject("Part::Box")); - _box5obj = static_cast(_doc->addObject("Part::Box")); - _box6obj = static_cast(_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(_doc->addObject("Part::Box")); + _box2obj = static_cast(_doc->addObject("Part::Box")); + _box3obj = static_cast(_doc->addObject("Part::Box")); + _box4obj = static_cast(_doc->addObject("Part::Box")); + _box5obj = static_cast(_doc->addObject("Part::Box")); + _box6obj = static_cast(_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())); } -} \ No newline at end of file +} // namespace PartTestHelpers diff --git a/tests/src/Mod/Part/App/PartTestHelpers.h b/tests/src/Mod/Part/App/PartTestHelpers.h index a6bdfd37b9..1b6ffa1d8e 100644 --- a/tests/src/Mod/Part/App/PartTestHelpers.h +++ b/tests/src/Mod/Part/App/PartTestHelpers.h @@ -6,11 +6,13 @@ #include "Mod/Part/App/FeatureFillet.h" #include -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(); }; -} \ No newline at end of file +} // namespace PartTestHelpers