1
0
Fork 0
forked from lthn/blockchain

unittests: added db_accessor_tests.dtor_without_init (exposes a minor bug)

This commit is contained in:
sowle 2019-11-14 06:00:06 +03:00
parent 10ea355ae9
commit cd1e3c115d
No known key found for this signature in database
GPG key ID: C07A24B2D89D49FC

View file

@ -428,3 +428,23 @@ TEST(db_accessor_tests, median_db_cache_test)
m_naive_median.print_to_file(folder_name + "/naive_median_2.txt");
}
TEST(db_accessor_tests, dtor_without_init)
{
epee::shared_recursive_mutex m_rw_lock;
{
tools::db::basic_db_accessor m_db(nullptr, m_rw_lock);
ASSERT_FALSE(m_db.is_open());
}
// make sure dtor called successfully with no exceptions
{
tools::db::basic_db_accessor m_db(nullptr, m_rw_lock);
m_db.close();
ASSERT_FALSE(m_db.is_open());
}
}