new test cases for article

This commit is contained in:
Martin Brodbeck 2018-07-11 12:54:33 +02:00
parent 94edacc6e6
commit c1c7e32291
2 changed files with 25 additions and 0 deletions

View file

@ -4,6 +4,10 @@ add_executable(test_seller test_seller.cpp)
target_link_libraries(test_seller core Boost::unit_test_framework) target_link_libraries(test_seller core Boost::unit_test_framework)
add_test(NAME Seller COMMAND ${CMAKE_BINARY_DIR}/bin/test_seller) add_test(NAME Seller COMMAND ${CMAKE_BINARY_DIR}/bin/test_seller)
add_executable(test_article test_article.cpp)
target_link_libraries(test_article core Boost::unit_test_framework)
add_test(NAME Article COMMAND ${CMAKE_BINARY_DIR}/bin/test_article)
add_executable(test_database test_database.cpp) add_executable(test_database test_database.cpp)
target_link_libraries(test_database core Boost::unit_test_framework stdc++fs) target_link_libraries(test_database core Boost::unit_test_framework stdc++fs)
add_test(NAME Database COMMAND ${CMAKE_BINARY_DIR}/bin/test_database) add_test(NAME Database COMMAND ${CMAKE_BINARY_DIR}/bin/test_database)

21
test/test_article.cpp Normal file
View file

@ -0,0 +1,21 @@
#define BOOST_TEST_MODULE article
#include "../src/core/article.h"
#include <boost/test/included/unit_test.hpp>
BOOST_AUTO_TEST_CASE(create_article)
{
Article article{};
BOOST_TEST(article.getUuid().is_nil() == true);
}
BOOST_AUTO_TEST_CASE(check_is_sold)
{
Article article{};
BOOST_TEST(article.isSold() == false);
auto salePtr = std::make_shared<Sale>();
article.setSale(salePtr);
BOOST_TEST(article.isSold() == true);
}