[romi,xrp] Translate unit tests to catch2 (#9012)

This commit is contained in:
Peter Johnson
2026-06-23 08:35:48 -07:00
committed by GitHub
parent a5c92df1f6
commit ada1191265
8 changed files with 19 additions and 12 deletions

View File

@@ -78,7 +78,7 @@ cc_test(
srcs = glob(["src/test/native/cpp/**"]),
deps = [
":romiVendordep",
"//thirdparty/googletest",
"//thirdparty/catch2",
],
)

View File

@@ -29,7 +29,7 @@ install(FILES ${WPILIB_BINARY_DIR}/romivendordep-config.cmake DESTINATION share/
install(EXPORT romivendordep DESTINATION share/romiVendordep)
if(WITH_TESTS)
wpilib_add_test(romiVendordep src/test/native/cpp)
wpilib_add_test_catch2(romiVendordep src/test/native/cpp)
target_include_directories(romiVendordep_test PRIVATE src/test/native/include)
target_link_libraries(romiVendordep_test romiVendordep googletest)
target_link_libraries(romiVendordep_test romiVendordep)
endif()

View File

@@ -1,6 +1,7 @@
ext {
nativeName = 'romiVendordep'
devMain = 'org.wpilib.romi.DevMain'
nativeTestSuiteName = "${nativeName}Catch2Test"
}
evaluationDependsOn(":ntcore")

View File

@@ -2,9 +2,12 @@
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
#include <gtest/gtest.h>
#include <catch2/catch_session.hpp>
#include <catch2/catch_test_macros.hpp>
TEST_CASE("romiVendordep native test binary loads",
"[romi][vendordep][smoke]") {}
int main(int argc, char** argv) {
::testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
return Catch::Session().run(argc, argv);
}

View File

@@ -76,7 +76,7 @@ cc_test(
srcs = glob(["src/test/native/cpp/**"]),
deps = [
":xrpVendordep",
"//thirdparty/googletest",
"//thirdparty/catch2",
],
)

View File

@@ -29,7 +29,7 @@ install(FILES ${WPILIB_BINARY_DIR}/xrpvendordep-config.cmake DESTINATION share/x
install(EXPORT xrpvendordep DESTINATION share/xrpVendordep)
if(WITH_TESTS)
wpilib_add_test(xrpVendordep src/test/native/cpp)
wpilib_add_test_catch2(xrpVendordep src/test/native/cpp)
target_include_directories(xrpVendordep_test PRIVATE src/test/native/include)
target_link_libraries(xrpVendordep_test xrpVendordep googletest)
target_link_libraries(xrpVendordep_test xrpVendordep)
endif()

View File

@@ -1,6 +1,7 @@
ext {
nativeName = 'xrpVendordep'
devMain = 'org.wpilib.xrp.DevMain'
nativeTestSuiteName = "${nativeName}Catch2Test"
}
evaluationDependsOn(":ntcore")

View File

@@ -2,9 +2,11 @@
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
#include <gtest/gtest.h>
#include <catch2/catch_session.hpp>
#include <catch2/catch_test_macros.hpp>
TEST_CASE("xrpVendordep native test binary loads", "[xrp][vendordep][smoke]") {}
int main(int argc, char** argv) {
::testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
return Catch::Session().run(argc, argv);
}