Skip to content

Commit

Permalink
Merge pull request #6 from threeal/test-coverage
Browse files Browse the repository at this point in the history
Test for Code Coverage
  • Loading branch information
threeal authored Dec 26, 2022
2 parents 9d0384d + c926cee commit 37aa887
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
7 changes: 7 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,10 @@ jobs:

- name: Run tests
run: ctest --test-dir build --verbose

- name: Install gcovr
run: pip3 install gcovr

- name: Test for code coverage
run: gcovr -e 'build/*' --fail-under-line 80

3 changes: 3 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,12 @@ target_include_directories(example PUBLIC include)

if(BUILD_TESTING)
enable_testing()

cpmaddpackage("gh:catchorg/Catch2@3.2.0")
include("${Catch2_SOURCE_DIR}/extras/Catch.cmake")

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fprofile-arcs -ftest-coverage -fPIC -O0")

add_executable(example_test test/example_test.cpp)
target_link_libraries(example_test PRIVATE example Catch2::Catch2WithMain)
catch_discover_tests(example_test)
Expand Down

0 comments on commit 37aa887

Please sign in to comment.