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