kima2/test/test_database.cpp

25 lines
621 B
C++

#define BOOST_TEST_MODULE database
#include "../src/core/database.h"
#include <filesystem>
#include <boost/test/included/unit_test.hpp>
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);
}
std::string filename = testPath.generic_string();
Database db(filename);
db.init();
BOOST_TEST(std::filesystem::exists(testPath) == true);
if (std::filesystem::exists(testPath)) {
std::filesystem::remove(testPath);
}
}