Skip to content

Commit

Permalink
tests: test dbwrapper options compression and maxopenfiles
Browse files Browse the repository at this point in the history
  • Loading branch information
Braydon Fuller committed Jul 14, 2016
1 parent 1b36e2c commit 69ea12c
Showing 1 changed file with 43 additions and 0 deletions.
43 changes: 43 additions & 0 deletions src/test/dbwrapper_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,49 @@ BOOST_AUTO_TEST_CASE(dbwrapper)
}
}

BOOST_AUTO_TEST_CASE(dbwrapper_compression)
{
// Perform tests both with compression and without
for (int i = 0; i < 2; i++) {
bool compression = (bool)i;
path ph = temp_directory_path() / unique_path();
CDBWrapper dbw(ph, (1 << 20), true, false, false, compression);
char key = 'k';
uint256 in = GetRandHash();
uint256 res;

BOOST_CHECK(dbw.Write(key, in));
BOOST_CHECK(dbw.Read(key, res));
BOOST_CHECK_EQUAL(res.ToString(), in.ToString());
}
}

BOOST_AUTO_TEST_CASE(dbwrapper_maxopenfiles_64)
{
path ph = temp_directory_path() / unique_path();
CDBWrapper dbw(ph, (1 << 20), true, false, false, false, 64);
char key = 'k';
uint256 in = GetRandHash();
uint256 res;

BOOST_CHECK(dbw.Write(key, in));
BOOST_CHECK(dbw.Read(key, res));
BOOST_CHECK_EQUAL(res.ToString(), in.ToString());
}

BOOST_AUTO_TEST_CASE(dbwrapper_maxopenfiles_1000)
{
path ph = temp_directory_path() / unique_path();
CDBWrapper dbw(ph, (1 << 20), true, false, false, false, 1000);
char key = 'k';
uint256 in = GetRandHash();
uint256 res;

BOOST_CHECK(dbw.Write(key, in));
BOOST_CHECK(dbw.Read(key, res));
BOOST_CHECK_EQUAL(res.ToString(), in.ToString());
}

// Test batch operations
BOOST_AUTO_TEST_CASE(dbwrapper_batch)
{
Expand Down

0 comments on commit 69ea12c

Please sign in to comment.