binary.cpp
#include <zorba/zorba.h>
#include <zorba/util/base64_util.h>
#include <iostream>
using namespace zorba;
bool
encode_example()
{
String const lString("Hello Zorba");
String lEncoded;
base64::encode(lString, &lEncoded);
return lEncoded == "SGVsbG8gWm9yYmE=";
}
bool
decode_example()
{
String const lEncoded("SGVsbG8gWm9yYmE=");
String lDecoded;
base64::decode(lEncoded, &lDecoded);
return lDecoded == "Hello Zorba";
}
int binary(int argc, char* argv[]) {
std::cout << "executing example 1 (Base64 encoding of String)" << std::endl;
if (!encode_example()) return 1;
std::cout << "executing example 2 (decoding of Base64 encoded String)" << std::endl;
if (!decode_example()) return 1;
return 0;
}