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.8KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  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. Suite * ttail_init_suite(void)
  68. {
  69. Suite *s;
  70. TCase *tc_argparse_badarg;
  71. s = suite_create("ttail argument parsing checks");
  72. tc_argparse_badarg = tcase_create("bad arguments parsing");
  73. tcase_add_test(tc_argparse_badarg, test_argparse_bad1);
  74. tcase_add_test(tc_argparse_badarg, test_argparse_bad2);
  75. tcase_add_test(tc_argparse_badarg, test_argparse_bad3);
  76. tcase_add_test(tc_argparse_badarg, test_argparse_bad4);
  77. tcase_add_test(tc_argparse_badarg, test_argparse_bad5);
  78. tcase_add_test(tc_argparse_badarg, test_argparse_bad6);
  79. tcase_add_test(tc_argparse_badarg, test_argparse_bad7);
  80. suite_add_tcase(s, tc_argparse_badarg);
  81. return s;
  82. }
  83. TTAIL_CHECK_MAIN(ttail_init_suite)