more on database (tests)

This commit is contained in:
Martin Brodbeck 2018-07-10 15:46:55 +02:00
parent 53666163b4
commit eeae4fe609
4 changed files with 27 additions and 23 deletions

View file

@ -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);
}
}