Hi,
If that's an intentional upstream change, reassigning to catch2 won't
help as it's not a bug in that package.
Got it.
In the meantime, I prepared a patch to fix compatibility with Catch2 v3
(attached). I haven't submitted it upstream yet, but I'd appreciate any
feedback.
The biggest changes were around floating point value comparisons.
I had to tweak some unit tests, because the previous approximations in
Catch2 are no longer available, and the replacement functionality uses a
different algorithm. In fact, there's three algorithms now, and I chose
the one that seems most appropriate to me for what slic3r does. I
believe there is no change in correctness, the results should be well
within acceptable limits.
Regards,
GregFrom: Gregor Riepl
Date: Tue, 31 Oct 2023 19:37:00 +0100
Subject: Catch2 v3 updates
Bug-Debian: https://bugs.debian.org/1054697
---
tests/CMakeLists.txt | 13 +++--
1 file changed, 3 insertions(+), 10 deletions(-)
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -12,7 +12,7 @@
add_library(test_common INTERFACE)
target_compile_definitions(test_common INTERFACE TEST_DATA_DIR=R"\(${TEST_DATA_DIR}\)" CATCH_CONFIG_FAST_COMPILE)
-target_link_libraries(test_common INTERFACE Catch2::Catch2)
+target_link_libraries(test_common INTERFACE Catch2::Catch2WithMain)
target_include_directories(test_common INTERFACE ${CMAKE_CURRENT_LIST_DIR})
if (APPLE)
target_link_libraries(test_common INTERFACE "-liconv -framework IOKit" "-framework CoreFoundation" -lc++)
--- a/tests/arrange/test_arrange.cpp
+++ b/tests/arrange/test_arrange.cpp
@@ -1,4 +1,4 @@
-#include
+#include
#include "test_utils.hpp"
#include
@@ -40,6 +40,8 @@
#include
+using Catch::Matchers::WithinRel;
+
template
static std::vector prusa_parts(double infl = 0.) {
using namespace Slic3r;
@@ -930,7 +932,7 @@
Slic3r::Vec2crd D = bed.center - item.shape.center();
REQUIRE(item.translation == D);
-REQUIRE(score == Approx(0.).margin(EPSILON));
+REQUIRE_THAT(score, WithinRel(0., EPSILON));
}
}
}
@@ -1063,7 +1065,7 @@
bool packed = pack(strategy, bed, itm);
REQUIRE(packed);
-REQUIRE(get_rotation(itm) == Approx(PI));
+REQUIRE_THAT(get_rotation(itm), WithinRel(PI));
}
//TEST_CASE("NFP optimizing test", "[arrange2]") {
--- a/tests/arrange/test_arrange_integration.cpp
+++ b/tests/arrange/test_arrange_integration.cpp
@@ -1,4 +1,4 @@
-#include
+#include
#include "test_utils.hpp"
#include
@@ -12,6 +12,8 @@
#include "libslic3r/Format/3mf.hpp"
#include "libslic3r/ModelArrange.hpp"
+using Catch::Matchers::WithinRel;
+
static Slic3r::Model get_example_model_with_20mm_cube()
{
using namespace Slic3r;
@@ -560,10 +562,10 @@
auto ref_pos = tr * Vec3d::Zero();
auto displace = bed_index * (unscaled(vbh.stride_scaled()));
-REQUIRE(ref_pos.x() == Approx(-displace));
+REQUIRE_THAT(ref_pos.x(), WithinRel(-displace));
auto ref_pos_mi = mi_to_move.get_matrix() * Vec3d::Zero();
-REQUIRE(ref_pos_mi.x() == Approx(instance_displace.x() + (bed_index >= 0) * displace));
+REQUIRE_THAT(ref_pos_mi.x(), WithinRel(instance_displace.x() + (bed_index >= 0) * displace));
}
}
}
@@ -868,8 +870,8 @@
{
return v1.is_rotation_enabled() == v2.is_rotation_enabled() &&
v1.get_arrange_strategy() == v2.get_arrange_strategy() &&
- v1.get_distance_from_bed() == Approx(v2.get_distance_from_bed()) &&
- v1.get_distance_from_objects() == Approx(v2.get_distance_from_objects()) &&
+ WithinRel(v2.get_distance_from_bed()).match(v1.get_distance_from_bed()) &&
+ WithinRel(v2.get_distance_from_objects()).match(v1.get_distance_from_objects()) &&
v1.get_geometry_handling() == v2.get_geometry_handling() &&
v1.get_xl_alignment() == v2.get_xl_alignment();
;
--- a/tests/fff_print/test_avoid_crossing_perimeters.cpp
+++ b/tests/fff_print/test_avoid_crossing_perimeters.cpp
@@ -1,4 +1,4 @@
-#include
+#include
#include "test_data.hpp"
--- a/tests/fff_print/test_bridges.cpp
+++ b/tests/fff_print/test_bridges.cpp
@@ -1,4 +1,4 @@
-#include
+#include
#include
#include
--- a/tests/fff_print/test_clipper.cpp
+++ b/tests/fff_print/test_clipper.cpp
@@ -1,4 +1,4 @@
-#include
+#include
#include "test_data.hpp"
#include "libslic3r/ClipperZUtils.hpp"
--- a/tests/fff_print/test_cooling.cpp
+++ b/tests/fff_print/test_cooling.cpp
@@ -1,4 +1,4 @@
-#include
+#include
#include
#include
--- a/tests/fff_print/test_custom_gcode.cpp
+++ b/tests/fff_print/test_custom_gcode.cpp
@@ -1,4 +1,4 @@
-#include
+#include
#include
#include
--- a/tests/fff_print/test_data.cpp
+++ b/tests/fff_print/test_data.cpp
@@ -367,7 +367,7 @@
} } // namespace Slic3r::Test
-#include
+#include