test-strfuncs.c revision e2d420dc4bbb06de56ca225c1d9eb79456c792c5
/* Copyright (c) 2009-2016 Dovecot authors, see the included COPYING file */
#include "test-lib.h"
#include "array.h"
static void test_p_strarray_dup(void)
{
const char *input[][3] = {
{ NULL },
{ "a", NULL },
{ "foobar", NULL },
};
const char **ret;
unsigned int i, j;
test_begin("p_strarray_dup");
for (i = 0; i < N_ELEMENTS(input); i++) {
}
}
test_end();
}
static void test_t_strsplit(void)
{
const char *const *args;
test_begin("t_strsplit");
/* empty string -> empty array. was this perhaps a mistake for the
API to do this originally?.. can't really change now anyway. */
/* two empty strings */
test_end();
}
static void strsplit_verify(const char *str)
{
T_BEGIN {
unsigned int i;
} T_END;
}
static void test_t_strsplit_tab(void)
{
char buf[4096];
unsigned int i, j, max;
test_begin("t_strsplit_tab");
strsplit_verify("");
strsplit_verify("\t");
strsplit_verify("\t\t");
strsplit_verify("foo");
strsplit_verify("foo\tbar");
strsplit_verify("foo\tbar\tbaz");
strsplit_verify("foo\t\tbaz");
for (i = 0; i < sizeof(buf)-1; i++)
buf[i] = '\t';
for (j = 0; j < 256; j++) {
}
for (j = 0; j < 100; j++) {
for (i = 0; i < max; i++) {
if (rand() % 10 == 0)
buf[i] = '\t';
else
buf[i] = 'x';
}
}
test_end();
}
static void test_t_str_replace(void)
{
test_begin("t_str_replace");
test_end();
}
static void test_t_str_trim(void)
{
test_begin("t_str_trim");
test_end();
}
static void test_t_str_ltrim(void)
{
test_begin("t_str_ltrim");
test_end();
}
static void test_t_str_rtrim(void)
{
test_begin("t_str_rtrim");
test_end();
}
static const char *const test_strarray_input[] = {
};
static struct {
const char *separator;
const char *output;
} test_strarray_outputs[] = {
{ "", "helloworldyay" },
/* FIXME: v2.3 - test_output should have separator in the beginning */
{ " ", "hello world yay " },
{ "!-?", "hello!-?world!-?!-?yay!-?" }
};
static void test_t_strarray_join(void)
{
unsigned int i;
test_begin("t_strarray_join()");
/* empty array -> empty string */
for (i = 0; i < N_ELEMENTS(test_strarray_outputs); i++) {
test_strarray_outputs[i].output) == 0, i);
}
test_end();
}
static void test_p_array_const_string_join(void)
{
unsigned int i;
char *res;
test_begin("p_array_const_string_join()");
/* empty array -> empty string */
for (i = 0; i < N_ELEMENTS(test_strarray_outputs); i++) {
}
array_free(&arr);
test_end();
}
void test_strfuncs(void)
{
}