pacemaker 3.0.1-16e74fc4da
Scalable High-Availability cluster resource manager
Loading...
Searching...
No Matches
pcmk__list_of_multiple_test.c
Go to the documentation of this file.
1/*
2 * Copyright 2022 the Pacemaker project contributors
3 *
4 * The version control history for this file may have further details.
5 *
6 * This source code is licensed under the GNU General Public License version 2
7 * or later (GPLv2+) WITHOUT ANY WARRANTY.
8 */
9
10#include <crm_internal.h>
11
13
14#include <glib.h>
15
16static void
17empty_list(void **state) {
18 assert_false(pcmk__list_of_multiple(NULL));
19}
20
21static void
22singleton_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
31static void
32longer_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
42PCMK__UNIT_TEST(NULL, NULL,
43 cmocka_unit_test(empty_list),
44 cmocka_unit_test(singleton_list),
45 cmocka_unit_test(longer_list))
#define PCMK__UNIT_TEST(group_setup, group_teardown,...)