diff options
author | Wladimir J. van der Laan <laanwj@gmail.com> | 2011-09-30 17:39:29 +0200 |
---|---|---|
committer | Wladimir J. van der Laan <laanwj@gmail.com> | 2011-09-30 17:39:29 +0200 |
commit | 52e9fe929615d339732c060573b0637c51e353dc (patch) | |
tree | b74ae9a0e2db67f7668c9d8235209d3f84796b71 /src/test/base64_tests.cpp | |
parent | 8f1631b797f35b377764eaa94b8cdc6489dc292e (diff) | |
parent | f4769e44a326f61bdf47fa39346e1293b97e31c4 (diff) |
Merge branch 'master' of https://github.com/bitcoin/bitcoin
Diffstat (limited to 'src/test/base64_tests.cpp')
-rw-r--r-- | src/test/base64_tests.cpp | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/test/base64_tests.cpp b/src/test/base64_tests.cpp new file mode 100644 index 0000000000..f30f7f8936 --- /dev/null +++ b/src/test/base64_tests.cpp @@ -0,0 +1,20 @@ +#include <boost/test/unit_test.hpp> + +#include "../util.h" + +BOOST_AUTO_TEST_SUITE(base64_tests) + +BOOST_AUTO_TEST_CASE(base64_testvectors) +{ + static const string vstrIn[] = {"","f","fo","foo","foob","fooba","foobar"}; + static const string vstrOut[] = {"","Zg==","Zm8=","Zm9v","Zm9vYg==","Zm9vYmE=","Zm9vYmFy"}; + for (int i=0; i<sizeof(vstrIn)/sizeof(vstrIn[0]); i++) + { + string strEnc = EncodeBase64(vstrIn[i]); + BOOST_CHECK(strEnc == vstrOut[i]); + string strDec = DecodeBase64(strEnc); + BOOST_CHECK(strDec == vstrIn[i]); + } +} + +BOOST_AUTO_TEST_SUITE_END() |