pacemaker  2.1.0-7c3f660
Scalable High-Availability cluster resource manager
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
pcmk__clear_flags_as_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 <crm_internal.h>
11 
12 static void
13 clear_none(void) {
14  g_assert_cmphex(pcmk__clear_flags_as(__func__, __LINE__, LOG_TRACE, "Test",
15  "test", 0x0f0, 0x00f, NULL), ==, 0x0f0);
16  g_assert_cmphex(pcmk__clear_flags_as(__func__, __LINE__, LOG_TRACE, "Test",
17  "test", 0x0f0, 0xf0f, NULL), ==, 0x0f0);
18 }
19 
20 static void
21 clear_some(void) {
22  g_assert_cmphex(pcmk__clear_flags_as(__func__, __LINE__, LOG_TRACE, "Test",
23  "test", 0x0f0, 0x020, NULL), ==, 0x0d0);
24  g_assert_cmphex(pcmk__clear_flags_as(__func__, __LINE__, LOG_TRACE, "Test",
25  "test", 0x0f0, 0x030, NULL), ==, 0x0c0);
26 }
27 
28 static void
29 clear_all(void) {
30  g_assert_cmphex(pcmk__clear_flags_as(__func__, __LINE__, LOG_TRACE, "Test",
31  "test", 0x0f0, 0x0f0, NULL), ==, 0x000);
32  g_assert_cmphex(pcmk__clear_flags_as(__func__, __LINE__, LOG_TRACE, "Test",
33  "test", 0x0f0, 0xfff, NULL), ==, 0x000);
34 }
35 
36 int
37 main(int argc, char **argv)
38 {
39  g_test_init(&argc, &argv, NULL);
40 
41  g_test_add_func("/common/flags/clear/clear_none", clear_none);
42  g_test_add_func("/common/flags/clear/clear_some", clear_some);
43  g_test_add_func("/common/flags/clear/clear_all", clear_all);
44  return g_test_run();
45 }
#define LOG_TRACE
Definition: logging.h:36
int main(int argc, char **argv)