pacemaker
2.1.9-49aab99839
Scalable High-Availability cluster resource manager
lib
common
tests
rules
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
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))
rules_internal.h
pcmk__parse_combine
enum pcmk__combine pcmk__parse_combine(const char *combine)
Definition:
rules.c:903
PCMK_VALUE_OR
#define PCMK_VALUE_OR
Definition:
options.h:187
PCMK_VALUE_AND
#define PCMK_VALUE_AND
Definition:
options.h:133
PCMK__UNIT_TEST
#define PCMK__UNIT_TEST(group_setup, group_teardown,...)
Definition:
unittest_internal.h:188
pcmk__combine_or
Definition:
rules_internal.h:22
crm_internal.h
pcmk__combine_unknown
Definition:
rules_internal.h:20
pcmk__combine_and
Definition:
rules_internal.h:21
unittest_internal.h
Generated on Thu Oct 31 2024 15:49:03 for pacemaker by
1.8.14