aboutsummaryrefslogtreecommitdiffstats
path: root/tests/check_help.c
blob: 92d7c28f9d4048d8e07668cb0b3d5bfb8a3f9121 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#include <stdlib.h>
#include <glib.h>
#include <gmodule.h>
#include <check.h>
#include <string.h>
#include <stdio.h>
#include "help.h"

START_TEST(test_help_initfree)
help_t * h, *r;
r = help_init(&h, "/dev/null");
fail_if(r == NULL);
fail_if(r != h);

help_free(&h);
fail_if(h != NULL);
END_TEST

START_TEST(test_help_nonexistent)
help_t * h, *r;
r = help_init(&h, "/dev/null");
fail_unless(help_get(&h, "nonexistent") == NULL);
fail_if(r == NULL);
END_TEST

Suite *help_suite(void)
{
	Suite *s = suite_create("Help");
	TCase *tc_core = tcase_create("Core");

	suite_add_tcase(s, tc_core);
	tcase_add_test(tc_core, test_help_initfree);
	tcase_add_test(tc_core, test_help_nonexistent);
	return s;
}