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_check.c 872B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  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. START_TEST (test_init_check_bad1)
  9. {
  10. ck_assert_int_eq(ttail_init_check(ttail), -1);
  11. }
  12. END_TEST
  13. START_TEST (test_init_check1)
  14. {
  15. char *arg[] = {"88/10/22", NULL};
  16. struct tm zero;
  17. char *arg0;
  18. arg0 = malloc(sizeof(char)*(strlen(arg[0])+1));
  19. if(!arg0)
  20. {
  21. perror("Malloc failed for argument");
  22. ck_abort_msg("Unable to allocate memory");
  23. }
  24. strcpy(arg0, arg[0]);
  25. arg[0]=arg0;
  26. memset(&zero, 0, sizeof(struct tm));
  27. ttail_set_dates(ttail, arg);
  28. ck_assert_int_eq(ttail_init_check(ttail), 0);
  29. }
  30. END_TEST
  31. TTAIL_CHECK_START("ttail init checks", "ttail_init_check() checks")
  32. TTAIL_SET_FIXTURE(setup_ttail_empty, teardown_ttail);
  33. TTAIL_ADD_TEST(test_init_check_bad1);
  34. TTAIL_ADD_TEST(test_init_check1);
  35. TTAIL_CHECK_END