test-istream-dot.c revision b3bf71e0c99a9ef00fe03c80ab92b2870c544fab
/* Copyright (c) 2007-2013 Dovecot authors, see the included COPYING file */
#include "lib.h"
#include "str.h"
#include "istream.h"
#include "istream-dot.h"
#include "test-common.h"
struct dot_test {
const char *input;
const char *output;
const char *parent_input;
};
bool send_last_lf, bool test_bufsize)
{
const unsigned char *data;
int ret;
if (!send_last_lf &&
output_len--;
if (output_len > 0 &&
output_len--;
}
}
if (!test_bufsize) {
outsize = 1; i = 0;
switch (ret) {
case -2:
/* seek one byte backwards so stream gets
reset */
/* go back to original position */
/* and finally allow reading one more byte */
break;
case 0:
test_istream_set_size(test_input, ++i);
break;
default:
test_assert(ret > 0);
}
}
(void)i_stream_read(test_input);
} else {
size = 0;
for (i = 1; i < output_len; i++) {
}
if (size < output_len)
}
}
static void test_istream_dot(void)
{
{ "..foo\n..\n.foo\n.\nfoo", ".foo\n.\nfoo\n", "foo" },
{ "..foo\r\n..\r\n.foo\r\n.\r\nfoo", ".foo\r\n.\r\nfoo\r\n", "foo" },
{ "\r.\r\n.\r\n", "\r.\r\n", "" },
{ "\n\r.\r\r\n.\r\n", "\n\r.\r\r\n", "" },
{ "\r\n.\r\n", "\r\n", "" },
{ "\n.\r\n", "\n", "" },
{ "\n.\n", "\n", "" },
{ "\n.", "\n", "" },
{ ".", "", "" }
};
unsigned int i;
test_begin("dot istream");
for (i = 0; i < N_ELEMENTS(tests); i++) {
}
test_end();
}
int main(void)
{
static void (*test_functions[])(void) = {
};
return test_run(test_functions);
}