43 lines
872 B
C
43 lines
872 B
C
#include <check.h>
|
|
#include <errno.h>
|
|
#include <stdio.h>
|
|
#include <unistd.h>
|
|
|
|
#include "ttail_check.h"
|
|
#include "ttail.h"
|
|
#include "ttail_init.h"
|
|
|
|
START_TEST (test_init_check_bad1)
|
|
{
|
|
ck_assert_int_eq(ttail_init_check(ttail), -1);
|
|
}
|
|
END_TEST
|
|
|
|
START_TEST (test_init_check1)
|
|
{
|
|
char *arg[] = {"88/10/22", NULL};
|
|
struct tm zero;
|
|
char *arg0;
|
|
|
|
arg0 = malloc(sizeof(char)*(strlen(arg[0])+1));
|
|
if(!arg0)
|
|
{
|
|
perror("Malloc failed for argument");
|
|
ck_abort_msg("Unable to allocate memory");
|
|
}
|
|
strcpy(arg0, arg[0]);
|
|
arg[0]=arg0;
|
|
|
|
memset(&zero, 0, sizeof(struct tm));
|
|
|
|
ttail_set_dates(ttail, arg);
|
|
ck_assert_int_eq(ttail_init_check(ttail), 0);
|
|
}
|
|
END_TEST
|
|
|
|
TTAIL_CHECK_START("ttail init checks", "ttail_init_check() checks")
|
|
TTAIL_SET_FIXTURE(setup_ttail_empty, teardown_ttail);
|
|
TTAIL_ADD_TEST(test_init_check_bad1);
|
|
TTAIL_ADD_TEST(test_init_check1);
|
|
TTAIL_CHECK_END
|
|
|