pacemaker 2.1.5-a3f44794f94
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 Lesser General Public License
7 * version 2.1 or later (LGPLv2.1+) WITHOUT ANY WARRANTY.
8 */
9
10#include <crm_internal.h>
11
13
14static void
15outside_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
23static void
24inside_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
31PCMK__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
#define CRM_SCORE_INFINITY
Definition: crm.h:85
#define CRM_INFINITY_S
Definition: crm.h:86
#define CRM_MINUS_INFINITY_S
Definition: crm.h:88
#define PCMK__UNIT_TEST(group_setup, group_teardown,...)