From 1154f51aabcf581bcd6a7123f699ee1924973e2a Mon Sep 17 00:00:00 2001 From: tamasmeszaros Date: Mon, 13 Mar 2023 13:52:21 +0100 Subject: [PATCH] Fix failing libnest2d tests Fix the test itself --- tests/libnest2d/libnest2d_tests_main.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/tests/libnest2d/libnest2d_tests_main.cpp b/tests/libnest2d/libnest2d_tests_main.cpp index 97c7ef99d..f6df83b77 100644 --- a/tests/libnest2d/libnest2d_tests_main.cpp +++ b/tests/libnest2d/libnest2d_tests_main.cpp @@ -1024,9 +1024,15 @@ TEST_CASE("pointOnPolygonContour", "[Geometry]") { REQUIRE(getX(first) == getX(ecache.coords(0))); REQUIRE(getY(first) == getY(ecache.coords(0))); - auto last = *std::prev(input.end()); - REQUIRE(getX(last) == getX(ecache.coords(1.0))); - REQUIRE(getY(last) == getY(ecache.coords(1.0))); + if constexpr (ClosureTypeV == Closure::CLOSED) { + auto last = *std::prev(input.end()); + REQUIRE(getX(last) == getX(ecache.coords(1.0))); + REQUIRE(getY(last) == getY(ecache.coords(1.0))); + } else { + auto last = *input.begin(); + REQUIRE(getX(last) == getX(ecache.coords(1.0))); + REQUIRE(getY(last) == getY(ecache.coords(1.0))); + } for(int i = 0; i <= 100; i++) { auto v = ecache.coords(i*(0.01));