Compare commits

...

1 commit

Author SHA1 Message Date
abe01c0733 Add test for _ttail_file_search_from_end
And updated doxygen todo list
2017-06-05 13:52:52 +02:00
4 changed files with 23 additions and 5 deletions

View file

@ -32,7 +32,6 @@
#include "ttail.h"
/**@todo set logfiles as "leadings" option */
#define TTAIL_LONG_OPT {\
{"date-min", required_argument, 0, 'd'},\
{"date-max", required_argument, 0, 'm'},\
@ -291,7 +290,6 @@ int _ttail_set_date_fmt(ttail_t*, char*, int);
*@param char*[2] dates {min,max} both can be NULL
*@param int c the date id to handle
*@return -1 if error 0 else
*@todo checks
*/
int _ttail_set_date_relative(ttail_t*, char*, int);

View file

@ -188,7 +188,6 @@ inline int _ttail_file_minmax(ttail_t*, size_t, struct tm[2]);
*@param ttail_t* ttail
*@param struct tm** ftm : files min and max date
*@return 0 on success -1 if error
*@todo write tests
*/
inline int _ttail_file_sort(ttail_t*, struct tm**);
@ -215,7 +214,6 @@ inline long _ttail_file_start_line(ttail_t*, size_t);
*@param id size_t
*@param tm const struct tm*
*@return -1 on error else the offset of the line first chr
*@todo checks
*/
inline off_t _ttail_file_search_from_end(ttail_t*, size_t, const struct tm*);

View file

@ -303,7 +303,7 @@ int ttail_set_prefix(ttail_t* res, const char* regex)
return 1;
}
res->flag |= TTAIL_FLAG_PREFIX;
cflags = 0; /** @todo checks */
cflags = 0;
if(res->flag & TTAIL_FLAG_EXTENDED_RE)
{
cflags |= REG_EXTENDED;

View file

@ -56,9 +56,31 @@ START_TEST (test_file_line_start)
}
END_TEST
START_TEST (test_file_line_end)
{
long res;
struct tm tm;
ttail_search_files_init(ttail);
tm.tm_sec = 53;
tm.tm_min = 30;
tm.tm_hour = 0;
tm.tm_mday = 6;
tm.tm_mon = 2;
res = _ttail_file_search_from_end(ttail, 0, &tm);
ck_assert_int_eq(res, 357);
tm.tm_min = 29;
res = _ttail_file_search_from_end(ttail, 0, &tm);
ck_assert_int_eq(res, 221);
tm.tm_min = 0;
res = _ttail_file_search_from_end(ttail, 0, &tm);
ck_assert_int_eq(res, 0);
}
END_TEST
TTAIL_CHECK_START("ttail search_files checks", "ttail_file_*line*() checks")
TTAIL_SET_FIXTURE(setup_file_line, teardown_ttail);
TTAIL_ADD_TEST(test_file_line_next);
TTAIL_ADD_TEST(test_file_line_start);
TTAIL_ADD_TEST(test_file_line_end);
TTAIL_CHECK_END