libnest2d test rewritten for catch2. Fine tuned catch2 integration.
This commit is contained in:
parent
320d18f07c
commit
ce4f4bea06
@ -131,8 +131,8 @@ function(catch_discover_tests TARGET)
|
||||
-D "TEST_SPEC=${_TEST_SPEC}"
|
||||
-D "TEST_EXTRA_ARGS=${_EXTRA_ARGS}"
|
||||
-D "TEST_PROPERTIES=${_PROPERTIES}"
|
||||
-D "TEST_PREFIX=${_TEST_PREFIX}"
|
||||
-D "TEST_SUFFIX=${_TEST_SUFFIX}"
|
||||
-D "TEST_PREFIX='${_TEST_PREFIX}'"
|
||||
-D "TEST_SUFFIX='${_TEST_SUFFIX}'"
|
||||
-D "TEST_LIST=${_TEST_LIST}"
|
||||
-D "CTEST_FILE=${ctest_tests_file}"
|
||||
-P "${_CATCH_DISCOVER_TESTS_SCRIPT}"
|
||||
|
@ -13,11 +13,6 @@ set(CMAKE_CXX_STANDARD_REQUIRED)
|
||||
# Add our own cmake module path.
|
||||
list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake_modules/)
|
||||
|
||||
option(LIBNEST2D_UNITTESTS "If enabled, googletest framework will be downloaded
|
||||
and the provided unit tests will be included in the build." OFF)
|
||||
|
||||
option(LIBNEST2D_BUILD_EXAMPLES "If enabled, examples will be built." OFF)
|
||||
|
||||
option(LIBNEST2D_HEADER_ONLY "If enabled static library will not be built." ON)
|
||||
|
||||
set(GEOMETRY_BACKENDS clipper boost eigen)
|
||||
@ -109,26 +104,3 @@ if(NOT LIBNEST2D_HEADER_ONLY)
|
||||
target_link_libraries(${LIBNAME} PUBLIC libnest2d)
|
||||
target_compile_definitions(${LIBNAME} PUBLIC LIBNEST2D_STATIC)
|
||||
endif()
|
||||
|
||||
if(LIBNEST2D_BUILD_EXAMPLES)
|
||||
|
||||
add_executable(example examples/main.cpp
|
||||
# tools/libnfpglue.hpp
|
||||
# tools/libnfpglue.cpp
|
||||
tools/nfp_svgnest.hpp
|
||||
tools/nfp_svgnest_glue.hpp
|
||||
tools/svgtools.hpp
|
||||
tests/printer_parts.cpp
|
||||
tests/printer_parts.h
|
||||
)
|
||||
|
||||
if(NOT LIBNEST2D_HEADER_ONLY)
|
||||
target_link_libraries(example ${LIBNAME})
|
||||
else()
|
||||
target_link_libraries(example libnest2d)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(LIBNEST2D_UNITTESTS)
|
||||
add_subdirectory(${PROJECT_SOURCE_DIR}/tests)
|
||||
endif()
|
||||
|
@ -27,10 +27,6 @@ add_library(test_gtest_common INTERFACE)
|
||||
target_compile_definitions(test_gtest_common INTERFACE TEST_DATA_DIR="${TEST_DATA_DIR}")
|
||||
target_link_libraries(test_gtest_common INTERFACE GTest::GTest GTest::Main)
|
||||
|
||||
function(prusaslicer_discover_tests TARGET)
|
||||
catch_discover_tests(${TARGET})
|
||||
endfunction()
|
||||
|
||||
macro(subdirlist result curdir)
|
||||
file(GLOB children RELATIVE ${curdir} ${curdir}/*)
|
||||
set(dirlist "")
|
||||
@ -48,6 +44,3 @@ foreach(subdir ${SUBDIRS})
|
||||
add_subdirectory(${subdir})
|
||||
endforeach()
|
||||
|
||||
#add_subdirectory(timeutils)
|
||||
#add_subdirectory(example)
|
||||
|
||||
|
@ -2,4 +2,4 @@ get_filename_component(_TEST_NAME ${CMAKE_CURRENT_LIST_DIR} NAME)
|
||||
add_executable(${_TEST_NAME}_tests ${_TEST_NAME}_tests_main.cpp)
|
||||
target_link_libraries(${_TEST_NAME}_tests test_common libslic3r ${Boost_LIBRARIES} ${TBB_LIBRARIES} ${Boost_LIBRARIES})
|
||||
|
||||
prusaslicer_discover_tests(${_TEST_NAME}_tests)
|
||||
catch_discover_tests(${_TEST_NAME}_tests TEST_PREFIX "${_TEST_NAME}: ")
|
||||
|
5
tests/libnest2d/CMakeLists.txt
Normal file
5
tests/libnest2d/CMakeLists.txt
Normal file
@ -0,0 +1,5 @@
|
||||
get_filename_component(_TEST_NAME ${CMAKE_CURRENT_LIST_DIR} NAME)
|
||||
add_executable(${_TEST_NAME}_tests ${_TEST_NAME}_tests_main.cpp printer_parts.cpp printer_parts.hpp)
|
||||
target_link_libraries(${_TEST_NAME}_tests test_common libslic3r ${Boost_LIBRARIES} ${TBB_LIBRARIES} ${Boost_LIBRARIES})
|
||||
|
||||
catch_discover_tests(${_TEST_NAME}_tests TEST_PREFIX "${_TEST_NAME}: ")
|
1055
tests/libnest2d/libnest2d_tests_main.cpp
Normal file
1055
tests/libnest2d/libnest2d_tests_main.cpp
Normal file
File diff suppressed because it is too large
Load Diff
3175
tests/libnest2d/printer_parts.cpp
Normal file
3175
tests/libnest2d/printer_parts.cpp
Normal file
File diff suppressed because it is too large
Load Diff
14
tests/libnest2d/printer_parts.hpp
Normal file
14
tests/libnest2d/printer_parts.hpp
Normal file
@ -0,0 +1,14 @@
|
||||
#ifndef PRINTER_PARTS_H
|
||||
#define PRINTER_PARTS_H
|
||||
|
||||
#include <vector>
|
||||
#include <libnest2d/backends/clipper/clipper_polygon.hpp>
|
||||
|
||||
using TestData = std::vector<ClipperLib::Path>;
|
||||
using TestDataEx = std::vector<ClipperLib::Polygon>;
|
||||
|
||||
extern const TestData PRINTER_PART_POLYGONS;
|
||||
extern const TestData STEGOSAUR_POLYGONS;
|
||||
extern const TestDataEx PRINTER_PART_POLYGONS_EX;
|
||||
|
||||
#endif // PRINTER_PARTS_H
|
@ -1,4 +1,5 @@
|
||||
add_executable(timeutils_tests timeutils_tests_main.cpp)
|
||||
target_link_libraries(timeutils_tests test_common libslic3r ${Boost_LIBRARIES} ${TBB_LIBRARIES} ${Boost_LIBRARIES})
|
||||
get_filename_component(_TEST_NAME ${CMAKE_CURRENT_LIST_DIR} NAME)
|
||||
add_executable(${_TEST_NAME}_tests ${_TEST_NAME}_tests_main.cpp)
|
||||
target_link_libraries(${_TEST_NAME}_tests test_common libslic3r ${Boost_LIBRARIES} ${TBB_LIBRARIES} ${Boost_LIBRARIES})
|
||||
|
||||
prusaslicer_discover_tests(timeutils_tests)
|
||||
catch_discover_tests(${_TEST_NAME}_tests TEST_PREFIX "${_TEST_NAME}: ")
|
||||
|
Loading…
Reference in New Issue
Block a user