aboutsummaryrefslogtreecommitdiff
path: root/src/test
diff options
context:
space:
mode:
authorWladimir J. van der Laan <laanwj@gmail.com>2016-02-15 15:50:28 +0100
committerWladimir J. van der Laan <laanwj@gmail.com>2016-02-15 17:14:30 +0100
commitf31b6b899568e976eb9c18bc899e9e8328b524b5 (patch)
tree803fcdb36c3b8d0b95886018d640ce64ed7f0b38 /src/test
parentbf1e113311fe225c9a3a78f9d0fb5e43974573b7 (diff)
test: test leading space for ParseHex
BerkeleyDB dump files have key and value lines indented. The salvage code passes these to ParseHex as-is. Check this in the tests (should just pass with current code).
Diffstat (limited to 'src/test')
-rw-r--r--src/test/util_tests.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/test/util_tests.cpp b/src/test/util_tests.cpp
index 01bc2032d0..43e8ae9b36 100644
--- a/src/test/util_tests.cpp
+++ b/src/test/util_tests.cpp
@@ -60,6 +60,10 @@ BOOST_AUTO_TEST_CASE(util_ParseHex)
result = ParseHex("12 34 56 78");
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
result = ParseHex("1234 invalid 1234");
BOOST_CHECK(result.size() == 2 && result[0] == 0x12 && result[1] == 0x34);