Browse Source

Merge #7536: test: test leading spaces for ParseHex

f31b6b8 test: test leading space for ParseHex (Wladimir J. van der Laan)
0.13
Wladimir J. van der Laan 9 years ago
parent
commit
ce5fc02e61
No known key found for this signature in database
GPG Key ID: 74810B012346C9A6
  1. 4
      src/test/util_tests.cpp

4
src/test/util_tests.cpp

@ -60,6 +60,10 @@ BOOST_AUTO_TEST_CASE(util_ParseHex)
result = ParseHex("12 34 56 78"); result = ParseHex("12 34 56 78");
BOOST_CHECK(result.size() == 4 && result[0] == 0x12 && result[1] == 0x34 && result[2] == 0x56 && result[3] == 0x78); BOOST_CHECK(result.size() == 4 && result[0] == 0x12 && result[1] == 0x34 && result[2] == 0x56 && result[3] == 0x78);
// Leading space must be supported (used in CDBEnv::Salvage)
result = ParseHex(" 89 34 56 78");
BOOST_CHECK(result.size() == 4 && result[0] == 0x89 && result[1] == 0x34 && result[2] == 0x56 && result[3] == 0x78);
// Stop parsing at invalid value // Stop parsing at invalid value
result = ParseHex("1234 invalid 1234"); result = ParseHex("1234 invalid 1234");
BOOST_CHECK(result.size() == 2 && result[0] == 0x12 && result[1] == 0x34); BOOST_CHECK(result.size() == 2 && result[0] == 0x12 && result[1] == 0x34);

Loading…
Cancel
Save