This source file includes following definitions.
- default_and
- invalid
- valid
- case_insensitive
1
2
3
4
5
6
7
8
9
10 #include <crm_internal.h>
11
12 #include <stdio.h>
13
14 #include <crm/common/rules_internal.h>
15 #include <crm/common/unittest_internal.h>
16
17 static void
18 default_and(void **state)
19 {
20 assert_int_equal(pcmk__parse_combine(NULL), pcmk__combine_and);
21 }
22
23 static void
24 invalid(void **state)
25 {
26 assert_int_equal(pcmk__parse_combine(""), pcmk__combine_unknown);
27 assert_int_equal(pcmk__parse_combine(" "), pcmk__combine_unknown);
28 assert_int_equal(pcmk__parse_combine("but"), pcmk__combine_unknown);
29 }
30
31 static void
32 valid(void **state)
33 {
34 assert_int_equal(pcmk__parse_combine(PCMK_VALUE_AND), pcmk__combine_and);
35 assert_int_equal(pcmk__parse_combine(PCMK_VALUE_OR), pcmk__combine_or);
36 }
37
38 static void
39 case_insensitive(void **state)
40 {
41 assert_int_equal(pcmk__parse_combine("And"),
42 pcmk__combine_and);
43
44 assert_int_equal(pcmk__parse_combine("OR"),
45 pcmk__combine_or);
46 }
47
48 PCMK__UNIT_TEST(NULL, NULL,
49 cmocka_unit_test(default_and),
50 cmocka_unit_test(invalid),
51 cmocka_unit_test(valid),
52 cmocka_unit_test(case_insensitive))