Changeset View
Changeset View
Standalone View
Standalone View
src/test/blockfilter_tests.cpp
Show First 20 Lines • Show All 110 Lines • ▼ Show 20 Lines | BOOST_AUTO_TEST_CASE(blockfilter_basic_test) { | ||||
// Test serialization/unserialization. | // Test serialization/unserialization. | ||||
BlockFilter block_filter2; | BlockFilter block_filter2; | ||||
CDataStream stream(SER_NETWORK, PROTOCOL_VERSION); | CDataStream stream(SER_NETWORK, PROTOCOL_VERSION); | ||||
stream << block_filter; | stream << block_filter; | ||||
stream >> block_filter2; | stream >> block_filter2; | ||||
BOOST_CHECK_EQUAL(block_filter.GetFilterType(), | BOOST_CHECK(block_filter.GetFilterType() == block_filter2.GetFilterType()); | ||||
block_filter2.GetFilterType()); | |||||
BOOST_CHECK(block_filter.GetBlockHash() == block_filter2.GetBlockHash()); | BOOST_CHECK(block_filter.GetBlockHash() == block_filter2.GetBlockHash()); | ||||
BOOST_CHECK(block_filter.GetEncodedFilter() == | BOOST_CHECK(block_filter.GetEncodedFilter() == | ||||
block_filter2.GetEncodedFilter()); | block_filter2.GetEncodedFilter()); | ||||
BlockFilter default_ctor_block_filter_1; | |||||
BlockFilter default_ctor_block_filter_2; | |||||
BOOST_CHECK(default_ctor_block_filter_1.GetFilterType() == | |||||
default_ctor_block_filter_2.GetFilterType()); | |||||
BOOST_CHECK(default_ctor_block_filter_1.GetBlockHash() == | |||||
default_ctor_block_filter_2.GetBlockHash()); | |||||
BOOST_CHECK(default_ctor_block_filter_1.GetEncodedFilter() == | |||||
default_ctor_block_filter_2.GetEncodedFilter()); | |||||
} | } | ||||
BOOST_AUTO_TEST_CASE(blockfilters_json_test) { | BOOST_AUTO_TEST_CASE(blockfilters_json_test) { | ||||
UniValue json; | UniValue json; | ||||
std::string json_data(json_tests::blockfilters, | std::string json_data(json_tests::blockfilters, | ||||
json_tests::blockfilters + | json_tests::blockfilters + | ||||
sizeof(json_tests::blockfilters)); | sizeof(json_tests::blockfilters)); | ||||
if (!json.read(json_data) || !json.isArray()) { | if (!json.read(json_data) || !json.isArray()) { | ||||
▲ Show 20 Lines • Show All 54 Lines • Show Last 20 Lines |