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_init_format.c 866B

123456789101112131415161718192021222324252627282930313233343536373839
  1. #include <check.h>
  2. #include <errno.h>
  3. #include <stdio.h>
  4. #include <unistd.h>
  5. #include "ttail_check.h"
  6. #include "ttail.h"
  7. #include "ttail_init.h"
  8. /*
  9. * ttail_set_fmt() checks
  10. */
  11. START_TEST (test_init_fmt)
  12. {
  13. int ret;
  14. ret = ttail_set_fmt(ttail, "%B");
  15. ck_assert_int_eq(ret, 0);
  16. ck_assert_int_eq(ttail->flag & TTAIL_FLAG_FORMAT, TTAIL_FLAG_FORMAT);
  17. ck_assert_str_eq(ttail->fmt, "%B");
  18. }
  19. END_TEST
  20. START_TEST (test_init_fmt_again)
  21. {
  22. int ret;
  23. ttail_set_fmt(ttail, "%B");
  24. ret = ttail_set_fmt(ttail, "%b");
  25. ck_assert_int_eq(ret, -1);
  26. ck_assert_int_eq(ttail->flag & TTAIL_FLAG_FORMAT, TTAIL_FLAG_FORMAT);
  27. ck_assert_str_eq(ttail->fmt, "%B");
  28. }
  29. END_TEST
  30. TTAIL_CHECK_START("ttail init checks", "date format init checks")
  31. TTAIL_SET_FIXTURE(setup_ttail_empty, teardown_ttail);
  32. TTAIL_ADD_TEST(test_init_fmt);
  33. TTAIL_ADD_TEST(test_init_fmt_again);
  34. TTAIL_CHECK_END