#include #include #include #include #include "ttail_check.h" #include "ttail.h" #include "ttail_init.h" ttail_t *ttail; void teardown_ttail(void) { ttail_free(ttail); } /* * Empty argument parsing test case */ void setup_ttail_empty(void) { ttail = ttail_init(1, (char**)&"foo"); } START_TEST (test_argparse_empty_logfilename) { ck_assert_msg(ttail->logfile_name == NULL, "ttail_t.logfile_name should be NULL"); } END_TEST START_TEST (test_argparse_empty_logfile) { ck_assert_msg(ttail->logfile == NULL, "ttail_t.logfile should be NULL"); } END_TEST START_TEST (test_argparse_empty_logfilesz) { ck_assert_msg(ttail->logfile_sz == 0, "ttail_t.logfile_sz should be 0"); } END_TEST START_TEST (test_argparse_empty_flag) { ck_assert_msg(ttail->flag == 0, "ttail_t.flag should be 0"); } END_TEST START_TEST (test_argparse_empty_fmt) { ck_assert_msg(ttail->fmt == NULL, "ttail_t.fmt should be NULL"); } END_TEST START_TEST (test_argparse_empty_verbose) { ck_assert_msg(ttail->verbose == 0, "ttail_t.verbose should be 0"); } END_TEST START_TEST (test_argparse_empty_prefixsz) { ck_assert_msg(ttail->prefix_sz == -1, "ttail_t.prefix_sz should be NULL"); } END_TEST START_TEST (test_argparse_empty_session) { ck_assert_msg(ttail->session == NULL, "ttail_t.session should be NULL"); } END_TEST Suite * ttail_init_suite(void) { Suite *s; TCase *tc_argparse_empty; s = suite_create("ttail argument parsing checks"); tc_argparse_empty = tcase_create("empty arguments parsing"); tcase_add_checked_fixture(tc_argparse_empty, setup_ttail_empty, teardown_ttail); tcase_add_test(tc_argparse_empty, test_argparse_empty_logfilename); tcase_add_test(tc_argparse_empty, test_argparse_empty_logfile); tcase_add_test(tc_argparse_empty, test_argparse_empty_logfilesz); tcase_add_test(tc_argparse_empty, test_argparse_empty_flag); tcase_add_test(tc_argparse_empty, test_argparse_empty_fmt); tcase_add_test(tc_argparse_empty, test_argparse_empty_verbose); tcase_add_test(tc_argparse_empty, test_argparse_empty_prefixsz); tcase_add_test(tc_argparse_empty, test_argparse_empty_session); suite_add_tcase(s, tc_argparse_empty); return s; } TTAIL_CHECK_MAIN(ttail_init_suite)