diff --git a/tests/src/Mod/Part/App/FeaturePartCommon.cpp b/tests/src/Mod/Part/App/FeaturePartCommon.cpp index 673a697a3d..d8098d03ed 100644 --- a/tests/src/Mod/Part/App/FeaturePartCommon.cpp +++ b/tests/src/Mod/Part/App/FeaturePartCommon.cpp @@ -112,8 +112,7 @@ TEST_F(FeaturePartCommonTest, testBarelyIntersecting) _common->execute(); Part::TopoShape ts = _common->Shape.getValue(); double volume = PartTestHelpers::getVolume(ts.getShape()); - double target = - Base::Precision::Confusion() * 3 * 1000; // Reduce precision to 1e04 over 3 dimensions + double target = PartTestHelpers::minimalDistance * 3; // 3 dimensions in a Volume Base::BoundBox3d bb = ts.getBoundBox(); // Assert @@ -123,7 +122,7 @@ TEST_F(FeaturePartCommonTest, testBarelyIntersecting) EXPECT_FLOAT_EQ(volume, target); // Should be approximately 0.00029999999999996696 // double check using bounds: EXPECT_DOUBLE_EQ(bb.MinX, 0.0); - EXPECT_DOUBLE_EQ(bb.MinY, 1.9999); + EXPECT_DOUBLE_EQ(bb.MinY, 2.0 - PartTestHelpers::minimalDistance); EXPECT_DOUBLE_EQ(bb.MinZ, 0.0); EXPECT_DOUBLE_EQ(bb.MaxX, 1.0); EXPECT_DOUBLE_EQ(bb.MaxY, 2.0); diff --git a/tests/src/Mod/Part/App/FeaturePartCut.cpp b/tests/src/Mod/Part/App/FeaturePartCut.cpp index f512c69f53..48d273bbfe 100644 --- a/tests/src/Mod/Part/App/FeaturePartCut.cpp +++ b/tests/src/Mod/Part/App/FeaturePartCut.cpp @@ -129,8 +129,7 @@ TEST_F(FeaturePartCutTest, testBarelyIntersecting) _cut->execute(); Part::TopoShape ts = _cut->Shape.getValue(); double volume = PartTestHelpers::getVolume(ts.getShape()); - double target = - 6 - Base::Precision::Confusion() * 3 * 1000; // Reduce precision to 1e04 over 3 dimensions + double target = 6 - PartTestHelpers::minimalDistance * 3; // 3 dimensions in a Volume Base::BoundBox3d bb = ts.getBoundBox(); // Assert @@ -143,7 +142,7 @@ TEST_F(FeaturePartCutTest, testBarelyIntersecting) EXPECT_DOUBLE_EQ(bb.MinY, 0.0); EXPECT_DOUBLE_EQ(bb.MinZ, 0.0); EXPECT_DOUBLE_EQ(bb.MaxX, 1.0); - EXPECT_DOUBLE_EQ(bb.MaxY, 1.9999); + EXPECT_DOUBLE_EQ(bb.MaxY, 2.0 - PartTestHelpers::minimalDistance); EXPECT_DOUBLE_EQ(bb.MaxZ, 3.0); } diff --git a/tests/src/Mod/Part/App/FeaturePartFuse.cpp b/tests/src/Mod/Part/App/FeaturePartFuse.cpp index a9db9b4b8b..432dc9f58a 100644 --- a/tests/src/Mod/Part/App/FeaturePartFuse.cpp +++ b/tests/src/Mod/Part/App/FeaturePartFuse.cpp @@ -130,8 +130,7 @@ TEST_F(FeaturePartFuseTest, testBarelyIntersecting) _fuse->execute(); Part::TopoShape ts = _fuse->Shape.getValue(); double volume = PartTestHelpers::getVolume(ts.getShape()); - double target = - 12 - Base::Precision::Confusion() * 3 * 1000; // Reduce precision to 1e04 over 3 dimensions + double target = 12 - PartTestHelpers::minimalDistance * 3; // 3 dimensions in a Volume Base::BoundBox3d bb = ts.getBoundBox(); // Assert @@ -144,7 +143,7 @@ TEST_F(FeaturePartFuseTest, testBarelyIntersecting) EXPECT_DOUBLE_EQ(bb.MinY, 0.0); EXPECT_DOUBLE_EQ(bb.MinZ, 0.0); EXPECT_DOUBLE_EQ(bb.MaxX, 1.0); - EXPECT_DOUBLE_EQ(bb.MaxY, 3.9999); + EXPECT_DOUBLE_EQ(bb.MaxY, 4.0 - PartTestHelpers::minimalDistance); EXPECT_DOUBLE_EQ(bb.MaxZ, 3.0); } diff --git a/tests/src/Mod/Part/App/PartTestHelpers.cpp b/tests/src/Mod/Part/App/PartTestHelpers.cpp index ab8d8f60ec..cbaa02e3d4 100644 --- a/tests/src/Mod/Part/App/PartTestHelpers.cpp +++ b/tests/src/Mod/Part/App/PartTestHelpers.cpp @@ -22,7 +22,7 @@ void PartTestHelperClass::createTestDoc() Base::Vector3d(0, 2, 0), // Touch the first box Base::Vector3d(0, 2 + Base::Precision::Confusion(), 0), // Just Outside of touching // For just inside of touching, go enough that precision rounding doesn't make us overlap. - Base::Vector3d(0, 2 - Base::Precision::Confusion() * 1000, 0)}; + Base::Vector3d(0, 2 - minimalDistance, 0)}; // for (auto& [box, origin] : zip(_boxes, box_origins) ) { // for ( int i : range(0,_boxes.size())) { diff --git a/tests/src/Mod/Part/App/PartTestHelpers.h b/tests/src/Mod/Part/App/PartTestHelpers.h index 0adbea84de..cc2be6e1c6 100644 --- a/tests/src/Mod/Part/App/PartTestHelpers.h +++ b/tests/src/Mod/Part/App/PartTestHelpers.h @@ -20,4 +20,6 @@ public: void createTestDoc(); }; +const double minimalDistance = Base::Precision::Confusion() * 1000; + } // namespace PartTestHelpers