Katja: Add test facilities
This commit is contained in:
parent
67d798dcb0
commit
226dfdbc02
@ -1,11 +1,13 @@
|
|||||||
cmake_minimum_required(VERSION 3.21)
|
cmake_minimum_required(VERSION 3.21)
|
||||||
project(Katja)
|
project(Katja)
|
||||||
|
|
||||||
|
include(CTest)
|
||||||
|
|
||||||
set(CMAKE_EXPORT_COMPILE_COMMANDS 1)
|
set(CMAKE_EXPORT_COMPILE_COMMANDS 1)
|
||||||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
|
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
|
||||||
set(CMAKE_CXX_STANDARD 17)
|
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
|
add_library(backend
|
||||||
katja/database.cpp include/katja/database.hpp
|
katja/database.cpp include/katja/database.hpp
|
||||||
@ -15,6 +17,15 @@ add_library(backend
|
|||||||
target_include_directories(backend PRIVATE include ${Boost_INCLUDE_DIR})
|
target_include_directories(backend PRIVATE include ${Boost_INCLUDE_DIR})
|
||||||
|
|
||||||
add_executable(katja cli/main.cpp)
|
add_executable(katja cli/main.cpp)
|
||||||
target_link_libraries(katja PRIVATE backend)
|
|
||||||
target_include_directories(katja PRIVATE include ${Boost_INCLUDE_DIR})
|
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
9
tests/tester.cpp
Normal 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);
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user