library comile complete and begin tests
Some checks failed
CI/CD Pipeline / Create Release Package (push) Has been cancelled
CI/CD Pipeline / Code Linting (push) Has been cancelled
CI/CD Pipeline / Build and Test (Debug, clang, ubuntu-latest) (push) Has been cancelled
CI/CD Pipeline / Build and Test (Debug, gcc, ubuntu-latest) (push) Has been cancelled
CI/CD Pipeline / Build and Test (Release, clang, ubuntu-20.04) (push) Has been cancelled
CI/CD Pipeline / Build and Test (Release, clang, ubuntu-latest) (push) Has been cancelled
CI/CD Pipeline / Build and Test (Release, gcc, ubuntu-20.04) (push) Has been cancelled
CI/CD Pipeline / Build and Test (Release, gcc, ubuntu-latest) (push) Has been cancelled
CI/CD Pipeline / Docker Build Test (push) Has been cancelled
CI/CD Pipeline / Performance Benchmarks (push) Has been cancelled
CI/CD Pipeline / Build Documentation (push) Has been cancelled

This commit is contained in:
2025-06-23 12:05:35 +02:00
parent e07eb4d2ed
commit 7b27d5c1f3
9 changed files with 361 additions and 172 deletions

View File

@@ -23,16 +23,31 @@ target_link_libraries(svm_classifier_tests
PRIVATE
svm_classifier
Catch2::Catch2WithMain
nlohmann_json::nlohmann_json
)
# Set include directories
# Set include directories - Handle external libraries dynamically
target_include_directories(svm_classifier_tests
PRIVATE
${CMAKE_SOURCE_DIR}/include
${CMAKE_SOURCE_DIR}/external/libsvm
${CMAKE_SOURCE_DIR}/external/liblinear
)
# Add libsvm include directory if available
if(EXISTS "${CMAKE_CURRENT_BINARY_DIR}/../_deps/libsvm-src")
target_include_directories(svm_classifier_tests
PRIVATE "${CMAKE_CURRENT_BINARY_DIR}/../_deps/libsvm-src"
)
endif()
# Add liblinear include directories if available
if(EXISTS "${CMAKE_CURRENT_BINARY_DIR}/../_deps/liblinear-src")
target_include_directories(svm_classifier_tests
PRIVATE
"${CMAKE_CURRENT_BINARY_DIR}/../_deps/liblinear-src"
"${CMAKE_CURRENT_BINARY_DIR}/../_deps/liblinear-src/blas"
)
endif()
# Compiler flags for tests
target_compile_features(svm_classifier_tests PRIVATE cxx_std_17)

View File

@@ -7,6 +7,10 @@
#include <svm_classifier/data_converter.hpp>
#include <torch/torch.h>
// Include the actual headers for complete struct definitions
#include "svm.h" // libsvm structures
#include "linear.h" // liblinear structures
using namespace svm_classifier;
TEST_CASE("DataConverter Basic Functionality", "[unit][data_converter]")

View File

@@ -10,7 +10,13 @@
#include <iostream>
#include <iomanip>
// Include the actual headers for complete struct definitions
#include "svm.h" // libsvm structures
#include "linear.h" // liblinear structures
#include <nlohmann/json.hpp>
using namespace svm_classifier;
using json = nlohmann::json;
/**
* @brief Generate large synthetic dataset for performance testing

View File

@@ -283,7 +283,7 @@ TEST_CASE("SVMClassifier Prediction", "[integration][svm_classifier]")
REQUIRE(predictions.size(0) == X_test.size(0));
// Check that predictions are valid class labels
auto unique_preds = torch::unique(predictions);
auto unique_preds = std::get<0>(at::_unique(predictions));
for (int i = 0; i < unique_preds.size(0); ++i) {
int pred_class = unique_preds[i].item<int>();
auto classes = svm.get_classes();