Changeset View
Changeset View
Standalone View
Standalone View
src/test/util_tests.cpp
Show First 20 Lines • Show All 58 Lines • ▼ Show 20 Lines | BOOST_AUTO_TEST_CASE(util_ParseHex) { | ||||
BOOST_CHECK_EQUAL_COLLECTIONS(result.begin(), result.end(), | BOOST_CHECK_EQUAL_COLLECTIONS(result.begin(), result.end(), | ||||
expected.begin(), expected.end()); | expected.begin(), expected.end()); | ||||
// Spaces between bytes must be supported | // Spaces between bytes must be supported | ||||
result = ParseHex("12 34 56 78"); | result = ParseHex("12 34 56 78"); | ||||
BOOST_CHECK(result.size() == 4 && result[0] == 0x12 && result[1] == 0x34 && | BOOST_CHECK(result.size() == 4 && result[0] == 0x12 && result[1] == 0x34 && | ||||
result[2] == 0x56 && result[3] == 0x78); | result[2] == 0x56 && result[3] == 0x78); | ||||
// Leading space must be supported (used in CDBEnv::Salvage) | // Leading space must be supported (used in BerkeleyEnvironment::Salvage) | ||||
result = ParseHex(" 89 34 56 78"); | result = ParseHex(" 89 34 56 78"); | ||||
BOOST_CHECK(result.size() == 4 && result[0] == 0x89 && result[1] == 0x34 && | BOOST_CHECK(result.size() == 4 && result[0] == 0x89 && result[1] == 0x34 && | ||||
result[2] == 0x56 && result[3] == 0x78); | 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); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 1,353 Lines • Show Last 20 Lines |