Four macros were added : - TTAIL_CHECK_START(char *test_suite_str, char *test_case_str) - TTAIL_SET_FIXTURE(void (*setup)(), void (*teardown)()) - TTAIL_ADD_TEST( libcheck_test test) - TTAIL_CHECK_END
40 lines
1,014 B
C
40 lines
1,014 B
C
#include <check.h>
|
|
#include <stdio.h>
|
|
#include <libgen.h>
|
|
|
|
#include "ttail_check.h"
|
|
#include "ttail.h"
|
|
#include "ttail_init.h"
|
|
#include "ttail_search.h"
|
|
|
|
/*
|
|
* _ttail_file_minmax() tests
|
|
*/
|
|
START_TEST (test_file_minmax1)
|
|
{
|
|
/**@todo complete the testcase */
|
|
int r;
|
|
struct tm tm[2];
|
|
ttail->flag |= TTAIL_FLAG_PREFIX;
|
|
ttail->prefix_sz = 0;
|
|
ttail_set_fmt(ttail, "%b%n%d %H:%M");
|
|
r = ttail_search_files_init(ttail);
|
|
ck_assert_int_eq(r, 0);
|
|
r = _ttail_file_minmax(ttail, 0, tm);
|
|
ck_assert_int_eq(r, 0);
|
|
ck_assert_int_eq(tm[0].tm_mon, 2);
|
|
ck_assert_int_eq(tm[0].tm_mday, 6);
|
|
ck_assert_int_eq(tm[0].tm_hour, 0);
|
|
ck_assert_int_eq(tm[0].tm_min, 1);
|
|
ck_assert_int_eq(tm[1].tm_mon, 2);
|
|
ck_assert_int_eq(tm[1].tm_mday, 6);
|
|
ck_assert_int_eq(tm[1].tm_hour, 0);
|
|
ck_assert_int_eq(tm[1].tm_min, 29);
|
|
}
|
|
END_TEST
|
|
|
|
TTAIL_CHECK_START("ttail search_files checks", "ttail_file_minmax() checks")
|
|
TTAIL_SET_FIXTURE(setup_closest_fileinit, teardown_closest_fileinit);
|
|
TTAIL_ADD_TEST(test_file_minmax1);
|
|
TTAIL_CHECK_END
|
|
|