This source file includes following definitions.
- empty_list
- singleton_list
- longer_list
1
2
3
4
5
6
7
8
9
10 #include <crm_internal.h>
11
12 #include <crm/common/unittest_internal.h>
13
14 #include <glib.h>
15
16 static void
17 empty_list(void **state) {
18 assert_false(pcmk__list_of_multiple(NULL));
19 }
20
21 static void
22 singleton_list(void **state) {
23 GList *lst = NULL;
24
25 lst = g_list_append(lst, strdup("abc"));
26 assert_false(pcmk__list_of_multiple(lst));
27
28 g_list_free_full(lst, free);
29 }
30
31 static void
32 longer_list(void **state) {
33 GList *lst = NULL;
34
35 lst = g_list_append(lst, strdup("abc"));
36 lst = g_list_append(lst, strdup("xyz"));
37 assert_true(pcmk__list_of_multiple(lst));
38
39 g_list_free_full(lst, free);
40 }
41
42 PCMK__UNIT_TEST(NULL, NULL,
43 cmocka_unit_test(empty_list),
44 cmocka_unit_test(singleton_list),
45 cmocka_unit_test(longer_list))