/* Copyright (c) 2009-2018 Dovecot authors, see the included COPYING file */
#include "test-lib.h"
#include "istream-private.h"
#include "istream-seekable.h"
#include <fcntl.h>
#include <unistd.h>
{
int fd;
*path_r = "test-lib.tmp";
if (fd == -1)
else
return fd;
}
{
const unsigned char *data;
unsigned int i, j;
for (i = 0; i < STREAM_COUNT; i++) {
test_istream_set_size(streams[i], 0);
}
for (i = 0; i/STREAM_BYTES < STREAM_COUNT; i++) {
if (i < buffer_size) {
} else {
}
for (j = 0; j < size; j++) {
}
}
for (i = 0; i < STREAM_COUNT; i++) {
i_stream_unref(&streams[i]);
}
}
static void test_istream_seekable_random(void)
{
const unsigned char *data;
unsigned char *w_data;
for (i = 0, offset = 0; i < stream_count; i++) {
for (j = 0; j < data_len; j++)
}
/* first read it through */
while (i_stream_read(input) > 0) {
}
i_stream_seek(input, 0);
for (i = 0; i < 100; i++) {
if (i_rand_limit(3) == 0) {
} else {
test_assert(ret < 0);
else if (ret == -2) {
} else {
test_assert(ret > 0);
for (j = 0; j < size; j++) {
}
}
}
}
for (i = 0; i < stream_count; i++) {
i_stream_unref(&streams[i]);
}
}
static void test_istream_seekable_eof(void)
{
const unsigned char *data;
test_begin("istream seekable eof");
i_stream_unref(&streams[0]);
test_end();
}
static void test_istream_seekable_early_end(void)
{
test_begin("istream seekable early end");
i_stream_unref(&streams[0]);
test_end();
}
void test_istream_seekable(void)
{
unsigned int i;
test_begin("istream seekable");
test_end();
test_begin("istream seekable random");
for (i = 0; i < 100; i++) T_BEGIN {
} T_END;
test_end();
}