Browse Source

Test: test_pEpSQLite - Switch from pEpLog() to using TESTLOG()

Also, use the ASSERT_EXCEPT macro from Test::Utils
LIB-11
heck 4 years ago
parent
commit
b5bd084580
  1. 218
      test/test_pEpSQLite.cc

218
test/test_pEpSQLite.cc

@ -1,6 +1,5 @@
#include "test_pEpSQLite.hh" #include "test_pEpSQLite.hh"
#include "../src/pEpSQLite.hh" #include "../src/pEpSQLite.hh"
#include "../src/pEpLog.hh"
#include "framework/utils.hh" #include "framework/utils.hh"
#include <fstream> #include <fstream>
@ -8,7 +7,6 @@
using namespace std; using namespace std;
using namespace pEp; using namespace pEp;
using namespace pEp::Test; using namespace pEp::Test;
using namespace pEp::Test::Log;
using namespace pEp::Test::Utils; using namespace pEp::Test::Utils;
namespace pEp { namespace pEp {
@ -17,28 +15,28 @@ namespace pEp {
// filenames // filenames
string fixture_db_filename_new() string fixture_db_filename_new()
{ {
// pEpLog("called"); // TESTLOG("called");
string path = "new.db"; string path = "new.db";
return path; return path;
} }
string fixture_db_filename_bad() string fixture_db_filename_bad()
{ {
// pEpLog("called"); // TESTLOG("called");
string db_path_bad = "/will_not_create_dirs/bad.db"; string db_path_bad = "/will_not_create_dirs/bad.db";
return db_path_bad; return db_path_bad;
} }
string fixture_db_filename_existing_and_verified() string fixture_db_filename_existing_and_verified()
{ {
// pEpLog("called"); // TESTLOG("called");
string path = "new.db"; string path = "new.db";
return path; return path;
} }
string fixture_db_filename_corrupt() string fixture_db_filename_corrupt()
{ {
// pEpLog("called"); // TESTLOG("called");
string path = "corrupt.db"; string path = "corrupt.db";
return path; return path;
} }
@ -46,26 +44,23 @@ namespace pEp {
// prepared db's // prepared db's
string fixture_init_db_new() string fixture_init_db_new()
{ {
// pEpLog("called"); // TESTLOG("called");
string path = fixture_db_filename_new(); string path = fixture_db_filename_new();
// cout << "fixture: \"" << path << "\" not existing" << endl;
file_ensure_not_existing(path); file_ensure_not_existing(path);
return path; return path;
} }
string fixture_init_db_existing_and_verified() string fixture_init_db_existing_and_verified()
{ {
// pEpLog("called"); // TESTLOG("called");
string path = "existing.db"; string path = "existing.db";
// cout << "fixture: \"" << path << "\" not existing" << endl;
file_ensure_not_existing(path); file_ensure_not_existing(path);
return path; return path;
} }
string fixture_init_db_corrupt() string fixture_init_db_corrupt()
{ {
// pEpLog("called"); // TESTLOG("called");
// cout << "creating corrupt db" << endl;
string path = fixture_db_filename_corrupt(); string path = fixture_db_filename_corrupt();
file_ensure_not_existing(path); file_ensure_not_existing(path);
ofstream db_corrupt = file_create(path); ofstream db_corrupt = file_create(path);
@ -77,89 +72,89 @@ namespace pEp {
// instance // instance
pEpSQLite fixture_instance_of_new() pEpSQLite fixture_instance_of_new()
{ {
// pEpLog("called"); // TESTLOG("called");
return test_create_instance_on_new(); return test_create_instance_on_new();
} }
pEpSQLite fixture_instance_of_existing_and_verified() pEpSQLite fixture_instance_of_existing_and_verified()
{ {
// pEpLog("called"); // TESTLOG("called");
return test_create_instance_on_existing(); return test_create_instance_on_existing();
} }
pEpSQLite fixture_instance_of_bad() pEpSQLite fixture_instance_of_bad()
{ {
// pEpLog("called"); // TESTLOG("called");
return test_create_instance_on_path_bad(); return test_create_instance_on_path_bad();
} }
pEpSQLite fixture_instance_of_corrupt() pEpSQLite fixture_instance_of_corrupt()
{ {
// pEpLog("called"); // TESTLOG("called");
return test_create_instance_on_path_corrupt(); return test_create_instance_on_path_corrupt();
} }
// open // open
pEpSQLite fixture_db_open_of_new() pEpSQLite fixture_db_open_of_new()
{ {
// pEpLog("called"); // TESTLOG("called");
return test_createopen_db_new(); return test_createopen_db_new();
} }
pEpSQLite fixture_db_open_of_existing_and_verified() pEpSQLite fixture_db_open_of_existing_and_verified()
{ {
// pEpLog("called"); // TESTLOG("called");
return test_db_verify_content_after_insert_on_tables_exist(); return test_db_verify_content_after_insert_on_tables_exist();
} }
pEpSQLite fixture_db_open_of_bad() pEpSQLite fixture_db_open_of_bad()
{ {
// pEpLog("called"); // TESTLOG("called");
return test_createopen_db_bad(); return test_createopen_db_bad();
} }
pEpSQLite fixture_db_open_of_corrupt() pEpSQLite fixture_db_open_of_corrupt()
{ {
// pEpLog("called"); // TESTLOG("called");
return test_createopen_db_corrupt(); return test_createopen_db_corrupt();
} }
pEpSQLite fixture_db_open_after_close() pEpSQLite fixture_db_open_after_close()
{ {
// pEpLog("called"); // TESTLOG("called");
return test_close_after_open(); return test_close_after_open();
} }
// tables // tables
pEpSQLite fixture_db_open_with_tables_of_new() pEpSQLite fixture_db_open_with_tables_of_new()
{ {
// pEpLog("called"); // TESTLOG("called");
return test_db_create_tables_on_open_new(); return test_db_create_tables_on_open_new();
} }
pEpSQLite fixture_db_open_with_tables_of_corrupt() pEpSQLite fixture_db_open_with_tables_of_corrupt()
{ {
// pEpLog("called"); // TESTLOG("called");
return test_db_create_tables_on_open_corrupt(); return test_db_create_tables_on_open_corrupt();
} }
// content // content
pEpSQLite fixture_db_open_with_tables_and_content() pEpSQLite fixture_db_open_with_tables_and_content()
{ {
// pEpLog("called"); // TESTLOG("called");
return test_db_insert_on_tables_exist(); return test_db_insert_on_tables_exist();
} }
// delete // delete
pEpSQLite fixture_db_open_after_delete() pEpSQLite fixture_db_open_after_delete()
{ {
// pEpLog("called"); // TESTLOG("called");
return test_delete_file_gone_after_open_existing(); return test_delete_file_gone_after_open_existing();
} }
pEpSQLite fixture_db_open_after_close_after_delete() pEpSQLite fixture_db_open_after_close_after_delete()
{ {
// pEpLog("called"); // TESTLOG("called");
return test_delete_file_gone_after_close_new(); return test_delete_file_gone_after_close_new();
} }
@ -169,7 +164,7 @@ namespace pEp {
// OK // OK
pEpSQLite test_create_instance_on_new() pEpSQLite test_create_instance_on_new()
{ {
pEpLog("called"); TESTLOG("called");
pEpSQLite db(fixture_init_db_new()); pEpSQLite db(fixture_init_db_new());
return db; return db;
} }
@ -177,7 +172,7 @@ namespace pEp {
// OK // OK
pEpSQLite test_create_instance_on_existing() pEpSQLite test_create_instance_on_existing()
{ {
pEpLog("called"); TESTLOG("called");
pEpSQLite db(fixture_init_db_existing_and_verified()); pEpSQLite db(fixture_init_db_existing_and_verified());
return db; return db;
} }
@ -185,7 +180,7 @@ namespace pEp {
// OK // OK
pEpSQLite test_create_instance_on_path_bad() pEpSQLite test_create_instance_on_path_bad()
{ {
pEpLog("called"); TESTLOG("called");
pEpSQLite db(fixture_db_filename_bad()); pEpSQLite db(fixture_db_filename_bad());
return db; return db;
} }
@ -193,7 +188,7 @@ namespace pEp {
// OK // OK
pEpSQLite test_create_instance_on_path_corrupt() pEpSQLite test_create_instance_on_path_corrupt()
{ {
pEpLog("called"); TESTLOG("called");
pEpSQLite db(fixture_init_db_corrupt()); pEpSQLite db(fixture_init_db_corrupt());
return db; return db;
} }
@ -202,7 +197,7 @@ namespace pEp {
// OK, new db // OK, new db
pEpSQLite test_createopen_db_new() pEpSQLite test_createopen_db_new()
{ {
pEpLog("called"); TESTLOG("called");
pEpSQLite db = fixture_instance_of_new(); pEpSQLite db = fixture_instance_of_new();
assert(!file_exists(fixture_db_filename_new())); assert(!file_exists(fixture_db_filename_new()));
db.create_or_open_db(); db.create_or_open_db();
@ -213,7 +208,7 @@ namespace pEp {
// OK, open db // OK, open db
pEpSQLite test_createopen_db_existing() pEpSQLite test_createopen_db_existing()
{ {
pEpLog("called"); TESTLOG("called");
pEpSQLite db = fixture_instance_of_existing_and_verified(); pEpSQLite db = fixture_instance_of_existing_and_verified();
assert(file_exists(fixture_db_filename_existing_and_verified())); assert(file_exists(fixture_db_filename_existing_and_verified()));
db.create_or_open_db(); db.create_or_open_db();
@ -223,16 +218,11 @@ namespace pEp {
// ERR, cant create // ERR, cant create
pEpSQLite test_createopen_db_bad() pEpSQLite test_createopen_db_bad()
{ {
pEpLog("called"); TESTLOG("called");
assert(!file_exists(fixture_db_filename_bad())); assert(!file_exists(fixture_db_filename_bad()));
pEpSQLite db = fixture_instance_of_bad(); pEpSQLite db = fixture_instance_of_bad();
assert(!file_exists(fixture_db_filename_bad())); assert(!file_exists(fixture_db_filename_bad()));
try { ASSERT_EXCEPT(db.create_or_open_db());
db.create_or_open_db();
assert(false);
} catch (const exception& e) {
pEp::Test::Utils::print_exception(e);
}
assert(!file_exists(fixture_db_filename_bad())); assert(!file_exists(fixture_db_filename_bad()));
return db; return db;
} }
@ -240,7 +230,7 @@ namespace pEp {
// OK(cant detect corruption) // OK(cant detect corruption)
pEpSQLite test_createopen_db_corrupt() pEpSQLite test_createopen_db_corrupt()
{ {
pEpLog("called"); TESTLOG("called");
pEpSQLite db = fixture_instance_of_corrupt(); pEpSQLite db = fixture_instance_of_corrupt();
assert(file_exists(fixture_db_filename_corrupt())); assert(file_exists(fixture_db_filename_corrupt()));
db.create_or_open_db(); db.create_or_open_db();
@ -252,7 +242,7 @@ namespace pEp {
// OK // OK
pEpSQLite test_close_before_open() pEpSQLite test_close_before_open()
{ {
pEpLog("called"); TESTLOG("called");
pEpSQLite db = fixture_instance_of_new(); pEpSQLite db = fixture_instance_of_new();
db.close_db(); db.close_db();
return db; return db;
@ -261,7 +251,7 @@ namespace pEp {
// OK // OK
pEpSQLite test_close_after_open() pEpSQLite test_close_after_open()
{ {
pEpLog("called"); TESTLOG("called");
pEpSQLite db = fixture_db_open_of_new(); pEpSQLite db = fixture_db_open_of_new();
db.close_db(); db.close_db();
return db; return db;
@ -270,7 +260,7 @@ namespace pEp {
// OK // OK
pEpSQLite test_close_idempotent() pEpSQLite test_close_idempotent()
{ {
pEpLog("called"); TESTLOG("called");
pEpSQLite db = fixture_db_open_of_new(); pEpSQLite db = fixture_db_open_of_new();
db.close_db(); db.close_db();
db.close_db(); db.close_db();
@ -283,7 +273,7 @@ namespace pEp {
// OK // OK
pEpSQLite test_db_create_tables_on_open_new() pEpSQLite test_db_create_tables_on_open_new()
{ {
pEpLog("called"); TESTLOG("called");
pEpSQLite db = fixture_db_open_of_new(); pEpSQLite db = fixture_db_open_of_new();
db.execute("CREATE TABLE test(i,i_squared);"); db.execute("CREATE TABLE test(i,i_squared);");
return db; return db;
@ -292,42 +282,28 @@ namespace pEp {
// ERR, Tables already exist // ERR, Tables already exist
pEpSQLite test_db_create_tables_open_existing() pEpSQLite test_db_create_tables_open_existing()
{ {
pEpLog("called"); TESTLOG("called");
pEpSQLite db = fixture_db_open_of_existing_and_verified(); pEpSQLite db = fixture_db_open_of_existing_and_verified();
try { ASSERT_EXCEPT(db.execute("CREATE TABLE test(i,i_squared);"));
db.execute("CREATE TABLE test(i,i_squared);");
assert(false);
} catch (const exception& e) {
pEp::Test::Utils::print_exception(e);
}
return db; return db;
} }
// ERR, db closed // ERR, db closed
pEpSQLite test_db_create_tables_on_open_bad() pEpSQLite test_db_create_tables_on_open_bad()
{ {
pEpLog("called"); TESTLOG("called");
pEpSQLite db = fixture_db_open_of_bad(); pEpSQLite db = fixture_db_open_of_bad();
try {
db.execute("CREATE TABLE test(i,i_squared);"); ASSERT_EXCEPT(db.execute("CREATE TABLE test(i,i_squared);"));
assert(false);
} catch (const exception& e) {
pEp::Test::Utils::print_exception(e);
}
return db; return db;
} }
// ERR, db corrupt // ERR, db corrupt
pEpSQLite test_db_create_tables_on_open_corrupt() pEpSQLite test_db_create_tables_on_open_corrupt()
{ {
pEpLog("called"); TESTLOG("called");
pEpSQLite db = fixture_db_open_of_corrupt(); pEpSQLite db = fixture_db_open_of_corrupt();
try { ASSERT_EXCEPT(db.execute("CREATE TABLE test(i,i_squared);"));
db.execute("CREATE TABLE test(i,i_squared);");
assert(false);
} catch (const exception& e) {
pEp::Test::Utils::print_exception(e);
}
return db; return db;
} }
@ -335,7 +311,7 @@ namespace pEp {
// insert (execute()) // insert (execute())
void insert_operation(pEpSQLite& db) void insert_operation(pEpSQLite& db)
{ {
pEpLog("called"); TESTLOG("called");
for (int i = 0; i < 9; i = (i + 2)) { for (int i = 0; i < 9; i = (i + 2)) {
db.execute( db.execute(
"INSERT INTO test(i,i_squared) VALUES ('" + to_string(i) + "', '" + "INSERT INTO test(i,i_squared) VALUES ('" + to_string(i) + "', '" +
@ -346,7 +322,7 @@ namespace pEp {
// OK // OK
pEpSQLite test_db_insert_on_tables_exist() pEpSQLite test_db_insert_on_tables_exist()
{ {
pEpLog("called"); TESTLOG("called");
pEpSQLite db = fixture_db_open_with_tables_of_new(); pEpSQLite db = fixture_db_open_with_tables_of_new();
insert_operation(db); insert_operation(db);
return db; return db;
@ -356,67 +332,51 @@ namespace pEp {
pEpSQLite test_db_insert_on_tables_dont_exist() pEpSQLite test_db_insert_on_tables_dont_exist()
{ {
pEpSQLite db = fixture_db_open_of_new(); pEpSQLite db = fixture_db_open_of_new();
try { ASSERT_EXCEPT(insert_operation(db));
insert_operation(db);
assert(false);
} catch (const exception& e) {
pEp::Test::Utils::print_exception(e);
}
return db; return db;
} }
// ERR, Tables missing // ERR, Tables missing
pEpSQLite test_db_insert_before_open() pEpSQLite test_db_insert_before_open()
{ {
pEpLog("called"); TESTLOG("called");
pEpSQLite db = fixture_instance_of_new(); pEpSQLite db = fixture_instance_of_new();
try { ASSERT_EXCEPT(insert_operation(db));
insert_operation(db);
assert(false);
} catch (const exception& e) {
pEp::Test::Utils::print_exception(e);
}
return db; return db;
} }
// ERR, Tables missing // ERR, Tables missing
pEpSQLite test_db_insert_after_close() pEpSQLite test_db_insert_after_close()
{ {
pEpLog("called"); TESTLOG("called");
pEpSQLite db = fixture_db_open_after_close(); pEpSQLite db = fixture_db_open_after_close();
try { ASSERT_EXCEPT(insert_operation(db));
insert_operation(db);
assert(false);
} catch (const exception& e) {
pEp::Test::Utils::print_exception(e);
}
return db; return db;
} }
// verify contents (execute()) // verify contents (execute())
void verify_operation(pEpSQLite& db) void verify_operation(pEpSQLite& db)
{ {
pEpLog("called"); TESTLOG("called");
for (int i = 0; i < 9; i++) { for (int i = 0; i < 9; i++) {
ResultSet rs = db.execute( ResultSet rs = db.execute(
"SELECT i, i_squared FROM test " "SELECT i, i_squared FROM test "
"WHERE (test.i == '" + "WHERE (test.i == '" +
to_string(i) + "');"); to_string(i) + "');");
// cout << "RESULT: " << endl << pEpSQLite::to_string(rs) << endl;
if (i % 2) { if (i % 2) {
if (!rs.empty()) { if (!rs.empty()) {
runtime_error e{ "Exception verifying database content" }; runtime_error e{ "Exception verifying database content" };
throw(e); throw(e);
} }
} else { } else {
if(rs.size() != 1) { if (rs.size() != 1) {
runtime_error e{ "Exception verifying database content" }; runtime_error e{ "Exception verifying database content" };
throw(e); throw(e);
} }
for (const RSRecord& r : rs) { for (const RSRecord& r : rs) {
const int x = stoi(r.at("i")); const int x = stoi(r.at("i"));
const int x_squared = stoi(r.at("i_squared")); const int x_squared = stoi(r.at("i_squared"));
if((x * x) != x_squared) { if ((x * x) != x_squared) {
runtime_error e{ "Exception verifying database content" }; runtime_error e{ "Exception verifying database content" };
throw(e); throw(e);
} }
@ -428,7 +388,7 @@ namespace pEp {
// OK // OK
pEpSQLite test_db_verify_content_existing_open_db() pEpSQLite test_db_verify_content_existing_open_db()
{ {
pEpLog("called"); TESTLOG("called");
pEpSQLite db = fixture_db_open_of_existing_and_verified(); pEpSQLite db = fixture_db_open_of_existing_and_verified();
verify_operation(db); verify_operation(db);
return db; return db;
@ -437,7 +397,7 @@ namespace pEp {
// OK // OK
pEpSQLite test_db_verify_content_after_insert_on_tables_exist() pEpSQLite test_db_verify_content_after_insert_on_tables_exist()
{ {
pEpLog("called"); TESTLOG("called");
pEpSQLite db = fixture_db_open_with_tables_and_content(); pEpSQLite db = fixture_db_open_with_tables_and_content();
verify_operation(db); verify_operation(db);
return db; return db;
@ -446,28 +406,19 @@ namespace pEp {
// ERR - no tables // ERR - no tables
pEpSQLite test_db_verify_content_no_tables() pEpSQLite test_db_verify_content_no_tables()
{ {
pEpLog("called"); TESTLOG("called");
pEpSQLite db = fixture_db_open_of_new(); pEpSQLite db = fixture_db_open_of_new();
try {
verify_operation(db); ASSERT_EXCEPT(verify_operation(db));
assert(false);
} catch (const exception& e) {
pEp::Test::Utils::print_exception(e);
}
return db; return db;
} }
// ERR - err no data // ERR - err no data
pEpSQLite test_db_verify_content_after_create_tables() pEpSQLite test_db_verify_content_after_create_tables()
{ {
pEpLog("called"); TESTLOG("called");
pEpSQLite db = fixture_db_open_with_tables_of_new(); pEpSQLite db = fixture_db_open_with_tables_of_new();
try { ASSERT_EXCEPT(verify_operation(db));
verify_operation(db);
assert(false);
} catch (const exception& e) {
pEp::Test::Utils::print_exception(e);
}
return db; return db;
} }
@ -476,7 +427,7 @@ namespace pEp {
// OK // OK
pEpSQLite test_get_path_on_instance_good() pEpSQLite test_get_path_on_instance_good()
{ {
pEpLog("called"); TESTLOG("called");
pEpSQLite db = fixture_instance_of_new(); pEpSQLite db = fixture_instance_of_new();
assert(db.get_db_path() == fixture_db_filename_new()); assert(db.get_db_path() == fixture_db_filename_new());
return db; return db;
@ -485,7 +436,7 @@ namespace pEp {
// OK // OK
pEpSQLite test_get_path_on_instance_bad() pEpSQLite test_get_path_on_instance_bad()
{ {
pEpLog("called"); TESTLOG("called");
pEpSQLite db = fixture_instance_of_bad(); pEpSQLite db = fixture_instance_of_bad();
assert(db.get_db_path() == fixture_db_filename_bad()); assert(db.get_db_path() == fixture_db_filename_bad());
return db; return db;
@ -495,14 +446,9 @@ namespace pEp {
// ERR, file not found // ERR, file not found
pEpSQLite test_delete_file_gone_before_open_new() pEpSQLite test_delete_file_gone_before_open_new()
{ {
pEpLog("called"); TESTLOG("called");
pEpSQLite db = fixture_instance_of_new(); pEpSQLite db = fixture_instance_of_new();
try { ASSERT_EXCEPT(db.delete_db());
db.delete_db();
assert(false);
} catch (const exception& e) {
pEp::Test::Utils::print_exception(e);
}
assert(!file_exists(fixture_db_filename_new())); assert(!file_exists(fixture_db_filename_new()));
return db; return db;
} }
@ -510,14 +456,9 @@ namespace pEp {
// ERR, file not found // ERR, file not found
pEpSQLite test_delete_file_gone_before_open_existing() pEpSQLite test_delete_file_gone_before_open_existing()
{ {
pEpLog("called"); TESTLOG("called");
pEpSQLite db = fixture_instance_of_existing_and_verified(); pEpSQLite db = fixture_instance_of_existing_and_verified();
try { ASSERT_EXCEPT(db.delete_db());
db.delete_db();
assert(false);
} catch (const exception& e) {
pEp::Test::Utils::print_exception(e);
}
assert(!file_exists(fixture_db_filename_existing_and_verified())); assert(!file_exists(fixture_db_filename_existing_and_verified()));
return db; return db;
} }
@ -525,7 +466,7 @@ namespace pEp {
// OK // OK
pEpSQLite test_delete_file_gone_after_close_new() pEpSQLite test_delete_file_gone_after_close_new()
{ {
pEpLog("called"); TESTLOG("called");
pEpSQLite db = fixture_db_open_after_close(); pEpSQLite db = fixture_db_open_after_close();
db.delete_db(); db.delete_db();
assert(!file_exists(fixture_db_filename_new())); assert(!file_exists(fixture_db_filename_new()));
@ -535,7 +476,7 @@ namespace pEp {
// OK // OK
pEpSQLite test_delete_file_gone_after_open_existing() pEpSQLite test_delete_file_gone_after_open_existing()
{ {
pEpLog("called"); TESTLOG("called");
pEpSQLite db = fixture_db_open_of_existing_and_verified(); pEpSQLite db = fixture_db_open_of_existing_and_verified();
db.delete_db(); db.delete_db();
assert(!file_exists(fixture_db_filename_existing_and_verified())); assert(!file_exists(fixture_db_filename_existing_and_verified()));
@ -545,7 +486,7 @@ namespace pEp {
// OK // OK
pEpSQLite test_delete_file_gone_after_open_corrupt() pEpSQLite test_delete_file_gone_after_open_corrupt()
{ {
pEpLog("called"); TESTLOG("called");
pEpSQLite db = fixture_db_open_of_corrupt(); pEpSQLite db = fixture_db_open_of_corrupt();
db.delete_db(); db.delete_db();
assert(!file_exists(fixture_db_filename_corrupt())); assert(!file_exists(fixture_db_filename_corrupt()));
@ -555,14 +496,9 @@ namespace pEp {
// ERR // ERR
pEpSQLite test_delete_file_gone_after_open_bad() pEpSQLite test_delete_file_gone_after_open_bad()
{ {
pEpLog("called"); TESTLOG("called");
pEpSQLite db = fixture_db_open_of_bad(); pEpSQLite db = fixture_db_open_of_bad();
try { ASSERT_EXCEPT(db.delete_db());
db.delete_db();
assert(false);
} catch (const exception& e) {
pEp::Test::Utils::print_exception(e);
}
assert(!file_exists(fixture_db_filename_bad())); assert(!file_exists(fixture_db_filename_bad()));
return db; return db;
} }
@ -571,7 +507,7 @@ namespace pEp {
// false // false
pEpSQLite test_is_open_before_open_new() pEpSQLite test_is_open_before_open_new()
{ {
pEpLog("called"); TESTLOG("called");
pEpSQLite db = fixture_instance_of_new(); pEpSQLite db = fixture_instance_of_new();
assert(!db.is_open()); assert(!db.is_open());
return db; return db;
@ -580,7 +516,7 @@ namespace pEp {
// true // true
pEpSQLite test_is_open_after_open_new() pEpSQLite test_is_open_after_open_new()
{ {
pEpLog("called"); TESTLOG("called");
pEpSQLite db = fixture_db_open_of_new(); pEpSQLite db = fixture_db_open_of_new();
assert(db.is_open()); assert(db.is_open());
return db; return db;
@ -589,7 +525,7 @@ namespace pEp {
// true // true
pEpSQLite test_is_open_after_open_existing() pEpSQLite test_is_open_after_open_existing()
{ {
pEpLog("called"); TESTLOG("called");
pEpSQLite db = fixture_db_open_of_existing_and_verified(); pEpSQLite db = fixture_db_open_of_existing_and_verified();
assert(db.is_open()); assert(db.is_open());
return db; return db;
@ -598,7 +534,7 @@ namespace pEp {
// false // false
pEpSQLite test_is_open_after_open_bad() pEpSQLite test_is_open_after_open_bad()
{ {
pEpLog("called"); TESTLOG("called");
pEpSQLite db = fixture_db_open_of_bad(); pEpSQLite db = fixture_db_open_of_bad();
assert(!db.is_open()); assert(!db.is_open());
return db; return db;
@ -607,7 +543,7 @@ namespace pEp {
// true (cant detect corruption) // true (cant detect corruption)
pEpSQLite test_is_open_after_open_corrupt() pEpSQLite test_is_open_after_open_corrupt()
{ {
pEpLog("called"); TESTLOG("called");
pEpSQLite db = fixture_db_open_of_corrupt(); pEpSQLite db = fixture_db_open_of_corrupt();
assert(db.is_open()); assert(db.is_open());
return db; return db;
@ -616,7 +552,7 @@ namespace pEp {
// false // false
pEpSQLite test_is_open_after_close() pEpSQLite test_is_open_after_close()
{ {
pEpLog("called"); TESTLOG("called");
pEpSQLite db = fixture_db_open_after_close(); pEpSQLite db = fixture_db_open_after_close();
assert(!db.is_open()); assert(!db.is_open());
return db; return db;
@ -625,7 +561,7 @@ namespace pEp {
// false // false
pEpSQLite test_is_open_after_delete_on_open() pEpSQLite test_is_open_after_delete_on_open()
{ {
pEpLog("called"); TESTLOG("called");
pEpSQLite db = fixture_db_open_after_delete(); pEpSQLite db = fixture_db_open_after_delete();
assert(!db.is_open()); assert(!db.is_open());
return db; return db;
@ -634,7 +570,7 @@ namespace pEp {
// false // false
pEpSQLite test_is_open_after_delete_on_closed() pEpSQLite test_is_open_after_delete_on_closed()
{ {
pEpLog("called"); TESTLOG("called");
pEpSQLite db = fixture_db_open_after_close_after_delete(); pEpSQLite db = fixture_db_open_after_close_after_delete();
assert(!db.is_open()); assert(!db.is_open());
return db; return db;

Loading…
Cancel
Save