test-quoted-printable.c revision 2f67f2fbb4b145ce7ba39ef9f15932aeadeb1747
/* Copyright (c) 2007-2012 Dovecot authors, see the included COPYING file */
#include "lib.h"
#include "buffer.h"
#include "str.h"
#include "quoted-printable.h"
#include "test-common.h"
struct test_quoted_printable_decode_data {
const char *input;
const char *output;
int end_skip;
};
static void test_quoted_printable_decode(void)
{
static struct test_quoted_printable_decode_data data[] = {
{ "foo \r\nbar=", "foo\r\nbar", 1 },
{ "foo\t=\nbar", "foo\tbar", 0 },
{ "foo = \n=01", "foo \001", 0 },
{ "foo =\t\r\nbar", "foo bar", 0 },
{ "foo =\r\n=01", "foo \001", 0 },
{ "foo \nbar=", "foo\r\nbar", 1 },
{ "=0A=0D ", "\n\r", 2 },
{ "foo_bar", "foo_bar", 0 },
{ "foo=", "foo", 1 },
{ "foo=A", "foo", 2 },
{ "foo=Ax", "foo=Ax", 0 },
{ "foo=Ax=xy", "foo=Ax=xy", 0 }
};
test_begin("quoted printable decode");
for (i = 0; i < N_ELEMENTS(data); i++) {
buffer_set_used_size(buf, 0);
end++;
else
}
buffer_set_used_size(buf, 0);
}
test_end();
}
static void test_quoted_printable_q_decode(void)
{
const char *data[] = {
"=0A=0D ", "\n\r ",
"__foo__bar__", " foo bar ",
"foo=", "foo=",
"foo=A", "foo=A",
"foo=Ax", "foo=Ax",
"foo=Ax=xy", "foo=Ax=xy"
};
unsigned int i;
test_begin("quoted printable q decode");
buf);
buffer_set_used_size(buf, 0);
}
test_end();
}
int main(void)
{
static void (*test_functions[])(void) = {
};
return test_run(test_functions);
}