25 #define MAX_DATA_SIZE 1024 26 #define MAX_ENCODED_SIZE 2048 29 const char *encoded_ref)
36 printf(
"Failed: cannot encode the input data\n");
39 if (encoded_ref && strcmp(encoded, encoded_ref)) {
40 printf(
"Failed: encoded string differs from reference\n" 41 "Encoded:\n%s\nReference:\n%s\n", encoded, encoded_ref);
46 printf(
"Failed: cannot decode the encoded string\n" 47 "Encoded:\n%s\n", encoded);
50 if (memcmp(data2, data, data_size)) {
51 printf(
"Failed: encoded/decoded data differs from original data\n");
61 int i, error_count = 0;
64 const char *encoded_ref;
70 {
"4444",
"NDQ0NA=="},
71 {
"55555",
"NTU1NTU="},
72 {
"666666",
"NjY2NjY2"},
73 {
"abc:def",
"YWJjOmRlZg=="},
76 printf(
"Encoding/decoding tests\n");
81 printf(
"Error Count: %d.\n", error_count);
static int test_encode_decode(const uint8_t *data, unsigned int data_size, const char *encoded_ref)
#define FF_ARRAY_ELEMS(a)
char * av_base64_encode(char *out, int out_size, const uint8_t *in, int in_size)
Encode data to base64 and null-terminate.
static const struct @172 tests[]
static void test(const char *pattern, const char *host)
common internal and external API header
int av_base64_decode(uint8_t *out, const char *in, int out_size)
Decode a base64-encoded string.