From c1c7e322913ba2c3f0135a977d9e081405cd474e Mon Sep 17 00:00:00 2001 From: Martin Brodbeck Date: Wed, 11 Jul 2018 12:54:33 +0200 Subject: [PATCH] new test cases for article --- test/CMakeLists.txt | 4 ++++ test/test_article.cpp | 21 +++++++++++++++++++++ 2 files changed, 25 insertions(+) create mode 100644 test/test_article.cpp diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 2c68a6d..382580f 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -4,6 +4,10 @@ add_executable(test_seller test_seller.cpp) target_link_libraries(test_seller core Boost::unit_test_framework) 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) target_link_libraries(test_database core Boost::unit_test_framework stdc++fs) add_test(NAME Database COMMAND ${CMAKE_BINARY_DIR}/bin/test_database) diff --git a/test/test_article.cpp b/test/test_article.cpp new file mode 100644 index 0000000..e0792ad --- /dev/null +++ b/test/test_article.cpp @@ -0,0 +1,21 @@ +#define BOOST_TEST_MODULE article + +#include "../src/core/article.h" + +#include + +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(); + article.setSale(salePtr); + BOOST_TEST(article.isSold() == true); +} \ No newline at end of file