MCPcopy Create free account
hub / github.com/ElementsProject/elements / BOOST_AUTO_TEST_CASE

Function BOOST_AUTO_TEST_CASE

src/test/base58_tests.cpp:24–41  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

22
23// Goal: test low-level base58 encoding functionality
24BOOST_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
44BOOST_AUTO_TEST_CASE(base58_DecodeBase58)

Callers

nothing calls this directly

Calls 15

read_jsonFunction · 0.85
ParseHexFunction · 0.85
EncodeBase58Function · 0.85
DecodeBase58Function · 0.85
DecodeBase58CheckFunction · 0.85
InsecureRandBitsFunction · 0.85
InsecureRandBoolFunction · 0.85
InsecureRandRangeFunction · 0.85
EncodeBase58CheckFunction · 0.85
randbytesMethod · 0.80
CatFunction · 0.50
sizeMethod · 0.45

Tested by

no test coverage detected