Changeset View
Changeset View
Standalone View
Standalone View
src/test/cashaddrenc_tests.cpp
Show First 20 Lines • Show All 466 Lines • ▼ Show 20 Lines | for (auto ps : valid_sizes) { | ||||
ss >> deserContent; | ss >> deserContent; | ||||
BOOST_CHECK_EQUAL(content.type, deserContent.type); | BOOST_CHECK_EQUAL(content.type, deserContent.type); | ||||
BOOST_CHECK_EQUAL_COLLECTIONS(content.hash.begin(), content.hash.end(), | BOOST_CHECK_EQUAL_COLLECTIONS(content.hash.begin(), content.hash.end(), | ||||
deserContent.hash.begin(), | deserContent.hash.begin(), | ||||
deserContent.hash.end()); | deserContent.hash.end()); | ||||
} | } | ||||
} | } | ||||
BOOST_AUTO_TEST_CASE(encode_decode_cashaddr_content) { | |||||
std::vector<CTxDestination> toTest = {CNoDestination{}, | |||||
PKHash(uint160S("badf00d")), | |||||
ScriptHash(uint160S("f00dbad"))}; | |||||
for (auto dst : toTest) { | |||||
CashAddrContent encoded = EncodeCashAddrContent(dst); | |||||
CTxDestination decoded = DecodeCashAddrDestination(encoded); | |||||
BOOST_CHECK(dst == decoded); | |||||
} | |||||
} | |||||
BOOST_AUTO_TEST_SUITE_END() | BOOST_AUTO_TEST_SUITE_END() |