pacemaker 2.1.1-77db578727
Scalable High-Availability cluster resource manager
Loading...
Searching...
No Matches
pcmk_all_flags_set_test.c
Go to the documentation of this file.
1/*
2 * Copyright 2020 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 Lesser General Public License
7 * version 2.1 or later (LGPLv2.1+) WITHOUT ANY WARRANTY.
8 */
9
10#include <stdio.h>
11#include <stdbool.h>
12#include <crm_internal.h>
13
14static void
15all_set(void) {
16 g_assert_false(pcmk_all_flags_set(0x000, 0x003));
17 g_assert_true(pcmk_all_flags_set(0x00f, 0x003));
18 g_assert_false(pcmk_all_flags_set(0x00f, 0x010));
19 g_assert_false(pcmk_all_flags_set(0x00f, 0x011));
20 g_assert_true(pcmk_all_flags_set(0x000, 0x000));
21 g_assert_true(pcmk_all_flags_set(0x00f, 0x000));
22}
23
24static void
25one_is_set(void) {
26 // pcmk_is_set() is a simple macro alias for pcmk_all_flags_set()
27 g_assert_true(pcmk_is_set(0x00f, 0x001));
28 g_assert_false(pcmk_is_set(0x00f, 0x010));
29}
30
31int
32main(int argc, char **argv)
33{
34 g_test_init(&argc, &argv, NULL);
35
36 g_test_add_func("/common/flags/all_set/all_set", all_set);
37 g_test_add_func("/common/flags/all_set/is_set", one_is_set);
38 return g_test_run();
39}
#define pcmk_is_set(g, f)
Convenience alias for pcmk_all_flags_set(), to check single flag.
Definition util.h:114
int main(int argc, char **argv)