Katja: Add test facilities

This commit is contained in:
Eugen Wissner 2025-03-18 16:14:12 +01:00
parent 67d798dcb0
commit 226dfdbc02
Signed by: belka
GPG Key ID: A27FDC1E8EE902C0
2 changed files with 23 additions and 3 deletions

View File

@ -1,11 +1,13 @@
cmake_minimum_required(VERSION 3.21)
project(Katja)
include(CTest)
set(CMAKE_EXPORT_COMPILE_COMMANDS 1)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
set(CMAKE_CXX_STANDARD 17)
find_package(Boost CONFIG COMPONENTS process program_options REQUIRED)
find_package(Boost CONFIG COMPONENTS unit_test_framework REQUIRED)
add_library(backend
katja/database.cpp include/katja/database.hpp
@ -15,6 +17,15 @@ add_library(backend
target_include_directories(backend PRIVATE include ${Boost_INCLUDE_DIR})
add_executable(katja cli/main.cpp)
target_link_libraries(katja PRIVATE backend)
target_include_directories(katja PRIVATE include ${Boost_INCLUDE_DIR})
target_link_libraries(katja LINK_PUBLIC ${Boost_LIBRARIES})
target_link_libraries(katja LINK_PUBLIC backend)
if(BUILD_TESTING)
add_executable(tester tests/tester.cpp)
target_include_directories(tester PRIVATE include ${Boost_INCLUDE_DIR})
target_compile_definitions(tester PRIVATE "BOOST_TEST_DYN_LINK=1")
target_link_libraries(tester LINK_PRIVATE backend Boost::unit_test_framework)
add_test(NAME tester COMMAND tester)
endif()

9
tests/tester.cpp Normal file
View File

@ -0,0 +1,9 @@
#define BOOST_TEST_MODULE unit tests
#include <boost/test/unit_test.hpp>
#include "katja/repository.hpp"
BOOST_AUTO_TEST_CASE(construct_valid_database_package)
{
BOOST_TEST(true);
}