123456789101112131415161718192021222324252627282930313233343536373839 |
- #include <check.h>
- #include <errno.h>
- #include <stdio.h>
- #include <unistd.h>
-
- #include "ttail_check.h"
- #include "ttail.h"
- #include "ttail_init.h"
-
- /*
- * ttail_set_fmt() checks
- */
- START_TEST (test_init_fmt)
- {
- int ret;
- ret = ttail_set_fmt(ttail, "%B");
- ck_assert_int_eq(ret, 0);
- ck_assert_int_eq(ttail->flag & TTAIL_FLAG_FORMAT, TTAIL_FLAG_FORMAT);
- ck_assert_str_eq(ttail->fmt, "%B");
- }
- END_TEST
-
- START_TEST (test_init_fmt_again)
- {
- int ret;
- ttail_set_fmt(ttail, "%B");
- ret = ttail_set_fmt(ttail, "%b");
- ck_assert_int_eq(ret, -1);
- ck_assert_int_eq(ttail->flag & TTAIL_FLAG_FORMAT, TTAIL_FLAG_FORMAT);
- ck_assert_str_eq(ttail->fmt, "%B");
- }
- END_TEST
-
- TTAIL_CHECK_START("ttail init checks", "date format init checks")
- TTAIL_SET_FIXTURE(setup_ttail_empty, teardown_ttail);
- TTAIL_ADD_TEST(test_init_fmt);
- TTAIL_ADD_TEST(test_init_fmt_again);
- TTAIL_CHECK_END
|