pacemaker  2.1.7-0f7f88312f
Scalable High-Availability cluster resource manager
pcmk_all_flags_set_test.c
Go to the documentation of this file.
1 /*
2  * Copyright 2020-2021 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 static void
15 all_set(void **state) {
16  assert_false(pcmk_all_flags_set(0x000, 0x003));
17  assert_true(pcmk_all_flags_set(0x00f, 0x003));
18  assert_false(pcmk_all_flags_set(0x00f, 0x010));
19  assert_false(pcmk_all_flags_set(0x00f, 0x011));
20  assert_true(pcmk_all_flags_set(0x000, 0x000));
21  assert_true(pcmk_all_flags_set(0x00f, 0x000));
22 }
23 
24 static void
25 one_is_set(void **state) {
26  // pcmk_is_set() is a simple macro alias for pcmk_all_flags_set()
27  assert_true(pcmk_is_set(0x00f, 0x001));
28  assert_false(pcmk_is_set(0x00f, 0x010));
29 }
30 
31 PCMK__UNIT_TEST(NULL, NULL,
32  cmocka_unit_test(all_set),
33  cmocka_unit_test(one_is_set))
PCMK__UNIT_TEST(NULL, NULL, cmocka_unit_test(bad_input), cmocka_unit_test(not_found), cmocka_unit_test(find_attrB), cmocka_unit_test(find_attrA_matching))
#define pcmk_is_set(g, f)
Convenience alias for pcmk_all_flags_set(), to check single flag.
Definition: util.h:99