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