diff options
| author | Gavin Andresen <[email protected]> | 2011-09-30 05:04:26 -0700 |
|---|---|---|
| committer | Gavin Andresen <[email protected]> | 2011-09-30 05:04:26 -0700 |
| commit | f4769e44a326f61bdf47fa39346e1293b97e31c4 (patch) | |
| tree | e8980ee2a5dab3a1a2f1f8ac9cb83c8c0e8e0e9c /src/test/base64_tests.cpp | |
| parent | Merge pull request #542 from laanwj/qt2 (diff) | |
| parent | Use key recovery for message signatures (diff) | |
| download | discoin-f4769e44a326f61bdf47fa39346e1293b97e31c4.tar.xz discoin-f4769e44a326f61bdf47fa39346e1293b97e31c4.zip | |
Merge pull request #524 from sipa/signandverif
Sign and verify message with bitcoin address
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 000000000..f30f7f893 --- /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() |