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

Function BOOST_AUTO_TEST_CASE

src/tests/base58_tests.cpp:39–57  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

37
38// Goal: test low-level base58 encoding functionality
39BOOST_AUTO_TEST_CASE(base58_EncodeBase58)
40{
41 Array tests = read_json(std::string(json_tests::base58_encode_decode, json_tests::base58_encode_decode + sizeof(json_tests::base58_encode_decode)));
42 for (auto& tv : tests)
43 {
44 Array test = tv.get_array();
45 std::string strTest = write_string(tv, false);
46 if (test.size() < 2) // Allow for extra stuff (useful for comments)
47 {
48 BOOST_ERROR("Bad test: " << strTest);
49 continue;
50 }
51 std::vector<unsigned char> sourcedata = ParseHex(test[0].get_str());
52 std::string base58string = test[1].get_str();
53 BOOST_CHECK_MESSAGE(
54 EncodeBase58(&sourcedata[0], &sourcedata[sourcedata.size()]) == base58string,
55 strTest);
56 }
57}
58
59// Goal: test low-level base58 decoding functionality
60BOOST_AUTO_TEST_CASE(base58_DecodeBase58)

Callers

nothing calls this directly

Calls 10

read_jsonFunction · 0.85
write_stringFunction · 0.85
ParseHexFunction · 0.85
EncodeBase58Function · 0.85
DecodeBase58Function · 0.85
SetStringMethod · 0.80
sizeMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
IsValidMethod · 0.45

Tested by

no test coverage detected