more on database (tests)
This commit is contained in:
parent
53666163b4
commit
eeae4fe609
4 changed files with 27 additions and 23 deletions
|
@ -2,8 +2,8 @@ find_package(Boost COMPONENTS unit_test_framework REQUIRED)
|
|||
|
||||
add_executable(test_seller test_seller.cpp)
|
||||
target_link_libraries(test_seller core Boost::unit_test_framework)
|
||||
add_test(Seller ${CMAKE_BINARY_DIR}/bin/test_seller)
|
||||
add_test(NAME Seller COMMAND ${CMAKE_BINARY_DIR}/bin/test_seller)
|
||||
|
||||
add_executable(test_database test_database.cpp)
|
||||
target_link_libraries(test_database core Boost::unit_test_framework stdc++fs)
|
||||
add_test(Database ${CMAKE_BINARY_DIR}/bin/test_database)
|
||||
add_test(NAME Database COMMAND ${CMAKE_BINARY_DIR}/bin/test_database)
|
||||
|
|
|
@ -6,11 +6,20 @@
|
|||
|
||||
#include <boost/test/included/unit_test.hpp>
|
||||
|
||||
//using namespace boost::unit_test;
|
||||
BOOST_AUTO_TEST_CASE(create_database)
|
||||
{
|
||||
std::filesystem::path testPath = std::filesystem::temp_directory_path() / "kima2test.db";
|
||||
if (std::filesystem::exists(testPath)) {
|
||||
std::filesystem::remove(testPath);
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE( create_database ) {
|
||||
std::filesystem::path testPath = std::filesystem::temp_directory_path() / "test.db";
|
||||
Database db(testPath.c_str());
|
||||
std::string filename = testPath.generic_string();
|
||||
|
||||
Database db(filename);
|
||||
db.init();
|
||||
std::filesystem::remove(testPath);
|
||||
|
||||
BOOST_TEST(std::filesystem::exists(testPath) == true);
|
||||
if (std::filesystem::exists(testPath)) {
|
||||
std::filesystem::remove(testPath);
|
||||
}
|
||||
}
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
#include <boost/test/included/unit_test.hpp>
|
||||
|
||||
using namespace boost::unit_test;
|
||||
//using namespace boost::unit_test;
|
||||
|
||||
BOOST_AUTO_TEST_CASE( create_uuid_nil ) {
|
||||
Seller seller{};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue