test-istream-crlf.c revision 5f5870385cff47efd2f58e7892f251cf13761528
/* Copyright (c) 2007-2012 Dovecot authors, see the included COPYING file */
#include "test-lib.h"
#include "str.h"
#include "istream-private.h"
#include "istream-crlf.h"
static void test_istream_crlf_input(const char *input)
{
const unsigned char *data;
for (j = 0; j < 4; j++) {
str_truncate(output, 0);
if (j%2 == 0) {
/* drop CRs */
for (i = 0; i < input_len; i++) {
if (input[i] == '\r' &&
;
else
}
} else {
/* add missing CRs */
for (i = 0; i < input_len; i++) {
if (input[i] == '\n' &&
}
}
pos = 0;
for (i = 1; i <= input_len; i++) {
if (j >= 2) {
crlf_istream = j%2 == 0 ?
pos = 0;
}
/* this is pretty evil */
}
}
}
}
}
void test_istream_crlf(void)
{
const char *input[] = {
"\rfoo",
"foo\nbar\r\nbaz\r\r\n",
"\r\nfoo",
"\r\r\n",
"\nfoo"
};
unsigned int i;
test_begin("istream crlf");
for (i = 0; i < N_ELEMENTS(input); i++)
test_end();
}