This source file includes following definitions.
- all_set
- one_is_set
- main
1
2
3
4
5
6
7
8
9
10 #include <crm_internal.h>
11
12 #include <stdarg.h>
13 #include <stddef.h>
14 #include <stdint.h>
15 #include <setjmp.h>
16 #include <cmocka.h>
17
18 static void
19 all_set(void **state) {
20 assert_false(pcmk_all_flags_set(0x000, 0x003));
21 assert_true(pcmk_all_flags_set(0x00f, 0x003));
22 assert_false(pcmk_all_flags_set(0x00f, 0x010));
23 assert_false(pcmk_all_flags_set(0x00f, 0x011));
24 assert_true(pcmk_all_flags_set(0x000, 0x000));
25 assert_true(pcmk_all_flags_set(0x00f, 0x000));
26 }
27
28 static void
29 one_is_set(void **state) {
30
31 assert_true(pcmk_is_set(0x00f, 0x001));
32 assert_false(pcmk_is_set(0x00f, 0x010));
33 }
34
35 int
36 main(int argc, char **argv)
37 {
38 const struct CMUnitTest tests[] = {
39 cmocka_unit_test(all_set),
40 cmocka_unit_test(one_is_set),
41 };
42
43 cmocka_set_message_output(CM_OUTPUT_TAP);
44 return cmocka_run_group_tests(tests, NULL, NULL);
45 }