1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253 |
- #include <check.h>
- #include <errno.h>
- #include <stdio.h>
- #include <unistd.h>
-
- #include "ttail_check.h"
- #include "ttail.h"
- #include "ttail_init.h"
-
- START_TEST (test_argparse_fmt_short)
- {
- ttail_t *t;
- char *args[] = {"foo", "-f", "%m"};
- t = ttail_init(3, args);
- ck_assert(t != NULL);
- }
- END_TEST
-
- START_TEST (test_argparse_fmt_long)
- {
- ttail_t *t;
- char *args[] = {"foo", "--date-format", "%m"};
- t = ttail_init(3, args);
- ck_assert(t != NULL);
- }
- END_TEST
-
- START_TEST (test_argparse_fmt_multiple)
- {
- ttail_t *t;
- char *args[] = {"foo", "-f", "%m", "-f", "%d"};
- t = ttail_init(5, args);
- ck_assert(t == NULL);
- }
- END_TEST
-
- Suite * ttail_init_suite(void)
- {
- Suite *s;
- TCase *tc_argparse_fmt;
-
- s = suite_create("ttail argument parsing checks");
-
- tc_argparse_fmt = tcase_create("date format arguments parsing");
- tcase_add_test(tc_argparse_fmt, test_argparse_fmt_short);
- tcase_add_test(tc_argparse_fmt, test_argparse_fmt_long);
- tcase_add_test(tc_argparse_fmt, test_argparse_fmt_multiple);
-
- suite_add_tcase(s, tc_argparse_fmt);
- return s;
- }
-
- TTAIL_CHECK_MAIN(ttail_init_suite)
|