pacemaker  2.1.7-0f7f88312f
Scalable High-Availability cluster resource manager
pcmk__clear_flags_as_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 clear_none(void **state) {
16  assert_int_equal(pcmk__clear_flags_as(__func__, __LINE__, LOG_TRACE, "Test",
17  "test", 0x0f0, 0x00f, NULL), 0x0f0);
18  assert_int_equal(pcmk__clear_flags_as(__func__, __LINE__, LOG_TRACE, "Test",
19  "test", 0x0f0, 0xf0f, NULL), 0x0f0);
20 }
21 
22 static void
23 clear_some(void **state) {
24  assert_int_equal(pcmk__clear_flags_as(__func__, __LINE__, LOG_TRACE, "Test",
25  "test", 0x0f0, 0x020, NULL), 0x0d0);
26  assert_int_equal(pcmk__clear_flags_as(__func__, __LINE__, LOG_TRACE, "Test",
27  "test", 0x0f0, 0x030, NULL), 0x0c0);
28 }
29 
30 static void
31 clear_all(void **state) {
32  assert_int_equal(pcmk__clear_flags_as(__func__, __LINE__, LOG_TRACE, "Test",
33  "test", 0x0f0, 0x0f0, NULL), 0x000);
34  assert_int_equal(pcmk__clear_flags_as(__func__, __LINE__, LOG_TRACE, "Test",
35  "test", 0x0f0, 0xfff, NULL), 0x000);
36 }
37 
38 PCMK__UNIT_TEST(NULL, NULL,
39  cmocka_unit_test(clear_none),
40  cmocka_unit_test(clear_some),
41  cmocka_unit_test(clear_all))
#define LOG_TRACE
Definition: logging.h:38
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))