aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian von Roques <roques@mti.ag>2012-09-19 09:31:15 +0200
committerLuke Dashjr <luke-jr+git@utopios.org>2014-02-21 01:01:48 +0000
commita3138ed42b1fc8933b82127706238660099cc122 (patch)
treea6ce102a54c4fd54c00496226f4f10f0b9b155c2
parent44d7f4cbebd446f8f4a48ff9048d4549c0e2448a (diff)
add test of DecodeBase58 skipping whitespace
-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 7602fa93a6..0c51e4f69b 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<unsigned char> expected = ParseHex("971a55");
+ BOOST_CHECK_EQUAL_COLLECTIONS(result.begin(), result.end(), expected.begin(), expected.end());
}
// Visitor to check address type