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_badarg.c 1.5KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  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. * Bad arguments
  10. */
  11. START_TEST (test_argparse_bad1)
  12. {
  13. ttail_t *t;
  14. char *args[] = {"foo", "--sdfsdf"};
  15. t = ttail_init(2, args);
  16. ck_assert(t == NULL);
  17. }
  18. END_TEST
  19. START_TEST (test_argparse_bad2)
  20. {
  21. ttail_t *t;
  22. char *args[] = {"foo", "-x"};
  23. t = ttail_init(2, args);
  24. ck_assert(t == NULL);
  25. }
  26. END_TEST
  27. START_TEST (test_argparse_bad3)
  28. {
  29. ttail_t *t;
  30. char *args[] = {"foo", "-p"};
  31. t = ttail_init(2, args);
  32. ck_assert(t == NULL);
  33. }
  34. END_TEST
  35. START_TEST (test_argparse_bad4)
  36. {
  37. ttail_t *t;
  38. char *args[] = {"foo", "-f"};
  39. t = ttail_init(2, args);
  40. ck_assert(t == NULL);
  41. }
  42. END_TEST
  43. START_TEST (test_argparse_bad5)
  44. {
  45. ttail_t *t;
  46. char *args[] = {"foo", "-d"};
  47. t = ttail_init(2, args);
  48. ck_assert(t == NULL);
  49. }
  50. END_TEST
  51. START_TEST (test_argparse_bad6)
  52. {
  53. ttail_t *t;
  54. char *args[] = {"foo", "-m"};
  55. t = ttail_init(2, args);
  56. ck_assert(t == NULL);
  57. }
  58. END_TEST
  59. START_TEST (test_argparse_bad7)
  60. {
  61. ttail_t *t;
  62. char *args[] = {"foo", "-l"};
  63. t = ttail_init(2, args);
  64. ck_assert(t == NULL);
  65. }
  66. END_TEST
  67. TTAIL_CHECK_START("ttail argument parsing checks", "bad arguments parsing")
  68. TTAIL_ADD_TEST(test_argparse_bad1);
  69. TTAIL_ADD_TEST(test_argparse_bad2);
  70. TTAIL_ADD_TEST(test_argparse_bad3);
  71. TTAIL_ADD_TEST(test_argparse_bad4);
  72. TTAIL_ADD_TEST(test_argparse_bad5);
  73. TTAIL_ADD_TEST(test_argparse_bad6);
  74. TTAIL_ADD_TEST(test_argparse_bad7);
  75. TTAIL_CHECK_END