aboutsummaryrefslogtreecommitdiff
path: root/src/test/base58_tests.cpp
diff options
context:
space:
mode:
authorWladimir J. van der Laan <laanwj@gmail.com>2014-02-25 16:23:18 +0100
committerWladimir J. van der Laan <laanwj@gmail.com>2014-02-25 16:24:03 +0100
commit319860429311b4ed96356aea877dd056a18fb80e (patch)
tree82c370feb785e1744658b2c1808c5b9d5e464436 /src/test/base58_tests.cpp
parenta16ad1c0f465935d437bd9ae9875b28be49ec65b (diff)
parenta3138ed42b1fc8933b82127706238660099cc122 (diff)
Merge pull request #3712
a3138ed add test of DecodeBase58 skipping whitespace (Christian von Roques)
Diffstat (limited to 'src/test/base58_tests.cpp')
-rw-r--r--src/test/base58_tests.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/test/base58_tests.cpp b/src/test/base58_tests.cpp
index 84db99d816..94e84049be 100644
--- a/src/test/base58_tests.cpp
+++ b/src/test/base58_tests.cpp
@@ -63,6 +63,12 @@ BOOST_AUTO_TEST_CASE(base58_DecodeBase58)
}
BOOST_CHECK(!DecodeBase58("invalid", result));
+
+ // check that DecodeBase58 skips whitespace, but still fails with unexpected non-whitespace at the end.
+ BOOST_CHECK(!DecodeBase58(" \t\n\v\f\r skip \r\f\v\n\t a", result));
+ BOOST_CHECK( DecodeBase58(" \t\n\v\f\r skip \r\f\v\n\t ", result));
+ std::vector<unsigned char> expected = ParseHex("971a55");
+ BOOST_CHECK_EQUAL_COLLECTIONS(result.begin(), result.end(), expected.begin(), expected.end());
}
// Visitor to check address type