mirror of
https://github.com/emilybache/GildedRose-Refactoring-Kata.git
synced 2026-10-13 17:49:25 +00:00
Introduce four CMake options to enable/disabled test variants or test frameworks
By default all four test variants (Catch2 vs. GTest and Approval vs. Unit) are enabled.
This commit is contained in:
1 parent
afd4627ee1
commit
784920714a
8 files changed
+127
-92
No files matched your search
@@ -1,19 +1,21 @@
|
||||
set(TEST_NAME GildedRoseCatch2UnitTests)
|
||||
add_executable(${TEST_NAME})
|
||||
target_sources(${TEST_NAME} PRIVATE GildedRoseCatch2UnitTests.cc)
|
||||
target_link_libraries(${TEST_NAME} GildedRoseLib Catch2::Catch2 Catch2::Catch2WithMain )
|
||||
set_property(TARGET ${TEST_NAME} PROPERTY CXX_STANDARD 14)
|
||||
add_test(
|
||||
if (BUILD_UNIT_TESTS_WITH_CATCH2)
|
||||
set(TEST_NAME GildedRoseCatch2UnitTests)
|
||||
add_executable(${TEST_NAME})
|
||||
target_sources(${TEST_NAME} PRIVATE GildedRoseCatch2UnitTests.cc)
|
||||
target_link_libraries(${TEST_NAME} GildedRoseLib Catch2::Catch2 Catch2::Catch2WithMain )
|
||||
set_property(TARGET ${TEST_NAME} PROPERTY CXX_STANDARD 14)
|
||||
add_test(
|
||||
NAME ${TEST_NAME}
|
||||
COMMAND ${TEST_NAME}
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
)
|
||||
|
||||
# Set compiler option /FC for Visual Studio to to make the __FILE__ macro expand to full path.
|
||||
# The __FILE__ macro is used by Catch2 to get the path to current test file.
|
||||
# Links:
|
||||
# * https://docs.microsoft.com/en-us/cpp/preprocessor/predefined-macros?view=vs-2019
|
||||
# * https://docs.microsoft.com/en-us/cpp/build/reference/fc-full-path-of-source-code-file-in-diagnostics?view=vs-2019
|
||||
if (MSVC)
|
||||
)
|
||||
|
||||
# Set compiler option /FC for Visual Studio to to make the __FILE__ macro expand to full path.
|
||||
# The __FILE__ macro is used by Catch2 to get the path to current test file.
|
||||
# Links:
|
||||
# * https://docs.microsoft.com/en-us/cpp/preprocessor/predefined-macros?view=vs-2019
|
||||
# * https://docs.microsoft.com/en-us/cpp/build/reference/fc-full-path-of-source-code-file-in-diagnostics?view=vs-2019
|
||||
if (MSVC)
|
||||
target_compile_options(${TEST_NAME} PRIVATE "/FC")
|
||||
endif()
|
||||
endif()
|
||||
Reference in new issue
Block a user