mirror of
https://github.com/dashpay/dash.git
synced 2024-12-26 12:32:48 +01:00
Merge #12570: Add test cases for HexStr (std::reverse_iterator and corner cases)
ac48861
Add tests for HexStr std::reverse_iterator cases (Kosta Zertsekel)90eac8c
Add tests for HexStr corner cases (Kosta Zertsekel) Pull request description: Tree-SHA512: 6298d6fdc344e67a9ea6dc74eadb04e68f4f49fc4511d4a8765cafce7eeb8603f96ebedd82c13811326bcaf1ee511946419b651ca411f711baca91bec51947d6
This commit is contained in:
commit
39dcac27a1
@ -81,6 +81,20 @@ BOOST_AUTO_TEST_CASE(util_HexStr)
|
||||
HexStr(ParseHex_expected, ParseHex_expected + 5, true),
|
||||
"04 67 8a fd b0");
|
||||
|
||||
BOOST_CHECK_EQUAL(
|
||||
HexStr(ParseHex_expected + sizeof(ParseHex_expected),
|
||||
ParseHex_expected + sizeof(ParseHex_expected)),
|
||||
"");
|
||||
|
||||
BOOST_CHECK_EQUAL(
|
||||
HexStr(ParseHex_expected + sizeof(ParseHex_expected),
|
||||
ParseHex_expected + sizeof(ParseHex_expected), true),
|
||||
"");
|
||||
|
||||
BOOST_CHECK_EQUAL(
|
||||
HexStr(ParseHex_expected, ParseHex_expected),
|
||||
"");
|
||||
|
||||
BOOST_CHECK_EQUAL(
|
||||
HexStr(ParseHex_expected, ParseHex_expected, true),
|
||||
"");
|
||||
@ -90,6 +104,58 @@ BOOST_AUTO_TEST_CASE(util_HexStr)
|
||||
BOOST_CHECK_EQUAL(
|
||||
HexStr(ParseHex_vec, true),
|
||||
"04 67 8a fd b0");
|
||||
|
||||
BOOST_CHECK_EQUAL(
|
||||
HexStr(ParseHex_vec.rbegin(), ParseHex_vec.rend()),
|
||||
"b0fd8a6704"
|
||||
);
|
||||
|
||||
BOOST_CHECK_EQUAL(
|
||||
HexStr(ParseHex_vec.rbegin(), ParseHex_vec.rend(), true),
|
||||
"b0 fd 8a 67 04"
|
||||
);
|
||||
|
||||
BOOST_CHECK_EQUAL(
|
||||
HexStr(std::reverse_iterator<const uint8_t *>(ParseHex_expected),
|
||||
std::reverse_iterator<const uint8_t *>(ParseHex_expected)),
|
||||
""
|
||||
);
|
||||
|
||||
BOOST_CHECK_EQUAL(
|
||||
HexStr(std::reverse_iterator<const uint8_t *>(ParseHex_expected),
|
||||
std::reverse_iterator<const uint8_t *>(ParseHex_expected), true),
|
||||
""
|
||||
);
|
||||
|
||||
BOOST_CHECK_EQUAL(
|
||||
HexStr(std::reverse_iterator<const uint8_t *>(ParseHex_expected + 1),
|
||||
std::reverse_iterator<const uint8_t *>(ParseHex_expected)),
|
||||
"04"
|
||||
);
|
||||
|
||||
BOOST_CHECK_EQUAL(
|
||||
HexStr(std::reverse_iterator<const uint8_t *>(ParseHex_expected + 1),
|
||||
std::reverse_iterator<const uint8_t *>(ParseHex_expected), true),
|
||||
"04"
|
||||
);
|
||||
|
||||
BOOST_CHECK_EQUAL(
|
||||
HexStr(std::reverse_iterator<const uint8_t *>(ParseHex_expected + 5),
|
||||
std::reverse_iterator<const uint8_t *>(ParseHex_expected)),
|
||||
"b0fd8a6704"
|
||||
);
|
||||
|
||||
BOOST_CHECK_EQUAL(
|
||||
HexStr(std::reverse_iterator<const uint8_t *>(ParseHex_expected + 5),
|
||||
std::reverse_iterator<const uint8_t *>(ParseHex_expected), true),
|
||||
"b0 fd 8a 67 04"
|
||||
);
|
||||
|
||||
BOOST_CHECK_EQUAL(
|
||||
HexStr(std::reverse_iterator<const uint8_t *>(ParseHex_expected + 65),
|
||||
std::reverse_iterator<const uint8_t *>(ParseHex_expected)),
|
||||
"5f1df16b2b704c8a578d0bbaf74d385cde12c11ee50455f3c438ef4c3fbcf649b6de611feae06279a60939e028a8d65c10b73071a6f16719274855feb0fd8a6704"
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user