[wpinet] Translate unit tests to catch2 (#8954)

This commit is contained in:
Peter Johnson
2026-06-19 21:49:50 -05:00
committed by GitHub
parent cfab47e871
commit 396b553069
27 changed files with 952 additions and 776 deletions

View File

@@ -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()