mirror of
https://github.com/microsoft/GSL.git
synced 2024-11-03 17:56:43 -05:00
Add add_gsl_test() function in tests/CMakeLists.txt
With this function we can avoid duplicated code to add a new test.
This commit is contained in:
parent
3d033a3ec9
commit
5d9aae7430
@ -31,128 +31,24 @@ if (NOT EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/unittest-cpp)
|
|||||||
message(FATAL_ERROR "Could not find unittest-cpp enlistment. Please run 'git clone https://github.com/Microsoft/unittest-cpp.git unittest-cpp' in the tests directory")
|
message(FATAL_ERROR "Could not find unittest-cpp enlistment. Please run 'git clone https://github.com/Microsoft/unittest-cpp.git unittest-cpp' in the tests directory")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
add_executable(array_view_tests
|
function(add_gsl_test name)
|
||||||
array_view_tests.cpp
|
add_executable(${name} ${name}.cpp)
|
||||||
)
|
target_link_libraries(${name} UnitTest++)
|
||||||
target_link_libraries(array_view_tests
|
install(TARGETS ${name}
|
||||||
UnitTest++
|
RUNTIME DESTINATION bin
|
||||||
)
|
)
|
||||||
install(TARGETS array_view_tests
|
add_test(
|
||||||
RUNTIME DESTINATION bin
|
NAME ${name}
|
||||||
)
|
COMMAND ${name}
|
||||||
add_test(
|
)
|
||||||
NAME array_view_tests
|
endfunction()
|
||||||
COMMAND array_view_tests
|
|
||||||
)
|
|
||||||
|
|
||||||
add_executable(string_view_tests
|
add_gsl_test(array_view_tests)
|
||||||
string_view_tests.cpp
|
add_gsl_test(string_view_tests)
|
||||||
)
|
add_gsl_test(at_tests)
|
||||||
target_link_libraries(string_view_tests
|
add_gsl_test(bounds_tests)
|
||||||
UnitTest++
|
add_gsl_test(maybenull_tests)
|
||||||
)
|
add_gsl_test(notnull_tests)
|
||||||
install(TARGETS string_view_tests
|
add_gsl_test(assertion_tests)
|
||||||
RUNTIME DESTINATION bin
|
add_gsl_test(utils_tests)
|
||||||
)
|
add_gsl_test(owner_tests)
|
||||||
add_test(
|
|
||||||
NAME string_view_tests
|
|
||||||
COMMAND string_view_tests
|
|
||||||
)
|
|
||||||
|
|
||||||
add_executable(at_tests
|
|
||||||
at_tests.cpp
|
|
||||||
)
|
|
||||||
target_link_libraries(at_tests
|
|
||||||
UnitTest++
|
|
||||||
)
|
|
||||||
install(TARGETS at_tests
|
|
||||||
RUNTIME DESTINATION bin
|
|
||||||
)
|
|
||||||
add_test(
|
|
||||||
NAME at_tests
|
|
||||||
COMMAND at_tests
|
|
||||||
)
|
|
||||||
|
|
||||||
add_executable(bounds_tests
|
|
||||||
bounds_tests.cpp
|
|
||||||
)
|
|
||||||
target_link_libraries(bounds_tests
|
|
||||||
UnitTest++
|
|
||||||
)
|
|
||||||
install(TARGETS bounds_tests
|
|
||||||
RUNTIME DESTINATION bin
|
|
||||||
)
|
|
||||||
add_test(
|
|
||||||
NAME bounds_tests
|
|
||||||
COMMAND bounds_tests
|
|
||||||
)
|
|
||||||
|
|
||||||
add_executable(maybenull_tests
|
|
||||||
maybenull_tests.cpp
|
|
||||||
)
|
|
||||||
target_link_libraries(maybenull_tests
|
|
||||||
UnitTest++
|
|
||||||
)
|
|
||||||
install(TARGETS maybenull_tests
|
|
||||||
RUNTIME DESTINATION bin
|
|
||||||
)
|
|
||||||
add_test(
|
|
||||||
NAME maybenull_tests
|
|
||||||
COMMAND maybenull_tests
|
|
||||||
)
|
|
||||||
|
|
||||||
add_executable(notnull_tests
|
|
||||||
notnull_tests.cpp
|
|
||||||
)
|
|
||||||
target_link_libraries(notnull_tests
|
|
||||||
UnitTest++
|
|
||||||
)
|
|
||||||
install(TARGETS notnull_tests
|
|
||||||
RUNTIME DESTINATION bin
|
|
||||||
)
|
|
||||||
add_test(
|
|
||||||
NAME notnull_tests
|
|
||||||
COMMAND notnull_tests
|
|
||||||
)
|
|
||||||
|
|
||||||
add_executable(assertion_tests
|
|
||||||
assertion_tests.cpp
|
|
||||||
)
|
|
||||||
target_link_libraries(assertion_tests
|
|
||||||
UnitTest++
|
|
||||||
)
|
|
||||||
install(TARGETS assertion_tests
|
|
||||||
RUNTIME DESTINATION bin
|
|
||||||
)
|
|
||||||
add_test(
|
|
||||||
NAME assertion_tests
|
|
||||||
COMMAND assertion_tests
|
|
||||||
)
|
|
||||||
|
|
||||||
add_executable(utils_tests
|
|
||||||
utils_tests.cpp
|
|
||||||
)
|
|
||||||
target_link_libraries(utils_tests
|
|
||||||
UnitTest++
|
|
||||||
)
|
|
||||||
install(TARGETS utils_tests
|
|
||||||
RUNTIME DESTINATION bin
|
|
||||||
)
|
|
||||||
add_test(
|
|
||||||
NAME utils_tests
|
|
||||||
COMMAND utils_tests
|
|
||||||
)
|
|
||||||
|
|
||||||
add_executable(owner_tests
|
|
||||||
owner_tests.cpp
|
|
||||||
)
|
|
||||||
target_link_libraries(owner_tests
|
|
||||||
UnitTest++
|
|
||||||
)
|
|
||||||
install(TARGETS owner_tests
|
|
||||||
RUNTIME DESTINATION bin
|
|
||||||
)
|
|
||||||
add_test(
|
|
||||||
NAME owner_tests
|
|
||||||
COMMAND owner_tests
|
|
||||||
)
|
|
||||||
|
Loading…
Reference in New Issue
Block a user