mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-12 06:58:57 +01:00
Refactoring: Removed using namespace <xxx> from bench/ and test/ source files.
This commit is contained in:
committed by
Kalle Alm
parent
53442af0aa
commit
73f41190b9
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user