Bläddra i källkod

Add test for _ttail_file_search_from_end

And updated doxygen todo list
Yann Weber 7 år sedan
förälder
incheckning
abe01c0733
4 ändrade filer med 23 tillägg och 5 borttagningar
  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 Visa fil

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

+ 0
- 2
src/include/ttail_search_files.h Visa fil

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

+ 1
- 1
src/ttail_init.c Visa fil

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

+ 22
- 0
tests/ttail_search_file_line.c Visa fil

@@ -56,9 +56,31 @@ START_TEST (test_file_line_start)
56 56
 }
57 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 80
 TTAIL_CHECK_START("ttail search_files checks", "ttail_file_*line*() checks")
60 81
 	TTAIL_SET_FIXTURE(setup_file_line, teardown_ttail);
61 82
 	TTAIL_ADD_TEST(test_file_line_next);
62 83
 	TTAIL_ADD_TEST(test_file_line_start);
84
+	TTAIL_ADD_TEST(test_file_line_end);
63 85
 TTAIL_CHECK_END
64 86
 

Loading…
Avbryt
Spara