Add tests to check the correct version of the mdlp, folding and json libraries

This commit is contained in:
Ricardo Montañana Gómez 2024-05-12 12:22:44 +02:00
parent 6ab7cd2cbd
commit d8c44b3b7c
Signed by: rmontanana
GPG Key ID: 46064262FD9A7ADE
6 changed files with 44 additions and 4 deletions

View File

@ -16,6 +16,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- A2DE model.
- A2DE & SPnDE tests.
- Add tests to reach 99% of coverage.
- Add tests to check the correct version of the mdlp, folding and json libraries.
### Internal

@ -1 +1 @@
Subproject commit 71d6055be4488cf2e6443123ae8fc4a63ae289dc
Subproject commit 2ac43e32ac1eac0c986702ec526cf5367a565ef0

@ -1 +1 @@
Subproject commit 5708dc3de944fc22d61a2dd071b63aa338e04db3
Subproject commit 236d1b2f8be185039493fe7fce04a83e02ed72e5

View File

@ -9,8 +9,8 @@ if(ENABLE_TESTING)
)
file(GLOB_RECURSE BayesNet_SOURCES "${BayesNet_SOURCE_DIR}/bayesnet/*.cc")
add_executable(TestBayesNet TestBayesNetwork.cc TestBayesNode.cc TestBayesClassifier.cc
TestBayesModels.cc TestBayesMetrics.cc TestFeatureSelection.cc TestBoostAODE.cc TestA2DE.cc
TestUtils.cc TestBayesEnsemble.cc ${BayesNet_SOURCES})
TestBayesModels.cc TestBayesMetrics.cc TestFeatureSelection.cc TestBoostAODE.cc TestA2DE.cc
TestUtils.cc TestBayesEnsemble.cc TestModulesVersions.cc ${BayesNet_SOURCES})
target_link_libraries(TestBayesNet PUBLIC "${TORCH_LIBRARIES}" ArffFiles mdlp PRIVATE Catch2::Catch2WithMain)
add_test(NAME BayesNetworkTest COMMAND TestBayesNet)
add_test(NAME Network COMMAND TestBayesNet "[Network]")
@ -22,4 +22,5 @@ if(ENABLE_TESTING)
add_test(NAME Models COMMAND TestBayesNet "[Models]")
add_test(NAME BoostAODE COMMAND TestBayesNet "[BoostAODE]")
add_test(NAME A2DE COMMAND TestBayesNet "[A2DE]")
add_test(NAME Modules COMMAND TestBayesNet "[Modules]")
endif(ENABLE_TESTING)

View File

@ -0,0 +1,37 @@
// ***************************************************************
// SPDX-FileCopyrightText: Copyright 2024 Ricardo Montañana Gómez
// SPDX-FileType: SOURCE
// SPDX-License-Identifier: MIT
// ***************************************************************
#include <catch2/catch_test_macros.hpp>
#include <catch2/matchers/catch_matchers.hpp>
#include <string>
#include <CPPFImdlp.h>
#include <folding.hpp>
#include <nlohmann/json.hpp>
#define TO_STR2(x) #x
#define TO_STR(x) TO_STR2(x)
#define JSON_VERSION (TO_STR(NLOHMANN_JSON_VERSION_MAJOR) "." TO_STR(NLOHMANN_JSON_VERSION_MINOR))
#include "TestUtils.h"
std::map<std::string, std::string> modules = {
{ "mdlp", "1.1.2" },
{ "Folding", "1.1.0" },
{ "json", "3.11" }
};
TEST_CASE("MDLP", "[Modules]")
{
auto fimdlp = mdlp::CPPFImdlp();
REQUIRE(fimdlp.version() == modules["mdlp"]);
}
TEST_CASE("Folding", "[Modules]")
{
auto folding = folding::KFold(5, 200);
REQUIRE(folding.version() == modules["Folding"]);
}
TEST_CASE("NLOHMANN_JSON", "[Modules]")
{
REQUIRE(JSON_VERSION == modules["json"]);
}

1
tests/lib/catch2 Submodule

@ -0,0 +1 @@
Subproject commit 4e8d92bf02f7d1c8006a0e7a5ecabd8e62d98502