mirror of
https://github.com/Doctorado-ML/FImdlp.git
synced 2025-08-18 08:55:51 +00:00
Add coverage support to cpp tests
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -132,3 +132,4 @@ cfimdlp.cpp
|
|||||||
**/.idea/*
|
**/.idea/*
|
||||||
cmake-build-debug
|
cmake-build-debug
|
||||||
cmake-build-debug/**
|
cmake-build-debug/**
|
||||||
|
**/lcoverage/**
|
||||||
|
3
Makefile
3
Makefile
@@ -10,6 +10,9 @@ clean: ## Clean up
|
|||||||
test:
|
test:
|
||||||
cd fimdlp/testcpp && ./test
|
cd fimdlp/testcpp && ./test
|
||||||
|
|
||||||
|
coverage:
|
||||||
|
cd fimdlp/testcpp && ./cover
|
||||||
|
|
||||||
lint: ## Lint and static-check
|
lint: ## Lint and static-check
|
||||||
black fimdlp
|
black fimdlp
|
||||||
flake8 fimdlp
|
flake8 fimdlp
|
||||||
|
Binary file not shown.
@@ -3,20 +3,10 @@ project(FImdlp)
|
|||||||
|
|
||||||
# GoogleTest requires at least C++14
|
# GoogleTest requires at least C++14
|
||||||
set(CMAKE_CXX_STANDARD 14)
|
set(CMAKE_CXX_STANDARD 14)
|
||||||
|
|
||||||
include(FetchContent)
|
include(FetchContent)
|
||||||
include_directories(
|
|
||||||
/Users/rmontanana/Code/FImdlp/fimdlp/testcpp/build/_deps/googletest-src
|
include_directories(${GTEST_INCLUDE_DIRS})
|
||||||
/Users/rmontanana/Code/FImdlp/fimdlp/testcpp/build/_deps/googletest-src/googletest
|
|
||||||
/Users/rmontanana/Code/FImdlp/fimdlp/testcpp/build/_deps/googletest-src/googletest/include
|
|
||||||
/Users/rmontanana/Code/FImdlp/fimdlp/testcpp/build/_deps/googletest-src/googletest/src
|
|
||||||
/Users/rmontanana/Code/FImdlp/fimdlp/testcpp/build/_deps/googletest-src/googletest/test/
|
|
||||||
/Users/rmontanana/Code/FImdlp/fimdlp/testcpp/build/_deps/googletest-src/googlemock
|
|
||||||
/Users/rmontanana/Code/FImdlp/fimdlp/testcpp/build/_deps/googletest-src/googlemock/include
|
|
||||||
/Users/rmontanana/Code/FImdlp/fimdlp/testcpp/build/_deps/googletest-src/googlemock/test
|
|
||||||
/Library/Frameworks/Python.framework/Versions/Current/
|
|
||||||
)
|
|
||||||
#include_directories(/Users/rmontanana/Code/FImdlp/fimdlp/testcpp/googletest-release-1.12.1/googletest/include /Users/rmontanana/Code/FImdlp/fimdlp/testcpp/googletest-release-1.12.1/googletest)
|
|
||||||
FetchContent_Declare(
|
FetchContent_Declare(
|
||||||
googletest
|
googletest
|
||||||
URL https://github.com/google/googletest/archive/03597a01ee50ed33e9dfd640b249b4be3799d395.zip
|
URL https://github.com/google/googletest/archive/03597a01ee50ed33e9dfd640b249b4be3799d395.zip
|
||||||
@@ -31,8 +21,13 @@ add_executable(Metrics_unittest ../Metrics.cpp Metrics_unittest.cc)
|
|||||||
add_executable(FImdlp_unittest ../CPPFImdlp.cpp ../Metrics.cpp FImdlp_unittest.cc)
|
add_executable(FImdlp_unittest ../CPPFImdlp.cpp ../Metrics.cpp FImdlp_unittest.cc)
|
||||||
target_link_libraries(Metrics_unittest GTest::gtest_main)
|
target_link_libraries(Metrics_unittest GTest::gtest_main)
|
||||||
target_link_libraries(FImdlp_unittest GTest::gtest_main)
|
target_link_libraries(FImdlp_unittest GTest::gtest_main)
|
||||||
|
target_compile_options(Metrics_unittest PRIVATE --coverage)
|
||||||
|
target_compile_options(FImdlp_unittest PRIVATE --coverage)
|
||||||
|
target_link_options(Metrics_unittest PRIVATE --coverage)
|
||||||
|
target_link_options(FImdlp_unittest PRIVATE --coverage)
|
||||||
|
# -fprofile-arcs -ftest-coverage
|
||||||
|
|
||||||
include(GoogleTest)
|
include(GoogleTest)
|
||||||
gtest_discover_tests(Metrics_unittest)
|
gtest_discover_tests(Metrics_unittest)
|
||||||
gtest_discover_tests(FImdlp_unittest)
|
gtest_discover_tests(FImdlp_unittest)
|
||||||
|
|
||||||
|
4
fimdlp/testcpp/cover
Executable file
4
fimdlp/testcpp/cover
Executable file
@@ -0,0 +1,4 @@
|
|||||||
|
rm -fr lcoverage/*
|
||||||
|
lcov --capture --directory ./ --output-file lcoverage/main_coverage.info
|
||||||
|
genhtml lcoverage/main_coverage.info --output-directory lcoverage
|
||||||
|
open lcoverage/index.html
|
Reference in New Issue
Block a user