MCPcopy Create free account
hub / github.com/bitcoin/bitcoin / BOOST_AUTO_TEST_CASE

Function BOOST_AUTO_TEST_CASE

src/test/base58_tests.cpp:25–42  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 9

read_jsonFunction · 0.85
ParseHexFunction · 0.85
EncodeBase58Function · 0.85
DecodeBase58Function · 0.85
DecodeBase58CheckFunction · 0.85
sizeMethod · 0.45
writeMethod · 0.45
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected