blockfilter: Functions to translate filter types to/from names.

This commit is contained in:
Jim Posen
2018-08-27 15:42:35 -07:00
parent 62b7a4f094
commit ba6ff9a6f7
3 changed files with 40 additions and 0 deletions

View File

@@ -174,4 +174,16 @@ BOOST_AUTO_TEST_CASE(blockfilters_json_test)
}
}
BOOST_AUTO_TEST_CASE(blockfilter_type_names)
{
BOOST_CHECK_EQUAL(BlockFilterTypeName(BlockFilterType::BASIC), "basic");
BOOST_CHECK_EQUAL(BlockFilterTypeName(static_cast<BlockFilterType>(255)), "");
BlockFilterType filter_type;
BOOST_CHECK(BlockFilterTypeByName("basic", filter_type));
BOOST_CHECK_EQUAL(filter_type, BlockFilterType::BASIC);
BOOST_CHECK(!BlockFilterTypeByName("unknown", filter_type));
}
BOOST_AUTO_TEST_SUITE_END()