2 * Test case for base 64 encoder/decoder in Gammu
12 #include "../libgammu/misc/coding/coding.h"
15 static const char base64
[] =
16 "TWFuIGlzIGRpc3Rpbmd1aXNoZWQsIG5vdCBvbmx5IGJ5IGhpcyByZWFzb24sIGJ1dCBieSB0aGlz"
17 "IHNpbmd1bGFyIHBhc3Npb24gZnJvbSBvdGhlciBhbmltYWxzLCB3aGljaCBpcyBhIGx1c3Qgb2Yg"
18 "dGhlIG1pbmQsIHRoYXQgYnkgYSBwZXJzZXZlcmFuY2Ugb2YgZGVsaWdodCBpbiB0aGUgY29udGlu"
19 "dWVkIGFuZCBpbmRlZmF0aWdhYmxlIGdlbmVyYXRpb24gb2Yga25vd2xlZGdlLCBleGNlZWRzIHRo"
20 "ZSBzaG9ydCB2ZWhlbWVuY2Ugb2YgYW55IGNhcm5hbCBwbGVhc3VyZS4=";
22 static const char text
[] = "Man is distinguished, not only by his reason, but by this singular passion from other animals, which is a lust of the mind, that by a perseverance of delight in the continued and indefatigable generation of knowledge, exceeds the short vehemence of any carnal pleasure.";
25 int main(int argc UNUSED
, char **argv UNUSED
)
31 decoded
= malloc(sizeof(base64
));
32 encoded
= malloc(sizeof(base64
));
35 len
= DecodeBASE64(base64
, decoded
, strlen(base64
));
38 test_result(len
== strlen(text
));
39 test_result(strcmp(decoded
, text
) == 0);
41 EncodeBASE64(text
, encoded
, strlen(text
));
43 test_result(strcmp(base64
, encoded
) == 0);
51 /* Editor configuration
52 * vim: noexpandtab sw=8 ts=8 sts=8 tw=72: