From a3138ed42b1fc8933b82127706238660099cc122 Mon Sep 17 00:00:00 2001 From: Christian von Roques Date: Wed, 19 Sep 2012 09:31:15 +0200 Subject: [PATCH] add test of DecodeBase58 skipping whitespace --- src/test/base58_tests.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/test/base58_tests.cpp b/src/test/base58_tests.cpp index 7602fa93a..0c51e4f69 100644 --- a/src/test/base58_tests.cpp +++ b/src/test/base58_tests.cpp @@ -55,6 +55,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 expected = ParseHex("971a55"); + BOOST_CHECK_EQUAL_COLLECTIONS(result.begin(), result.end(), expected.begin(), expected.end()); } // Visitor to check address type