From 3687d8104fa01e23b2764dce833f07fb68360ed4 Mon Sep 17 00:00:00 2001 From: Michal Cieslar Date: Sat, 29 Jun 2024 16:09:51 +0200 Subject: [PATCH] fix: fix coverage --- CMakeLists.txt | 74 ++++++++++++++++++++++---------------------- tests/CMakeLists.txt | 15 ++++++--- 2 files changed, 47 insertions(+), 42 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index fb1188e39..06223014f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -23,43 +23,43 @@ if (BUILD_TESTING) endif () set(FAKER_SOURCES - src/modules/airline/Airline.cpp - src/modules/animal/Animal.cpp - src/modules/book/Book.cpp - src/modules/color/Color.cpp - src/modules/commerce/Commerce.cpp - src/modules/company/Company.cpp - src/modules/computer/Computer.cpp - src/modules/crypto/Crypto.cpp - src/modules/database/Database.cpp - src/modules/datatype/Datatype.cpp - src/modules/date/Date.cpp - src/modules/finance/Finance.cpp - src/modules/food/Food.cpp - src/modules/git/Git.cpp - src/modules/hacker/Hacker.cpp - src/modules/helper/Helper.cpp - src/modules/image/Image.cpp - src/modules/internet/Internet.cpp - src/modules/location/Location.cpp - src/modules/lorem/Lorem.cpp - src/modules/medicine/Medicine.cpp - src/modules/movie/Movie.cpp - src/modules/music/Music.cpp - src/modules/person/Person.cpp - src/modules/phone/Phone.cpp - src/modules/plant/Plant.cpp - src/modules/science/Science.cpp - src/modules/sport/Sport.cpp - src/modules/string/String.cpp - src/modules/system/System.cpp - src/modules/vehicle/Vehicle.cpp - src/modules/videoGame/VideoGame.cpp - src/modules/weather/Weather.cpp - src/modules/word/Word.cpp - src/common/FormatHelper.cpp - src/common/LuhnCheck.cpp - src/common/StringHelper.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/src/modules/airline/Airline.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/src/modules/animal/Animal.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/src/modules/book/Book.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/src/modules/color/Color.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/src/modules/commerce/Commerce.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/src/modules/company/Company.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/src/modules/computer/Computer.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/src/modules/crypto/Crypto.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/src/modules/database/Database.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/src/modules/datatype/Datatype.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/src/modules/date/Date.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/src/modules/finance/Finance.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/src/modules/food/Food.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/src/modules/git/Git.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/src/modules/hacker/Hacker.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/src/modules/helper/Helper.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/src/modules/image/Image.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/src/modules/internet/Internet.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/src/modules/location/Location.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/src/modules/lorem/Lorem.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/src/modules/medicine/Medicine.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/src/modules/movie/Movie.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/src/modules/music/Music.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/src/modules/person/Person.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/src/modules/phone/Phone.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/src/modules/plant/Plant.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/src/modules/science/Science.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/src/modules/sport/Sport.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/src/modules/string/String.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/src/modules/system/System.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/src/modules/vehicle/Vehicle.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/src/modules/videoGame/VideoGame.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/src/modules/weather/Weather.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/src/modules/word/Word.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/src/common/FormatHelper.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/src/common/LuhnCheck.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/src/common/StringHelper.cpp ) add_library(${CMAKE_PROJECT_NAME} ${FAKER_SOURCES}) diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 3c9d088c0..7b1ee8378 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -1,5 +1,5 @@ cmake_minimum_required(VERSION 3.22) -project(${CMAKE_PROJECT_NAME}-UT CXX) +project(${CMAKE_PROJECT_NAME}-UT LANGUAGES CXX) include(CTest) include("${CMAKE_SOURCE_DIR}/cmake/CompilerWarnings.cmake") @@ -45,7 +45,10 @@ set(FAKER_UT_SOURCES modules/word/WordTest.cpp ) -add_executable(${PROJECT_NAME} ${FAKER_UT_SOURCES}) +add_executable(${PROJECT_NAME} ${FAKER_UT_SOURCES} ${FAKER_SOURCES}) + +target_compile_features(${PROJECT_NAME} PUBLIC cxx_std_20) + configure_compiler_warnings(${PROJECT_NAME} "${WARNINGS_AS_ERRORS}" "${MSVC_WARNINGS}" @@ -53,21 +56,23 @@ configure_compiler_warnings(${PROJECT_NAME} "${GCC_WARNINGS}") target_include_directories(${PROJECT_NAME} PRIVATE + ${CMAKE_SOURCE_DIR}/include ${CMAKE_SOURCE_DIR}/src ${CMAKE_SOURCE_DIR}/src/common ${CMAKE_SOURCE_DIR}/src/modules + ${CMAKE_BINARY_DIR}/include ) if (USE_SYSTEM_DEPENDENCIES) find_package(GTest REQUIRED) - target_link_libraries(${PROJECT_NAME} PRIVATE GTest::gtest GTest::gtest_main GTest::gmock GTest::gmock_main faker-cxx) + target_link_libraries(${PROJECT_NAME} PRIVATE GTest::gtest GTest::gtest_main GTest::gmock GTest::gmock_main) else () add_subdirectory("${CMAKE_SOURCE_DIR}/externals/googletest" "${CMAKE_BINARY_DIR}/googletest") set(GTEST_INCLUDE_DIR "${CMAKE_SOURCE_DIR}/externals/googletest/googletest/include") set(GMOCK_INCLUDE_DIR "${CMAKE_SOURCE_DIR}/externals/googletest/googlemock/include") - target_link_libraries(${PROJECT_NAME} PRIVATE gtest_main gmock_main faker-cxx) + target_link_libraries(${PROJECT_NAME} PRIVATE gtest_main gmock_main) endif () if (HAS_STD_FORMAT) @@ -80,6 +85,6 @@ endif () add_test(NAME ${PROJECT_NAME} COMMAND ${PROJECT_NAME} WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}) set_tests_properties(${PROJECT_NAME} PROPERTIES ENVIRONMENT_MODIFICATION - "PATH=path_list_prepend:$<$:$>") + "PATH=path_list_prepend:$<$:$>") target_code_coverage(${PROJECT_NAME} ALL)