Skip to content

Commit a3138ed

Browse files
roquesluke-jr
authored andcommitted
add test of DecodeBase58 skipping whitespace
1 parent 44d7f4c commit a3138ed

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/test/base58_tests.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,12 @@ BOOST_AUTO_TEST_CASE(base58_DecodeBase58)
5555
}
5656

5757
BOOST_CHECK(!DecodeBase58("invalid", result));
58+
59+
// check that DecodeBase58 skips whitespace, but still fails with unexpected non-whitespace at the end.
60+
BOOST_CHECK(!DecodeBase58(" \t\n\v\f\r skip \r\f\v\n\t a", result));
61+
BOOST_CHECK( DecodeBase58(" \t\n\v\f\r skip \r\f\v\n\t ", result));
62+
std::vector<unsigned char> expected = ParseHex("971a55");
63+
BOOST_CHECK_EQUAL_COLLECTIONS(result.begin(), result.end(), expected.begin(), expected.end());
5864
}
5965

6066
// Visitor to check address type

0 commit comments

Comments
 (0)