Browse Source

Add test for _ttail_file_search_from_end

And updated doxygen todo list
Yann Weber 7 years ago
parent
commit
abe01c0733
4 changed files with 23 additions and 5 deletions
  1. 0
    2
      src/include/ttail_init.h
  2. 0
    2
      src/include/ttail_search_files.h
  3. 1
    1
      src/ttail_init.c
  4. 22
    0
      tests/ttail_search_file_line.c

+ 0
- 2
src/include/ttail_init.h View File

32
 
32
 
33
 #include "ttail.h"
33
 #include "ttail.h"
34
 
34
 
35
-/**@todo set logfiles as "leadings" option */
36
 #define TTAIL_LONG_OPT {\
35
 #define TTAIL_LONG_OPT {\
37
 	{"date-min", required_argument, 0, 'd'},\
36
 	{"date-min", required_argument, 0, 'd'},\
38
 	{"date-max", required_argument, 0, 'm'},\
37
 	{"date-max", required_argument, 0, 'm'},\
291
  *@param char*[2] dates {min,max} both can be NULL
290
  *@param char*[2] dates {min,max} both can be NULL
292
  *@param int c the date id to handle
291
  *@param int c the date id to handle
293
  *@return -1 if error 0 else
292
  *@return -1 if error 0 else
294
- *@todo checks
295
  */
293
  */
296
 int _ttail_set_date_relative(ttail_t*, char*, int);
294
 int _ttail_set_date_relative(ttail_t*, char*, int);
297
 
295
 

+ 0
- 2
src/include/ttail_search_files.h View File

188
  *@param ttail_t* ttail
188
  *@param ttail_t* ttail
189
  *@param struct tm** ftm : files min and max date
189
  *@param struct tm** ftm : files min and max date
190
  *@return 0 on success -1 if error
190
  *@return 0 on success -1 if error
191
- *@todo write tests
192
  */
191
  */
193
 inline int _ttail_file_sort(ttail_t*, struct tm**);
192
 inline int _ttail_file_sort(ttail_t*, struct tm**);
194
 
193
 
215
  *@param id size_t
214
  *@param id size_t
216
  *@param tm const struct tm*
215
  *@param tm const struct tm*
217
  *@return -1 on error else the offset of the line first chr
216
  *@return -1 on error else the offset of the line first chr
218
- *@todo checks
219
  */
217
  */
220
 inline off_t _ttail_file_search_from_end(ttail_t*, size_t, const struct tm*);
218
 inline off_t _ttail_file_search_from_end(ttail_t*, size_t, const struct tm*);
221
 
219
 

+ 1
- 1
src/ttail_init.c View File

303
 		return 1;
303
 		return 1;
304
 	}
304
 	}
305
 	res->flag |= TTAIL_FLAG_PREFIX;
305
 	res->flag |= TTAIL_FLAG_PREFIX;
306
-	cflags = 0; /** @todo checks */
306
+	cflags = 0;
307
 	if(res->flag & TTAIL_FLAG_EXTENDED_RE)
307
 	if(res->flag & TTAIL_FLAG_EXTENDED_RE)
308
 	{
308
 	{
309
 		cflags |= REG_EXTENDED;
309
 		cflags |= REG_EXTENDED;

+ 22
- 0
tests/ttail_search_file_line.c View File

56
 }
56
 }
57
 END_TEST
57
 END_TEST
58
 
58
 
59
+START_TEST (test_file_line_end)
60
+{
61
+	long res;
62
+	struct tm tm;
63
+	ttail_search_files_init(ttail);
64
+	tm.tm_sec = 53;
65
+	tm.tm_min = 30;
66
+	tm.tm_hour = 0;
67
+	tm.tm_mday = 6;
68
+	tm.tm_mon = 2;
69
+	res = _ttail_file_search_from_end(ttail, 0, &tm);
70
+	ck_assert_int_eq(res, 357);
71
+	tm.tm_min = 29;
72
+	res = _ttail_file_search_from_end(ttail, 0, &tm);
73
+	ck_assert_int_eq(res, 221);
74
+	tm.tm_min = 0;
75
+	res = _ttail_file_search_from_end(ttail, 0, &tm);
76
+	ck_assert_int_eq(res, 0);
77
+}
78
+END_TEST
79
+
59
 TTAIL_CHECK_START("ttail search_files checks", "ttail_file_*line*() checks")
80
 TTAIL_CHECK_START("ttail search_files checks", "ttail_file_*line*() checks")
60
 	TTAIL_SET_FIXTURE(setup_file_line, teardown_ttail);
81
 	TTAIL_SET_FIXTURE(setup_file_line, teardown_ttail);
61
 	TTAIL_ADD_TEST(test_file_line_next);
82
 	TTAIL_ADD_TEST(test_file_line_next);
62
 	TTAIL_ADD_TEST(test_file_line_start);
83
 	TTAIL_ADD_TEST(test_file_line_start);
84
+	TTAIL_ADD_TEST(test_file_line_end);
63
 TTAIL_CHECK_END
85
 TTAIL_CHECK_END
64
 
86
 

Loading…
Cancel
Save