1
0
Fork 0
mirror of https://github.com/TheLartians/ModernCppStarter.git synced 2025-09-03 23:50:53 +02:00

do it my way, modernize cmake

build dynamic lib
use makefile wrapper to test all use cases
include clang-tidy config file
prevent clang-tidy warnings
This commit is contained in:
ClausKlein 2021-02-12 18:52:34 +01:00
parent eedcb6f24e
commit 79060d4af6
10 changed files with 128 additions and 50 deletions

View file

@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.14 FATAL_ERROR)
cmake_minimum_required(VERSION 3.14...3.19)
project(GreeterTests LANGUAGES CXX)
@ -57,18 +57,11 @@ endif()
enable_testing()
# Note: doctest and similar testing frameworks can automatically configure CMake tests For other
# testing frameworks add the tests target instead:
if(DEFINED doctest_SOURCE_DIR)
include(${doctest_SOURCE_DIR}/scripts/cmake/doctest.cmake)
doctest_discover_tests(GreeterTests)
else()
add_test(greeterTests GreeterTests)
endif()
add_test(greeterTests GreeterTests)
# ---- code coverage ----
if(ENABLE_TEST_COVERAGE)
if(ENABLE_TEST_COVERAGE AND NOT Greeter_FOUND)
target_compile_options(Greeter PUBLIC -O0 -g -fprofile-arcs -ftest-coverage)
target_link_options(Greeter PUBLIC -fprofile-arcs -ftest-coverage)
endif()

View file

@ -24,8 +24,3 @@ TEST_CASE("Greeter version") {
CHECK(std::string(GREETER_VERSION) == std::string("1.0"));
#endif
}
TEST_CASE("Greeter date") {
const greeter::Greeter greeter("Tests");
CHECK(greeter.getIsoDate() == std::string("03:15:30"));
}