This source file includes following definitions.
- empty_input_list
- empty_string
- in_list
- not_in_list
1
2
3
4
5
6
7
8
9
10 #include <crm_internal.h>
11
12 #include <crm/common/unittest_internal.h>
13
14 static void
15 empty_input_list(void **state) {
16 assert_false(pcmk__strcase_any_of("xxx", NULL));
17 assert_false(pcmk__str_any_of("xxx", NULL));
18 assert_false(pcmk__strcase_any_of("", NULL));
19 assert_false(pcmk__str_any_of("", NULL));
20 }
21
22 static void
23 empty_string(void **state) {
24 assert_false(pcmk__strcase_any_of("", "xxx", "yyy", NULL));
25 assert_false(pcmk__str_any_of("", "xxx", "yyy", NULL));
26 assert_false(pcmk__strcase_any_of(NULL, "xxx", "yyy", NULL));
27 assert_false(pcmk__str_any_of(NULL, "xxx", "yyy", NULL));
28 }
29
30 static void
31 in_list(void **state) {
32 assert_true(pcmk__strcase_any_of("xxx", "aaa", "bbb", "xxx", NULL));
33 assert_true(pcmk__str_any_of("xxx", "aaa", "bbb", "xxx", NULL));
34 assert_true(pcmk__strcase_any_of("XXX", "aaa", "bbb", "xxx", NULL));
35 }
36
37 static void
38 not_in_list(void **state) {
39 assert_false(pcmk__strcase_any_of("xxx", "aaa", "bbb", NULL));
40 assert_false(pcmk__str_any_of("xxx", "aaa", "bbb", NULL));
41 assert_false(pcmk__str_any_of("AAA", "aaa", "bbb", NULL));
42 }
43
44 PCMK__UNIT_TEST(NULL, NULL,
45 cmocka_unit_test(empty_input_list),
46 cmocka_unit_test(empty_string),
47 cmocka_unit_test(in_list),
48 cmocka_unit_test(not_in_list))