Initial commit
This commit is contained in:
15
tests/CMakeLists.txt
Normal file
15
tests/CMakeLists.txt
Normal file
@ -0,0 +1,15 @@
|
||||
find_package(Boost CONFIG COMPONENTS unit_test_framework REQUIRED)
|
||||
|
||||
file(GLOB KATJA_TEST_SOURCES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.cpp)
|
||||
|
||||
foreach(test_source ${KATJA_TEST_SOURCES})
|
||||
get_filename_component(test_name ${test_source} NAME_WE)
|
||||
set(tester ${test_name}-tester)
|
||||
|
||||
add_executable(${tester} ${test_source})
|
||||
|
||||
target_compile_definitions(${tester} PRIVATE "BOOST_TEST_DYN_LINK=1")
|
||||
target_link_libraries(${tester} LINK_PRIVATE katja Boost::unit_test_framework)
|
||||
|
||||
add_test(NAME ${test_name} COMMAND ${tester})
|
||||
endforeach()
|
14
tests/database.cpp
Normal file
14
tests/database.cpp
Normal file
@ -0,0 +1,14 @@
|
||||
#define BOOST_TEST_MODULE database tests
|
||||
|
||||
#include <boost/test/unit_test.hpp>
|
||||
#include "katja/database.hpp"
|
||||
|
||||
BOOST_AUTO_TEST_CASE(generate_package_identifier)
|
||||
{
|
||||
katja::database_package actual("libarchive-3.7.8-i586-1_slack15.0");
|
||||
|
||||
BOOST_TEST(actual.name == "libarchive");
|
||||
BOOST_TEST(actual.version == "3.7.8");
|
||||
BOOST_TEST(actual.architecture == "i586");
|
||||
BOOST_TEST(actual.build_tag == "1_slack15.0");
|
||||
}
|
13
tests/repository.cpp
Normal file
13
tests/repository.cpp
Normal file
@ -0,0 +1,13 @@
|
||||
#define BOOST_TEST_MODULE repository tests
|
||||
|
||||
#include <boost/test/unit_test.hpp>
|
||||
#include "katja/repository.hpp"
|
||||
|
||||
BOOST_AUTO_TEST_CASE(construct_valid_database_package)
|
||||
{
|
||||
katja::package_identifier given{ "libarchive", "3.7.8", "i586", "slackware" };
|
||||
std::string actual = given.to_string();
|
||||
std::string expected = "libarchive;3.7.8;i586;slackware";
|
||||
|
||||
BOOST_TEST(actual == expected);
|
||||
}
|
Reference in New Issue
Block a user