Four macros were added : - TTAIL_CHECK_START(char *test_suite_str, char *test_case_str) - TTAIL_SET_FIXTURE(void (*setup)(), void (*teardown)()) - TTAIL_ADD_TEST( libcheck_test test) - TTAIL_CHECK_END
86 lines
1.5 KiB
C
86 lines
1.5 KiB
C
#include <check.h>
|
|
#include <errno.h>
|
|
#include <stdio.h>
|
|
#include <unistd.h>
|
|
|
|
#include "ttail_check.h"
|
|
#include "ttail.h"
|
|
#include "ttail_init.h"
|
|
|
|
/*
|
|
* Bad arguments
|
|
*/
|
|
|
|
START_TEST (test_argparse_bad1)
|
|
{
|
|
ttail_t *t;
|
|
char *args[] = {"foo", "--sdfsdf"};
|
|
t = ttail_init(2, args);
|
|
ck_assert(t == NULL);
|
|
}
|
|
END_TEST
|
|
|
|
START_TEST (test_argparse_bad2)
|
|
{
|
|
ttail_t *t;
|
|
char *args[] = {"foo", "-x"};
|
|
t = ttail_init(2, args);
|
|
ck_assert(t == NULL);
|
|
}
|
|
END_TEST
|
|
|
|
START_TEST (test_argparse_bad3)
|
|
{
|
|
ttail_t *t;
|
|
char *args[] = {"foo", "-p"};
|
|
t = ttail_init(2, args);
|
|
ck_assert(t == NULL);
|
|
}
|
|
END_TEST
|
|
|
|
START_TEST (test_argparse_bad4)
|
|
{
|
|
ttail_t *t;
|
|
char *args[] = {"foo", "-f"};
|
|
t = ttail_init(2, args);
|
|
ck_assert(t == NULL);
|
|
}
|
|
END_TEST
|
|
|
|
START_TEST (test_argparse_bad5)
|
|
{
|
|
ttail_t *t;
|
|
char *args[] = {"foo", "-d"};
|
|
t = ttail_init(2, args);
|
|
ck_assert(t == NULL);
|
|
}
|
|
END_TEST
|
|
|
|
START_TEST (test_argparse_bad6)
|
|
{
|
|
ttail_t *t;
|
|
char *args[] = {"foo", "-m"};
|
|
t = ttail_init(2, args);
|
|
ck_assert(t == NULL);
|
|
}
|
|
END_TEST
|
|
|
|
START_TEST (test_argparse_bad7)
|
|
{
|
|
ttail_t *t;
|
|
char *args[] = {"foo", "-l"};
|
|
t = ttail_init(2, args);
|
|
ck_assert(t == NULL);
|
|
}
|
|
END_TEST
|
|
|
|
TTAIL_CHECK_START("ttail argument parsing checks", "bad arguments parsing")
|
|
TTAIL_ADD_TEST(test_argparse_bad1);
|
|
TTAIL_ADD_TEST(test_argparse_bad2);
|
|
TTAIL_ADD_TEST(test_argparse_bad3);
|
|
TTAIL_ADD_TEST(test_argparse_bad4);
|
|
TTAIL_ADD_TEST(test_argparse_bad5);
|
|
TTAIL_ADD_TEST(test_argparse_bad6);
|
|
TTAIL_ADD_TEST(test_argparse_bad7);
|
|
TTAIL_CHECK_END
|
|
|