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_argparse_empty.c 2.2KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  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. ttail_t *ttail;
  9. void teardown_ttail(void)
  10. {
  11. ttail_free(ttail);
  12. }
  13. /*
  14. * Empty argument parsing test case
  15. */
  16. void setup_ttail_empty(void)
  17. {
  18. ttail = ttail_init(1, (char**)&"foo");
  19. }
  20. START_TEST (test_argparse_empty_logfilename)
  21. {
  22. ck_assert_msg(ttail->logfile_name == NULL,
  23. "ttail_t.logfile_name should be NULL");
  24. }
  25. END_TEST
  26. START_TEST (test_argparse_empty_logfile)
  27. {
  28. ck_assert_msg(ttail->logfile == NULL,
  29. "ttail_t.logfile should be NULL");
  30. }
  31. END_TEST
  32. START_TEST (test_argparse_empty_logfilesz)
  33. {
  34. ck_assert_msg(ttail->logfile_sz == 0,
  35. "ttail_t.logfile_sz should be 0");
  36. }
  37. END_TEST
  38. START_TEST (test_argparse_empty_flag)
  39. {
  40. ck_assert_msg(ttail->flag == 0,
  41. "ttail_t.flag should be 0");
  42. }
  43. END_TEST
  44. START_TEST (test_argparse_empty_fmt)
  45. {
  46. ck_assert_msg(ttail->fmt == NULL,
  47. "ttail_t.fmt should be NULL");
  48. }
  49. END_TEST
  50. START_TEST (test_argparse_empty_verbose)
  51. {
  52. ck_assert_msg(ttail->verbose == 0,
  53. "ttail_t.verbose should be 0");
  54. }
  55. END_TEST
  56. START_TEST (test_argparse_empty_prefixsz)
  57. {
  58. ck_assert_msg(ttail->prefix_sz == -1,
  59. "ttail_t.prefix_sz should be NULL");
  60. }
  61. END_TEST
  62. START_TEST (test_argparse_empty_session)
  63. {
  64. ck_assert_msg(ttail->session == NULL,
  65. "ttail_t.session should be NULL");
  66. }
  67. END_TEST
  68. Suite * ttail_init_suite(void)
  69. {
  70. Suite *s;
  71. TCase *tc_argparse_empty;
  72. s = suite_create("ttail argument parsing checks");
  73. tc_argparse_empty = tcase_create("empty arguments parsing");
  74. tcase_add_checked_fixture(tc_argparse_empty,
  75. setup_ttail_empty, teardown_ttail);
  76. tcase_add_test(tc_argparse_empty, test_argparse_empty_logfilename);
  77. tcase_add_test(tc_argparse_empty, test_argparse_empty_logfile);
  78. tcase_add_test(tc_argparse_empty, test_argparse_empty_logfilesz);
  79. tcase_add_test(tc_argparse_empty, test_argparse_empty_flag);
  80. tcase_add_test(tc_argparse_empty, test_argparse_empty_fmt);
  81. tcase_add_test(tc_argparse_empty, test_argparse_empty_verbose);
  82. tcase_add_test(tc_argparse_empty, test_argparse_empty_prefixsz);
  83. tcase_add_test(tc_argparse_empty, test_argparse_empty_session);
  84. suite_add_tcase(s, tc_argparse_empty);
  85. return s;
  86. }
  87. TTAIL_CHECK_MAIN(ttail_init_suite)