Update gcovr config and fix some warnings

This commit is contained in:
Ricardo Montañana Gómez 2024-02-28 11:51:37 +01:00
parent 20669dd161
commit d6af1ffe8e
Signed by: rmontanana
GPG Key ID: 46064262FD9A7ADE
7 changed files with 11 additions and 9 deletions

View File

@ -5,6 +5,7 @@ Checks: '-*,
cppcoreguidelines-*,
modernize-*,
performance-*,
-modernize-use-nodiscard,
-cppcoreguidelines-pro-type-vararg,
-modernize-use-trailing-return-type,
-bugprone-exception-escape'

View File

@ -44,11 +44,11 @@ endif (CMAKE_BUILD_TYPE STREQUAL "Debug")
if (CODE_COVERAGE)
enable_testing()
include(CodeCoverage)
MESSAGE("Code coverage enabled")
set(CMAKE_CXX_FLAGS " ${CMAKE_CXX_FLAGS} -fprofile-arcs -ftest-coverage -O0 -g")
SET(GCC_COVERAGE_LINK_FLAGS " ${GCC_COVERAGE_LINK_FLAGS} -lgcov --coverage")
enable_testing()
include(CodeCoverage)
MESSAGE("Code coverage enabled")
set(CMAKE_CXX_FLAGS " ${CMAKE_CXX_FLAGS} -fprofile-arcs -ftest-coverage -O0 -g")
SET(GCC_COVERAGE_LINK_FLAGS " ${GCC_COVERAGE_LINK_FLAGS} -lgcov --coverage")
endif (CODE_COVERAGE)
if (ENABLE_CLANG_TIDY)

View File

@ -1,4 +1,4 @@
filter = src/
exclude-directories = build_debug/lib/
print-summary = yes
sort-percentage = yes
sort = uncovered-percent

View File

@ -71,7 +71,7 @@ namespace bayesnet {
for (Node* child : nodes[nodeId]->getChildren()) {
if (visited.find(child->getName()) == visited.end() && isCyclic(child->getName(), visited, recStack))
return true;
else if (recStack.find(child->getName()) != recStack.end())
if (recStack.find(child->getName()) != recStack.end())
return true;
}
}

View File

@ -50,7 +50,6 @@ namespace bayesnet {
}
double FeatureSelect::computeMeritCFS()
{
double result;
double rcf = 0;
for (auto feature : selectedFeatures) {
rcf += suLabels[feature];

View File

@ -28,7 +28,7 @@ namespace bayesnet {
selectedFeatures.push_back(feature);
// Compute merit with selectedFeatures
auto meritNew = computeMeritCFS();
double delta = merit != 0.0 ? abs(merit - meritNew) / merit : 0.0;
double delta = merit != 0.0 ? std::abs(merit - meritNew) / merit : 0.0;
if (meritNew > merit || delta < threshold) {
if (meritNew > merit) {
merit = meritNew;

View File

@ -224,6 +224,8 @@ TEST_CASE("BoostAODE voting-proba", "[BayesNet]")
REQUIRE(score_voting == Catch::Approx(0.98).epsilon(raw.epsilon));
REQUIRE(pred_voting[83][2] == Catch::Approx(0.552091).epsilon(raw.epsilon));
REQUIRE(pred_proba[83][2] == Catch::Approx(0.546017).epsilon(raw.epsilon));
clf.dump_cpt();
REQUIRE(clf.topological_order() == std::vector<std::string>());
}
TEST_CASE("BoostAODE order asc, desc & random", "[BayesNet]")
{