timed tail for logfiles. Display loglines given a minimum date and/or a maximum date.
c
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

ttail_search_minmax.c 1.2KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. #include <check.h>
  2. #include <stdio.h>
  3. #include <libgen.h>
  4. #include "ttail_check.h"
  5. #include "ttail.h"
  6. #include "ttail_init.h"
  7. #include "ttail_search.h"
  8. /*
  9. * _ttail_file_minmax() tests
  10. */
  11. START_TEST (test_file_minmax1)
  12. {
  13. /**@todo complete the testcase */
  14. int r;
  15. struct tm tm[2];
  16. ttail->flag |= TTAIL_FLAG_PREFIX;
  17. ttail->prefix_sz = 0;
  18. ttail_set_fmt(ttail, "%b%n%d %H:%M");
  19. r = ttail_search_files_init(ttail);
  20. ck_assert_int_eq(r, 0);
  21. r = _ttail_file_minmax(ttail, 0, tm);
  22. ck_assert_int_eq(r, 0);
  23. ck_assert_int_eq(tm[0].tm_mon, 2);
  24. ck_assert_int_eq(tm[0].tm_mday, 6);
  25. ck_assert_int_eq(tm[0].tm_hour, 0);
  26. ck_assert_int_eq(tm[0].tm_min, 1);
  27. ck_assert_int_eq(tm[1].tm_mon, 2);
  28. ck_assert_int_eq(tm[1].tm_mday, 6);
  29. ck_assert_int_eq(tm[1].tm_hour, 0);
  30. ck_assert_int_eq(tm[1].tm_min, 29);
  31. }
  32. END_TEST
  33. Suite * ttail_search_files_suite(void)
  34. {
  35. Suite *s;
  36. TCase *tc_file_minmax;
  37. s = suite_create("ttail search_files checks");
  38. tc_file_minmax = tcase_create("ttail_file_minmax() checks");
  39. tcase_add_checked_fixture(tc_file_minmax,
  40. setup_closest_fileinit, teardown_closest_fileinit);
  41. tcase_add_test(tc_file_minmax, test_file_minmax1);
  42. suite_add_tcase(s, tc_file_minmax);
  43. return s;
  44. }
  45. TTAIL_CHECK_MAIN(ttail_search_files_suite)