| 22 | |
| 23 | // Goal: test low-level base58 encoding functionality |
| 24 | BOOST_AUTO_TEST_CASE(base58_EncodeBase58) |
| 25 | { |
| 26 | UniValue tests = read_json(std::string(json_tests::base58_encode_decode, json_tests::base58_encode_decode + sizeof(json_tests::base58_encode_decode))); |
| 27 | for (unsigned int idx = 0; idx < tests.size(); idx++) { |
| 28 | UniValue test = tests[idx]; |
| 29 | std::string strTest = test.write(); |
| 30 | if (test.size() < 2) // Allow for extra stuff (useful for comments) |
| 31 | { |
| 32 | BOOST_ERROR("Bad test: " << strTest); |
| 33 | continue; |
| 34 | } |
| 35 | std::vector<unsigned char> sourcedata = ParseHex(test[0].get_str()); |
| 36 | std::string base58string = test[1].get_str(); |
| 37 | BOOST_CHECK_MESSAGE( |
| 38 | EncodeBase58(sourcedata) == base58string, |
| 39 | strTest); |
| 40 | } |
| 41 | } |
| 42 | |
| 43 | // Goal: test low-level base58 decoding functionality |
| 44 | BOOST_AUTO_TEST_CASE(base58_DecodeBase58) |
nothing calls this directly
no test coverage detected