28 #include <boost/test/unit_test.hpp> 38 using dev::operator <<;
46 testPath +=
"/PoWTests";
48 cnote <<
"Testing Proof of Work...";
51 BOOST_REQUIRE_MESSAGE(s.length() > 0,
"Contents of 'ethash_tests.json' is empty. Have you cloned the 'tests' repo branch develop?");
57 vector<pair<string, string>> ss;
62 BOOST_REQUIRE_EQUAL(nonce, Ethash::nonce(header));
64 unsigned cacheSize(o[
"cache_size"].get_int());
66 BOOST_REQUIRE_EQUAL(EthashAux::get()->light(Ethash::seedHash(header))->
size, cacheSize);
67 BOOST_REQUIRE_EQUAL(
sha3(EthashAux::get()->light(Ethash::seedHash(header))->
data()), cacheHash);
70 unsigned fullSize(o[
"full_size"].get_int());
72 BOOST_REQUIRE_EQUAL(EthashAux::get()->full(Ethash::seedHash(header))->
size(), fullSize);
73 BOOST_REQUIRE_EQUAL(
sha3(EthashAux::get()->full(Ethash::seedHash(header))->
data()), fullHash);
78 BOOST_REQUIRE_EQUAL(r.
value, result);
79 BOOST_REQUIRE_EQUAL(r.
mixHash, Ethash::mixHash(header));
const Object & get_obj() const
Adapted from code found on http://stackoverflow.com/questions/180947/base64-decode-snippet-in-c Origi...
std::hash for asio::adress
std::string contentsString(std::string const &_file)
Retrieve and returns the contents of the given file as a std::string.
BOOST_AUTO_TEST_CASE(basic_test)
bytes fromHex(std::string const &_s, WhenError _throw=WhenError::DontThrow)
bool read_string(const String_type &s, Value_type &value)
std::string getTestPath()
mConfig::Object_type mObject
#define BOOST_FIXTURE_TEST_SUITE(a, b)
uint8_t const size_t const size
bool sha3(bytesConstRef _input, bytesRef o_output)
Calculate SHA3-256 hash of the given input and load it into the given output.
#define BOOST_AUTO_TEST_SUITE_END()
std::string get_str(std::string::const_iterator begin, std::string::const_iterator end)
Helper functions to work with json::spirit and test files.