This source file includes following definitions.
- empty_list
- null_char
- in_list
- not_in_list
- main
1
2
3
4
5
6
7
8
9
10 #include <crm_internal.h>
11
12 #include <stdio.h>
13 #include <stdbool.h>
14 #include <glib.h>
15
16 static void
17 empty_list(void)
18 {
19 g_assert_false(pcmk__char_in_any_str('x', NULL));
20 g_assert_false(pcmk__char_in_any_str('\0', NULL));
21 }
22
23 static void
24 null_char(void)
25 {
26 g_assert_true(pcmk__char_in_any_str('\0', "xxx", "yyy", NULL));
27 g_assert_true(pcmk__char_in_any_str('\0', "", NULL));
28 }
29
30 static void
31 in_list(void)
32 {
33 g_assert_true(pcmk__char_in_any_str('x', "aaa", "bbb", "xxx", NULL));
34 }
35
36 static void
37 not_in_list(void)
38 {
39 g_assert_false(pcmk__char_in_any_str('x', "aaa", "bbb", NULL));
40 g_assert_false(pcmk__char_in_any_str('A', "aaa", "bbb", NULL));
41 g_assert_false(pcmk__char_in_any_str('x', "", NULL));
42 }
43
44 int main(int argc, char **argv)
45 {
46 g_test_init(&argc, &argv, NULL);
47
48 g_test_add_func("/common/strings/char_in_any_str/empty_list", empty_list);
49 g_test_add_func("/common/strings/char_in_any_str/null_char", null_char);
50 g_test_add_func("/common/strings/char_in_any_str/in", in_list);
51 g_test_add_func("/common/strings/char_in_any_str/not_in", not_in_list);
52
53 return g_test_run();
54 }
55