First approach

This commit is contained in:
2025-06-29 18:46:11 +02:00
parent 676637fb1b
commit 31fa9cd498
10 changed files with 417 additions and 10 deletions

View File

@@ -0,0 +1,9 @@
cmake_minimum_required(VERSION 3.27)
project(test_bayesnet)
set(CMAKE_CXX_STANDARD 17)
find_package(bayesnet REQUIRED)
add_executable(test_bayesnet test_bayesnet.cpp)
target_link_libraries(test_bayesnet bayesnet::bayesnet)

26
test_package/conanfile.py Normal file
View File

@@ -0,0 +1,26 @@
from conan import ConanFile
from conan.tools.cmake import CMake, cmake_layout
from conan.tools.build import can_run
import os
class BayesNetTestConan(ConanFile):
settings = "os", "compiler", "build_type", "arch"
def requirements(self):
self.requires(self.tested_reference_str)
def build_requirements(self):
self.build_requires("cmake/[>=3.27]")
def layout(self):
cmake_layout(self)
def build(self):
cmake = CMake(self)
cmake.configure()
cmake.build()
def test(self):
if can_run(self):
cmd = os.path.join(self.cpp.build.bindirs[0], "test_bayesnet")
self.run(cmd, env="conanrun")

View File

@@ -0,0 +1,26 @@
#include <iostream>
#include <bayesnet/BaseClassifier.h>
#include <bayesnet/classifiers/TAN.h>
#include <bayesnet/network/Network.h>
int main() {
std::cout << "Testing BayesNet library integration..." << std::endl;
try {
// Test basic instantiation
bayesnet::Network network;
std::cout << "✓ Network class instantiated successfully" << std::endl;
// Test TAN classifier instantiation
bayesnet::TAN tan;
std::cout << "✓ TAN classifier instantiated successfully" << std::endl;
std::cout << "✓ All basic tests passed!" << std::endl;
std::cout << "BayesNet library is working correctly." << std::endl;
return 0;
} catch (const std::exception& e) {
std::cerr << "✗ Test failed: " << e.what() << std::endl;
return 1;
}
}