aboutsummaryrefslogtreecommitdiff
path: root/src/test/dbwrapper_tests.cpp
diff options
context:
space:
mode:
authorKarl-Johan Alm <karljohan-alm@garage.co.jp>2016-12-05 16:03:53 +0900
committerKalle Alm <kalle.alm@gmail.com>2017-01-02 20:35:23 +0900
commit73f41190b91dce9c125b1828b18f7625e0200145 (patch)
tree7fbc5af2fa822231182c85df8d5d9826e8c1ecae /src/test/dbwrapper_tests.cpp
parent53442af0aac3838179fad79a65512ee8c5603922 (diff)
downloadbitcoin-73f41190b91dce9c125b1828b18f7625e0200145.tar.xz
Refactoring: Removed using namespace <xxx> from bench/ and test/ source files.
Diffstat (limited to 'src/test/dbwrapper_tests.cpp')
-rw-r--r--src/test/dbwrapper_tests.cpp34
1 files changed, 15 insertions, 19 deletions
diff --git a/src/test/dbwrapper_tests.cpp b/src/test/dbwrapper_tests.cpp
index 2d791ee18d..6751b9d5a0 100644
--- a/src/test/dbwrapper_tests.cpp
+++ b/src/test/dbwrapper_tests.cpp
@@ -10,13 +10,9 @@
#include <boost/assign/std/vector.hpp> // for 'operator+=()'
#include <boost/assert.hpp>
#include <boost/test/unit_test.hpp>
-
-using namespace std;
-using namespace boost::assign; // bring 'operator+=()' into scope
-using namespace boost::filesystem;
-
+
// Test if a string consists entirely of null characters
-bool is_null_key(const vector<unsigned char>& key) {
+bool is_null_key(const std::vector<unsigned char>& key) {
bool isnull = true;
for (unsigned int i = 0; i < key.size(); i++)
@@ -32,7 +28,7 @@ BOOST_AUTO_TEST_CASE(dbwrapper)
// Perform tests both obfuscated and non-obfuscated.
for (int i = 0; i < 2; i++) {
bool obfuscate = (bool)i;
- path ph = temp_directory_path() / unique_path();
+ boost::filesystem::path ph = boost::filesystem::temp_directory_path() / boost::filesystem::unique_path();
CDBWrapper dbw(ph, (1 << 20), true, false, obfuscate);
char key = 'k';
uint256 in = GetRandHash();
@@ -53,7 +49,7 @@ BOOST_AUTO_TEST_CASE(dbwrapper_batch)
// Perform tests both obfuscated and non-obfuscated.
for (int i = 0; i < 2; i++) {
bool obfuscate = (bool)i;
- path ph = temp_directory_path() / unique_path();
+ boost::filesystem::path ph = boost::filesystem::temp_directory_path() / boost::filesystem::unique_path();
CDBWrapper dbw(ph, (1 << 20), true, false, obfuscate);
char key = 'i';
@@ -90,7 +86,7 @@ BOOST_AUTO_TEST_CASE(dbwrapper_iterator)
// Perform tests both obfuscated and non-obfuscated.
for (int i = 0; i < 2; i++) {
bool obfuscate = (bool)i;
- path ph = temp_directory_path() / unique_path();
+ boost::filesystem::path ph = boost::filesystem::temp_directory_path() / boost::filesystem::unique_path();
CDBWrapper dbw(ph, (1 << 20), true, false, obfuscate);
// The two keys are intentionally chosen for ordering
@@ -129,8 +125,8 @@ BOOST_AUTO_TEST_CASE(dbwrapper_iterator)
// Test that we do not obfuscation if there is existing data.
BOOST_AUTO_TEST_CASE(existing_data_no_obfuscate)
{
- // We're going to share this path between two wrappers
- path ph = temp_directory_path() / unique_path();
+ // We're going to share this boost::filesystem::path between two wrappers
+ boost::filesystem::path ph = boost::filesystem::temp_directory_path() / boost::filesystem::unique_path();
create_directories(ph);
// Set up a non-obfuscated wrapper to write some initial data.
@@ -170,8 +166,8 @@ BOOST_AUTO_TEST_CASE(existing_data_no_obfuscate)
// Ensure that we start obfuscating during a reindex.
BOOST_AUTO_TEST_CASE(existing_data_reindex)
{
- // We're going to share this path between two wrappers
- path ph = temp_directory_path() / unique_path();
+ // We're going to share this boost::filesystem::path between two wrappers
+ boost::filesystem::path ph = boost::filesystem::temp_directory_path() / boost::filesystem::unique_path();
create_directories(ph);
// Set up a non-obfuscated wrapper to write some initial data.
@@ -206,7 +202,7 @@ BOOST_AUTO_TEST_CASE(existing_data_reindex)
BOOST_AUTO_TEST_CASE(iterator_ordering)
{
- path ph = temp_directory_path() / unique_path();
+ boost::filesystem::path ph = boost::filesystem::temp_directory_path() / boost::filesystem::unique_path();
CDBWrapper dbw(ph, (1 << 20), true, false, false);
for (int x=0x00; x<256; ++x) {
uint8_t key = x;
@@ -241,11 +237,11 @@ BOOST_AUTO_TEST_CASE(iterator_ordering)
struct StringContentsSerializer {
// Used to make two serialized objects the same while letting them have a different lengths
// This is a terrible idea
- string str;
+ std::string str;
StringContentsSerializer() {}
- StringContentsSerializer(const string& inp) : str(inp) {}
+ StringContentsSerializer(const std::string& inp) : str(inp) {}
- StringContentsSerializer& operator+=(const string& s) {
+ StringContentsSerializer& operator+=(const std::string& s) {
str += s;
return *this;
}
@@ -277,7 +273,7 @@ BOOST_AUTO_TEST_CASE(iterator_string_ordering)
{
char buf[10];
- path ph = temp_directory_path() / unique_path();
+ boost::filesystem::path ph = boost::filesystem::temp_directory_path() / boost::filesystem::unique_path();
CDBWrapper dbw(ph, (1 << 20), true, false, false);
for (int x=0x00; x<10; ++x) {
for (int y = 0; y < 10; y++) {
@@ -303,7 +299,7 @@ BOOST_AUTO_TEST_CASE(iterator_string_ordering)
for (int x=seek_start; x<10; ++x) {
for (int y = 0; y < 10; y++) {
sprintf(buf, "%d", x);
- string exp_key(buf);
+ std::string exp_key(buf);
for (int z = 0; z < y; z++)
exp_key += exp_key;
StringContentsSerializer key;