timed tail for logfiles. Display loglines given a minimum date and/or a maximum date.
c
Ви не можете вибрати більше 25 тем Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

ttail_search_minmax.c 1014B

12345678910111213141516171819202122232425262728293031323334353637383940
  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. TTAIL_CHECK_START("ttail search_files checks", "ttail_file_minmax() checks")
  34. TTAIL_SET_FIXTURE(setup_closest_fileinit, teardown_closest_fileinit);
  35. TTAIL_ADD_TEST(test_file_minmax1);
  36. TTAIL_CHECK_END