Skip to content

Commit

Permalink
Add RapidCheck library to CMake dependencies
Browse files Browse the repository at this point in the history
We agreed to use RapidCheck for testing as it is improvement with no
cost, it also integrates well with current GoogleTest/GTest stack.

Signed-off-by: Leonard Ossa <[email protected]>
  • Loading branch information
leoossa authored and Jenkins-dev committed Nov 20, 2024
1 parent 66f6689 commit 2509ed5
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 18 deletions.
43 changes: 26 additions & 17 deletions cmake/dlgoogletest.cmake
Original file line number Diff line number Diff line change
@@ -1,20 +1,29 @@
if (MSVC)
find_package(GTest CONFIG REQUIRED)
set(GTEST_LIB GTest::gtest_main)
else()
set(GTEST_LIB gtest_main)
if(NOT OVPN_GTEST_VERSION)
# renovate: datasource=github-releases depName=google/googletest
set(OVPN_GTEST_VERSION v1.15.0)
endif()
include(FetchContent)

set(RC_ENABLE_GTEST
ON
CACHE BOOL "Rapidcheck GTest Support" FORCE)
FetchContent_Declare(
rapidcheck
GIT_REPOSITORY https://github.com/emil-e/rapidcheck.git
GIT_TAG ff6af6fc683159deb51c543b065eba14dfcf329b # master Dec 14, 2023
)

include(FetchContent)
if(MSVC)
find_package(GTest CONFIG REQUIRED)
set(GTEST_LIB GTest::gtest_main)
else()
set(GTEST_LIB gtest_main)
if(NOT OVPN_GTEST_VERSION)
# renovate: datasource=github-releases depName=google/googletest
set(OVPN_GTEST_VERSION v1.15.0)
endif()

FetchContent_Declare(
googletest
GIT_REPOSITORY https://github.com/google/googletest.git
GIT_TAG ${OVPN_GTEST_VERSION}
)
FetchContent_MakeAvailable(googletest)
FetchContent_Declare(
googletest
GIT_REPOSITORY https://github.com/google/googletest.git
GIT_TAG ${OVPN_GTEST_VERSION})
FetchContent_MakeAvailable(googletest)
endif()

endif ()
FetchContent_MakeAvailable(rapidcheck)
2 changes: 1 addition & 1 deletion test/unittests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ else ()
message("lzo not found, skipping lzo compression tests")
endif ()

target_link_libraries(coreUnitTests ${GTEST_LIB} GTest::gmock ${EXTRA_LIBS})
target_link_libraries(coreUnitTests ${GTEST_LIB} GTest::gmock rapidcheck rapidcheck_gtest ${EXTRA_LIBS})

target_compile_definitions(coreUnitTests PRIVATE ${CORE_TEST_DEFINES})
target_include_directories(coreUnitTests PRIVATE ${EXTRA_INCLUDES})
Expand Down

0 comments on commit 2509ed5

Please sign in to comment.