21 #include <boost/test/unit_test.hpp> 22 #include <boost/filesystem.hpp> 47 auto argc = boost::unit_test::framework::master_test_suite().argc;
48 auto argv = boost::unit_test::framework::master_test_suite().argv;
50 for (
auto i = 0; !result && i < argc; ++i)
51 result = _name == argv[i];
57 auto argc = boost::unit_test::framework::master_test_suite().argc;
58 auto argv = boost::unit_test::framework::master_test_suite().argv;
59 for (
auto i = 1; i < argc; ++i)
62 if (_name == str.substr(0, _name.size()))
63 return str.substr(str.find(
"=") + 1);
66 BOOST_ERROR(
"Failed getting command line argument: " << _name <<
" from: " << argv);
70 LoadTestFileFixture::LoadTestFileFixture()
75 void ParallelFixture::enumerateThreads(
std::function<
void()> callback)
const 79 vector<thread> workers;
80 for (
size_t i = 0; i < threadsCount; i++)
81 workers.emplace_back(callback);
83 for_each(workers.begin(), workers.end(), [](thread &t)
91 for (
string const&
name: m_json.getMemberNames())
94 callback(m_json[name], bcl.
bc(), bcl.
state());
102 cerr <<
"void ClientBaseFixture::enumerateClients. FixedClient now accepts block not sate!" << endl;
103 _state.
commit(State::CommitBehaviour::KeepEmptyAccounts);
107 callback(_json, client);
116 enumerateThreads([callback, _json, &_client]() ->
void 118 callback(_json, _client);
Adapted from code found on http://stackoverflow.com/questions/180947/base64-decode-snippet-in-c Origi...
#define function(a, b, c, d, k, s)
Json::Value loadJsonFromFile(std::string const &_path)
void commit(CommitBehaviour _commitBehaviour)
Commit all changes waiting in the address cache to the DB.
Implements the blockchain database.
eth::BlockChain const & bc() const
void noteChain(BlockChain const &_bc)
Note the fact that this block is being used with a particular chain.
std::hash for asio::adress
Model of an Ethereum state, essentially a facade for the trie.
Active model of a block within the block chain.
Should be used to load test blockchain from json file Loads the blockchain from json, creates temporary directory to store it, removes the directory on dealloc.
std::string getCommandLineArgument(std::string const &_name, bool _require=false)
eth::State const & state() const
std::string toTestFilePath(std::string const &_filename)
mvp implementation of ClientBase Doesn't support mining interface
bool getCommandLineOption(std::string const &_name)