Changeset View
Changeset View
Standalone View
Standalone View
src/test/base58_tests.cpp
Show All 26 Lines | for (unsigned int idx = 0; idx < tests.size(); idx++) { | ||||
std::string strTest = test.write(); | std::string strTest = test.write(); | ||||
// Allow for extra stuff (useful for comments) | // Allow for extra stuff (useful for comments) | ||||
if (test.size() < 2) { | if (test.size() < 2) { | ||||
BOOST_ERROR("Bad test: " << strTest); | BOOST_ERROR("Bad test: " << strTest); | ||||
continue; | continue; | ||||
} | } | ||||
std::vector<uint8_t> sourcedata = ParseHex(test[0].get_str()); | std::vector<uint8_t> sourcedata = ParseHex(test[0].get_str()); | ||||
std::string base58string = test[1].get_str(); | std::string base58string = test[1].get_str(); | ||||
BOOST_CHECK_MESSAGE( | BOOST_CHECK_MESSAGE(EncodeBase58(sourcedata) == base58string, strTest); | ||||
EncodeBase58(sourcedata.data(), | |||||
sourcedata.data() + sourcedata.size()) == base58string, | |||||
strTest); | |||||
} | } | ||||
} | } | ||||
// Goal: test low-level base58 decoding functionality | // Goal: test low-level base58 decoding functionality | ||||
BOOST_AUTO_TEST_CASE(base58_DecodeBase58) { | BOOST_AUTO_TEST_CASE(base58_DecodeBase58) { | ||||
UniValue tests = | UniValue tests = | ||||
read_json(std::string(json_tests::base58_encode_decode, | read_json(std::string(json_tests::base58_encode_decode, | ||||
json_tests::base58_encode_decode + | json_tests::base58_encode_decode + | ||||
▲ Show 20 Lines • Show All 67 Lines • Show Last 20 Lines |