test-array.c revision 5d017bb2f0820b8a8d6b4e965435b78860dc9559
/* Copyright (c) 2007-2014 Dovecot authors, see the included COPYING file */
#include "test-lib.h"
#include "array.h"
#include <stdlib.h> /* rand() */
struct foo {
unsigned int a, b, c;
};
static void test_array_foreach(void)
{
unsigned int i;
test_begin("array foreach");
for (i = 0; i < 10; i++) {
}
test_assert(foo->a == i);
test_assert(foo->b == i);
test_assert(foo->c == i);
}
test_end();
}
static void test_array_reverse(void)
{
const int *output;
unsigned int i, j;
test_begin("array reverse");
for (i = 0; i <= N_ELEMENTS(input); i++) {
for (j = 0; j < i; j++)
}
test_end();
}
{
: 0;
}
static int test_compare_ushort_fuzz(const unsigned short *c1, const unsigned short *c2, const int *pfuzz)
{
return 0;
return d;
}
static void test_array_cmp(void)
{
static const unsigned short deltas[] = {
-32768, -16384, -512, -256, -128, -64, -2, -1,
0, 1, 2, 64, 128, 256, 512, 16384, 32768
};
#define NELEMS 5u
unsigned int i;
int fuzz;
test_begin("array compare (ushort)");
for (i = 0; i < NELEMS; i++) {
}
fuzz = 0;
for (i = 0; i < 256; i++) {
if (fuzz < 0)
if (fuzz > 0) {
fuzz--;
}
fuzz = 0;
}
test_end();
}
{
}
static void test_array_cmp_str(void)
{
#define NELEMS 5u
unsigned int i;
test_begin("array compare (char*)");
for (i = 0; i < NELEMS; i++) {
}
for (i = 0; i < 2560; i++) {
char buf[12];
}
/* length differences being detected are tested in other tests */
test_end();
}
void test_array(void)
{
}
{
switch(stage) {
case 0: {
test_begin("fatal_array");
return FATAL_TEST_FAILURE;
} break;
case 1: {
return FATAL_TEST_FAILURE;
} break;
}
test_end();
return FATAL_TEST_FINISHED;
}