mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-24 01:31:46 +00:00
[wpinet] Translate unit tests to catch2 (#8954)
This commit is contained in:
@@ -13,3 +13,23 @@ macro(wpilib_add_test name srcdir)
|
||||
endif()
|
||||
add_test(NAME ${name} COMMAND ${name}_test)
|
||||
endmacro()
|
||||
|
||||
macro(wpilib_add_test_catch2 name)
|
||||
set(wpilib_catch2_test_src)
|
||||
foreach(src ${ARGN})
|
||||
if(IS_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/${src}")
|
||||
file(GLOB_RECURSE wpilib_catch2_dir_src ${src}/*.cpp)
|
||||
list(APPEND wpilib_catch2_test_src ${wpilib_catch2_dir_src})
|
||||
else()
|
||||
list(APPEND wpilib_catch2_test_src ${src})
|
||||
endif()
|
||||
endforeach()
|
||||
add_executable(${name}_test ${wpilib_catch2_test_src})
|
||||
set_property(TARGET ${name}_test PROPERTY FOLDER "tests")
|
||||
wpilib_target_warnings(${name}_test)
|
||||
target_link_libraries(${name}_test catch2)
|
||||
catch_discover_tests(${name}_test)
|
||||
if(MSVC)
|
||||
target_compile_options(${name}_test PRIVATE /wd4101 /wd4251 /utf-8)
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
Reference in New Issue
Block a user