pacemaker  2.1.9-49aab99839
Scalable High-Availability cluster resource manager
pcmk__parse_combine_test.c
Go to the documentation of this file.
1 /*
2  * Copyright 2024 the Pacemaker project contributors
3  *
4  * The version control history for this file may have further details.
5  *
6  * This source code is licensed under the GNU General Public License version 2
7  * or later (GPLv2+) WITHOUT ANY WARRANTY.
8  */
9 
10 #include <crm_internal.h>
11 
12 #include <stdio.h>
13 
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 {
36 }
37 
38 static void
39 case_insensitive(void **state)
40 {
41  assert_int_equal(pcmk__parse_combine("And"),
43 
44  assert_int_equal(pcmk__parse_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))
enum pcmk__combine pcmk__parse_combine(const char *combine)
Definition: rules.c:903
#define PCMK_VALUE_OR
Definition: options.h:187
#define PCMK_VALUE_AND
Definition: options.h:133
#define PCMK__UNIT_TEST(group_setup, group_teardown,...)