mirror of
https://github.com/cosmo-sims/monofonIC.git
synced 2024-09-18 15:53:45 +02:00
Created simple dummy unit tests.
This commit is contained in:
parent
7b40edf40a
commit
11a7cf54eb
4 changed files with 32 additions and 0 deletions
|
@ -264,4 +264,14 @@ if(ENABLE_GENERICIO)
|
|||
include(${CMAKE_CURRENT_SOURCE_DIR}/external/genericio.cmake)
|
||||
target_link_libraries(${PRGNAME} PRIVATE genericio::genericio_mpi)
|
||||
target_compile_definitions(${PRGNAME} PRIVATE "ENABLE_GENERICIO")
|
||||
endif()
|
||||
|
||||
################################### Testing ####################################
|
||||
if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME)
|
||||
include(CTest)
|
||||
enable_testing()
|
||||
endif()
|
||||
|
||||
if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME AND BUILD_TESTING)
|
||||
add_subdirectory(testing)
|
||||
endif()
|
12
testing/CMakeLists.txt
Normal file
12
testing/CMakeLists.txt
Normal file
|
@ -0,0 +1,12 @@
|
|||
# get all unit test sources
|
||||
file(GLOB UNIT_TEST_SOURCES "${PROJECT_SOURCE_DIR}/testing/unit/*.cpp")
|
||||
|
||||
# create the tests
|
||||
foreach(UNIT_TEST_CPP ${UNIT_TEST_SOURCES})
|
||||
get_filename_component(UNIT_TEST_NAME ${UNIT_TEST_CPP} NAME_WE)
|
||||
add_executable(${UNIT_TEST_NAME} ${UNIT_TEST_CPP})
|
||||
add_test(NAME ${UNIT_TEST_NAME} COMMAND ${UNIT_TEST_NAME})
|
||||
endforeach()
|
||||
|
||||
# add properties to specific tests
|
||||
set_tests_properties(failure PROPERTIES WILL_FAIL true)
|
5
testing/unit/failure.cpp
Normal file
5
testing/unit/failure.cpp
Normal file
|
@ -0,0 +1,5 @@
|
|||
#include <cstdlib>
|
||||
|
||||
int main(int argc, char const *argv[]) {
|
||||
return EXIT_FAILURE;
|
||||
}
|
5
testing/unit/success.cpp
Normal file
5
testing/unit/success.cpp
Normal file
|
@ -0,0 +1,5 @@
|
|||
#include <cstdlib>
|
||||
|
||||
int main(int argc, char const *argv[]) {
|
||||
return EXIT_SUCCESS;
|
||||
}
|
Loading…
Reference in a new issue