pacemaker  2.1.7-0f7f88312f
Scalable High-Availability cluster resource manager
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 
13 
14 static void
15 outside_limits(void **state)
16 {
17  assert_string_equal(pcmk_readable_score(CRM_SCORE_INFINITY * 2),
19  assert_string_equal(pcmk_readable_score(-CRM_SCORE_INFINITY * 2),
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))
const char * pcmk_readable_score(int score)
Return a displayable static string for a score value.
Definition: scores.c:86
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))
#define CRM_SCORE_INFINITY
Definition: crm.h:84
#define CRM_MINUS_INFINITY_S
Definition: crm.h:87
#define CRM_INFINITY_S
Definition: crm.h:85