2021-05-06 20:04:59 +00:00
|
|
|
# Automatically enable catch2 to generate ctest targets
|
|
|
|
if(CONAN_CATCH2_ROOT_DEBUG)
|
|
|
|
include(${CONAN_CATCH2_ROOT_DEBUG}/lib/cmake/Catch2/Catch.cmake)
|
|
|
|
else()
|
|
|
|
include(${CONAN_CATCH2_ROOT}/lib/cmake/Catch2/Catch.cmake)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
add_library(catch_main STATIC catch_main.cpp)
|
2021-05-19 20:28:05 +00:00
|
|
|
target_link_libraries(catch_main PUBLIC CONAN_PKG::catch2 CONAN_PKG::fmt)
|
2021-05-06 20:04:59 +00:00
|
|
|
target_link_libraries(catch_main PRIVATE project_options)
|
|
|
|
|
|
|
|
add_executable(tests tests.cpp)
|
|
|
|
target_link_libraries(tests PRIVATE project_warnings project_options catch_main)
|
|
|
|
|
|
|
|
# automatically discover tests that are defined in catch based test files you can modify the unittests. Set TEST_PREFIX
|
|
|
|
# to whatever you want, or use different for different binaries
|
|
|
|
catch_discover_tests(
|
|
|
|
tests
|
|
|
|
TEST_PREFIX
|
2021-05-19 20:28:05 +00:00
|
|
|
"approval_tests."
|
|
|
|
PROPERTIES
|
|
|
|
ENVIRONMENT CXX_6502=$<TARGET_FILE:6502-c++> ENVIRONMENT X64=/usr/bin/x64
|
2021-05-06 20:04:59 +00:00
|
|
|
REPORTER
|
|
|
|
xml
|
|
|
|
OUTPUT_DIR
|
|
|
|
.
|
|
|
|
OUTPUT_PREFIX
|
2021-05-19 20:28:05 +00:00
|
|
|
"approval_tests."
|
2021-05-06 20:04:59 +00:00
|
|
|
OUTPUT_SUFFIX
|
2021-05-19 20:28:05 +00:00
|
|
|
.xml
|
|
|
|
|
|
|
|
)
|
2021-05-06 20:04:59 +00:00
|
|
|
|
|
|
|
# Add a file containing a set of constexpr tests
|
|
|
|
add_executable(constexpr_tests constexpr_tests.cpp)
|
|
|
|
target_link_libraries(constexpr_tests PRIVATE project_options project_warnings catch_main)
|
|
|
|
|
|
|
|
catch_discover_tests(
|
|
|
|
constexpr_tests
|
|
|
|
TEST_PREFIX
|
|
|
|
"constexpr."
|
|
|
|
REPORTER
|
|
|
|
xml
|
|
|
|
OUTPUT_DIR
|
|
|
|
.
|
|
|
|
OUTPUT_PREFIX
|
|
|
|
"constexpr."
|
|
|
|
OUTPUT_SUFFIX
|
|
|
|
.xml)
|
|
|
|
|
|
|
|
# Disable the constexpr portion of the test, and build again this allows us to have an executable that we can debug when
|
|
|
|
# things go wrong with the constexpr testing
|
|
|
|
add_executable(relaxed_constexpr_tests constexpr_tests.cpp)
|
|
|
|
target_link_libraries(relaxed_constexpr_tests PRIVATE project_options project_warnings catch_main)
|
|
|
|
target_compile_definitions(relaxed_constexpr_tests PRIVATE -DCATCH_CONFIG_RUNTIME_STATIC_REQUIRE)
|
|
|
|
|
|
|
|
catch_discover_tests(
|
|
|
|
relaxed_constexpr_tests
|
|
|
|
TEST_PREFIX
|
|
|
|
"relaxed_constexpr."
|
|
|
|
REPORTER
|
|
|
|
xml
|
|
|
|
OUTPUT_DIR
|
|
|
|
.
|
|
|
|
OUTPUT_PREFIX
|
|
|
|
"relaxed_constexpr."
|
|
|
|
OUTPUT_SUFFIX
|
|
|
|
.xml)
|