pacemaker
2.1.7-0f7f88312f
Scalable High-Availability cluster resource manager
lib
common
tests
scores
pcmk_readable_score_test.c
Go to the documentation of this file.
1
/*
2
* Copyright 2022 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 <
crm/common/unittest_internal.h
>
13
14
static
void
15
outside_limits(
void
**state)
16
{
17
assert_string_equal(
pcmk_readable_score
(
CRM_SCORE_INFINITY
* 2),
18
CRM_INFINITY_S
);
19
assert_string_equal(
pcmk_readable_score
(-
CRM_SCORE_INFINITY
* 2),
20
CRM_MINUS_INFINITY_S
);
21
}
22
23
static
void
24
inside_limits(
void
**state)
25
{
26
assert_string_equal(
pcmk_readable_score
(0),
"0"
);
27
assert_string_equal(
pcmk_readable_score
(1024),
"1024"
);
28
assert_string_equal(
pcmk_readable_score
(-1024),
"-1024"
);
29
}
30
31
PCMK__UNIT_TEST
(NULL, NULL,
32
cmocka_unit_test(outside_limits),
33
cmocka_unit_test(inside_limits))
pcmk_readable_score
const char * pcmk_readable_score(int score)
Return a displayable static string for a score value.
Definition:
scores.c:86
PCMK__UNIT_TEST
PCMK__UNIT_TEST(NULL, NULL, cmocka_unit_test(bad_input), cmocka_unit_test(not_found), cmocka_unit_test(find_attrB), cmocka_unit_test(find_attrA_matching))
CRM_SCORE_INFINITY
#define CRM_SCORE_INFINITY
Definition:
crm.h:84
crm_internal.h
CRM_MINUS_INFINITY_S
#define CRM_MINUS_INFINITY_S
Definition:
crm.h:87
CRM_INFINITY_S
#define CRM_INFINITY_S
Definition:
crm.h:85
unittest_internal.h
Generated on Tue Dec 19 2023 17:32:56 for pacemaker by
1.8.14