You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

base64_tests.cpp 662B

12345678910111213141516171819202122
  1. #include <boost/test/unit_test.hpp>
  2. #include "main.h"
  3. #include "wallet.h"
  4. #include "util.h"
  5. BOOST_AUTO_TEST_SUITE(base64_tests)
  6. BOOST_AUTO_TEST_CASE(base64_testvectors)
  7. {
  8. static const std::string vstrIn[] = {"","f","fo","foo","foob","fooba","foobar"};
  9. static const std::string vstrOut[] = {"","Zg==","Zm8=","Zm9v","Zm9vYg==","Zm9vYmE=","Zm9vYmFy"};
  10. for (unsigned int i=0; i<sizeof(vstrIn)/sizeof(vstrIn[0]); i++)
  11. {
  12. std::string strEnc = EncodeBase64(vstrIn[i]);
  13. BOOST_CHECK(strEnc == vstrOut[i]);
  14. std::string strDec = DecodeBase64(strEnc);
  15. BOOST_CHECK(strDec == vstrIn[i]);
  16. }
  17. }
  18. BOOST_AUTO_TEST_SUITE_END()