define core tests through macros (#299)

Maybe it makes sense to define this in an exported config,
but then why bother until someone needs it.
This commit is contained in:
Michael Görner 2021-10-04 22:27:34 +02:00 committed by GitHub
parent e89c68ced0
commit 8b2ac94609
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -9,29 +9,28 @@ if (CATKIN_ENABLE_TESTING)
add_library(gtest_utils gtest_value_printers.cpp models.cpp stage_mockups.cpp) add_library(gtest_utils gtest_value_printers.cpp models.cpp stage_mockups.cpp)
target_link_libraries(gtest_utils ${PROJECT_NAME}) target_link_libraries(gtest_utils ${PROJECT_NAME})
catkin_add_gtest(${PROJECT_NAME}-test-stage test_stage.cpp) macro(mtc_add_test TYPE FILE)
target_link_libraries(${PROJECT_NAME}-test-stage ${PROJECT_NAME} ${PROJECT_NAME}_stages gtest_utils gtest_main) string(REGEX REPLACE "\.cpp$" "" TEST_NAME ${FILE})
string(REGEX REPLACE "_" "-" TEST_NAME ${TEST_NAME})
_catkin_add_google_test(${TYPE} ${PROJECT_NAME}-${TEST_NAME} ${FILE})
target_link_libraries(${PROJECT_NAME}-${TEST_NAME} ${PROJECT_NAME} ${PROJECT_NAME}_stages ${ARGN} gtest_utils gtest_main)
endmacro()
macro(mtc_add_gtest)
mtc_add_test("gtest" ${ARGN})
endmacro()
macro(mtc_add_gmock)
mtc_add_test("gmock" ${ARGN})
endmacro()
catkin_add_gtest(${PROJECT_NAME}-test-container test_container.cpp) mtc_add_gtest(test_stage.cpp)
target_link_libraries(${PROJECT_NAME}-test-container ${PROJECT_NAME} ${PROJECT_NAME}_stages gtest_utils gtest_main) mtc_add_gtest(test_container.cpp)
mtc_add_gtest(test_serial.cpp)
mtc_add_gtest(test_properties.cpp)
mtc_add_gtest(test_cost_terms.cpp)
catkin_add_gtest(${PROJECT_NAME}-test-serial test_serial.cpp) mtc_add_gmock(test_fallback.cpp)
target_link_libraries(${PROJECT_NAME}-test-serial ${PROJECT_NAME} ${PROJECT_NAME}_stages gtest_utils gtest_main) mtc_add_gmock(test_cost_queue.cpp)
mtc_add_gmock(test_interface_state.cpp)
catkin_add_gmock(${PROJECT_NAME}-test-fallback test_fallback.cpp)
target_link_libraries(${PROJECT_NAME}-test-fallback ${PROJECT_NAME} ${PROJECT_NAME}_stages gtest_utils gtest_main)
catkin_add_gtest(${PROJECT_NAME}-test-properties test_properties.cpp)
target_link_libraries(${PROJECT_NAME}-test-properties ${PROJECT_NAME} gtest_main)
catkin_add_gmock(${PROJECT_NAME}-test-cost_queue test_cost_queue.cpp)
target_link_libraries(${PROJECT_NAME}-test-cost_queue ${PROJECT_NAME} gtest_main)
catkin_add_gmock(${PROJECT_NAME}-test-interface_state test_interface_state.cpp)
target_link_libraries(${PROJECT_NAME}-test-interface_state ${PROJECT_NAME} gtest_utils gtest_main)
catkin_add_gtest(${PROJECT_NAME}-test-cost_terms test_cost_terms.cpp)
target_link_libraries(${PROJECT_NAME}-test-cost_terms ${PROJECT_NAME} ${PROJECT_NAME}_stages gtest_utils gtest_main)
# building these integration tests works without moveit config packages # building these integration tests works without moveit config packages
add_executable(pick_ur5 pick_ur5.cpp) add_executable(pick_ur5 pick_ur5.cpp)