This source file includes following definitions.
- clear_none
- clear_some
- clear_all
- main
1
2
3
4
5
6
7
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 }