Skip to content

Commit

Permalink
ROS-compatible automated test
Browse files Browse the repository at this point in the history
  • Loading branch information
victorpaleologue committed Nov 13, 2023
1 parent 7de9e38 commit 0d2c38e
Show file tree
Hide file tree
Showing 5 changed files with 58 additions and 58 deletions.
4 changes: 3 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -450,7 +450,9 @@ install(TARGETS qi DESTINATION lib)
install(FILES package.xml DESTINATION share/${PROJECT_NAME})

enable_testing()
add_subdirectory("tests")
if(BUILD_TESTING)
add_subdirectory("tests")
endif()

ament_export_include_directories(include)
ament_export_libraries(qi)
Expand Down
3 changes: 1 addition & 2 deletions package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@

<depend>boost</depend>
<depend>libssl-dev</depend>
<test_depend>libgmock-dev</test_depend>

<test_depend>ament_cmake_gtest</test_depend>
<buildtool_depend>ament_cmake</buildtool_depend>

<export>
Expand Down
5 changes: 3 additions & 2 deletions tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@ add_library(
"qi/testutils/mockutils.hpp"
)

find_package(GTest REQUIRED)
target_link_libraries(qitestutils qi GTest::GTest)
find_package(ament_cmake_gtest REQUIRED)
target_include_directories(qitestutils PUBLIC GTEST_INCLUDE_DIRS)
target_link_libraries(qitestutils PUBLIC qi GTEST_LIBRARIES)

add_subdirectory("ka")
# add_subdirectory("qi")
Expand Down
102 changes: 50 additions & 52 deletions tests/ka/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,55 +1,53 @@
include(CTest)
if(BUILD_TESTING)
find_package(GTest REQUIRED)
find_package(OpenSSL REQUIRED)
find_package(Boost REQUIRED COMPONENTS system thread date_time)
find_package(ament_cmake_gtest REQUIRED)
find_package(OpenSSL REQUIRED)
find_package(Boost REQUIRED COMPONENTS system thread date_time)

add_executable(
test_ka
"ark/test_inputiter.cpp"
"ark/test_mutable.cpp"
"test_algorithm.cpp"
"test_base64.cpp"
"test_conceptpredicate.cpp"
"test_empty.cpp"
"test_errorhandling.cpp"
"test_flatten.cpp"
"test_functor.cpp"
"test_functional.cpp"
"test_functional_common.hpp"
"test_indexed.cpp"
"test_integersequence.cpp"
"test_macro.cpp"
"test_macroregular.cpp"
"test_moveoncopy.cpp"
"test_mutablestore.cpp"
"test_opt.cpp"
"test_iterator.cpp"
"test_parse.cpp"
"test_productiter.cpp"
"test_range.cpp"
"test_relationpredicate.cpp"
"test_scoped.cpp"
"test_sha1.cpp"
"test_src.cpp"
"test_testutils.cpp"
"test_typetraits.cpp"
"test_unit.cpp"
"test_uri.cpp"
"test_uri_parsing.cpp"
"test_utility.cpp"
"test_zero.cpp"
)
ament_add_gtest(
test_ka
"ark/test_inputiter.cpp"
"ark/test_mutable.cpp"
"test_algorithm.cpp"
"test_base64.cpp"
"test_conceptpredicate.cpp"
"test_empty.cpp"
"test_errorhandling.cpp"
"test_flatten.cpp"
"test_functor.cpp"
"test_functional.cpp"
"test_functional_common.hpp"
"test_indexed.cpp"
"test_integersequence.cpp"
"test_macro.cpp"
"test_macroregular.cpp"
"test_moveoncopy.cpp"
"test_mutablestore.cpp"
"test_opt.cpp"
"test_iterator.cpp"
"test_parse.cpp"
"test_productiter.cpp"
"test_range.cpp"
"test_relationpredicate.cpp"
"test_scoped.cpp"
"test_sha1.cpp"
"test_src.cpp"
"test_testutils.cpp"
"test_typetraits.cpp"
"test_unit.cpp"
"test_uri.cpp"
"test_uri_parsing.cpp"
"test_utility.cpp"
"test_zero.cpp"
)

target_link_libraries(
test_ka
${Boost_SYSTEM_LIBRARY} ${Boost_THREAD_LIBRARY} ${Boost_DATE_TIME_LIBRARY}
OpenSSL::Crypto OpenSSL::SSL
GTest::gmock GTest::gmock_main
)
target_include_directories(
test_ka
PRIVATE
${Boost_INCLUDE_DIRS}
$<INSTALL_INTERFACE:include>
)

add_test(
NAME test_ka
COMMAND test_ka
)
endif()
target_link_libraries(
test_ka
${Boost_SYSTEM_LIBRARY} ${Boost_THREAD_LIBRARY} ${Boost_DATE_TIME_LIBRARY}
OpenSSL::Crypto OpenSSL::SSL
)
2 changes: 1 addition & 1 deletion tests/ka/test_uri_parsing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#include <ka/empty.hpp>
#include <boost/range/size.hpp>
#include <boost/range/adaptor/transformed.hpp>
#include <gmock/gmock.h>
#include <gtest/gtest.h>

using namespace ka;
using namespace ka::parse;
Expand Down

0 comments on commit 0d2c38e

Please sign in to comment.