Changeset View
Changeset View
Standalone View
Standalone View
src/test/inv_tests.cpp
Show All 18 Lines | |||||
BOOST_AUTO_TEST_CASE(validate_kind) { | BOOST_AUTO_TEST_CASE(validate_kind) { | ||||
CheckType(GetDataMsg::UNDEFINED, GetDataMsg::UNDEFINED, false, false); | CheckType(GetDataMsg::UNDEFINED, GetDataMsg::UNDEFINED, false, false); | ||||
CheckType(GetDataMsg::MSG_TX, GetDataMsg::MSG_TX, true, false); | CheckType(GetDataMsg::MSG_TX, GetDataMsg::MSG_TX, true, false); | ||||
CheckType(GetDataMsg::MSG_BLOCK, GetDataMsg::MSG_BLOCK, false, true); | CheckType(GetDataMsg::MSG_BLOCK, GetDataMsg::MSG_BLOCK, false, true); | ||||
CheckType(GetDataMsg::MSG_FILTERED_BLOCK, GetDataMsg::MSG_FILTERED_BLOCK, | CheckType(GetDataMsg::MSG_FILTERED_BLOCK, GetDataMsg::MSG_FILTERED_BLOCK, | ||||
false, true); | false, true); | ||||
CheckType(GetDataMsg::MSG_CMPCT_BLOCK, GetDataMsg::MSG_CMPCT_BLOCK, false, | CheckType(GetDataMsg::MSG_CMPCT_BLOCK, GetDataMsg::MSG_CMPCT_BLOCK, false, | ||||
true); | true); | ||||
CheckType(GetDataMsg::MSG_EXT_TX, GetDataMsg::MSG_TX, true, false); | |||||
CheckType(GetDataMsg::MSG_EXT_BLOCK, GetDataMsg::MSG_BLOCK, false, true); | |||||
} | } | ||||
static void CheckCommand(int type, std::string expected) { | static void CheckCommand(int type, std::string expected) { | ||||
CInv inv(type, uint256()); | CInv inv(type, uint256()); | ||||
BOOST_CHECK_EQUAL(inv.GetCommand(), expected); | BOOST_CHECK_EQUAL(inv.GetCommand(), expected); | ||||
} | } | ||||
/* Validate various inv facilities. */ | /* Validate various inv facilities. */ | ||||
BOOST_AUTO_TEST_CASE(validate_cmd) { | BOOST_AUTO_TEST_CASE(validate_cmd) { | ||||
CheckCommand(GetDataMsg::MSG_TX, "tx"); | CheckCommand(GetDataMsg::MSG_TX, "tx"); | ||||
CheckCommand(GetDataMsg::MSG_BLOCK, "block"); | CheckCommand(GetDataMsg::MSG_BLOCK, "block"); | ||||
CheckCommand(GetDataMsg::MSG_FILTERED_BLOCK, "merkleblock"); | CheckCommand(GetDataMsg::MSG_FILTERED_BLOCK, "merkleblock"); | ||||
CheckCommand(GetDataMsg::MSG_CMPCT_BLOCK, "cmpctblock"); | CheckCommand(GetDataMsg::MSG_CMPCT_BLOCK, "cmpctblock"); | ||||
CheckCommand(GetDataMsg::MSG_EXT_TX, "extblk-tx"); | |||||
CheckCommand(GetDataMsg::MSG_EXT_BLOCK, "extblk-block"); | |||||
} | } | ||||
BOOST_AUTO_TEST_SUITE_END() | BOOST_AUTO_TEST_SUITE_END() |