pacemaker 3.0.1-16e74fc4da
Scalable High-Availability cluster resource manager
Loading...
Searching...
No Matches
pcmk_readable_score_test.c
Go to the documentation of this file.
1/*
2 * Copyright 2022-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
13
14static void
15outside_limits(void **state)
16{
17 assert_string_equal(pcmk_readable_score(PCMK_SCORE_INFINITY * 2),
19 assert_string_equal(pcmk_readable_score(-PCMK_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))
#define PCMK_VALUE_MINUS_INFINITY
Definition options.h:175
#define PCMK_VALUE_INFINITY
Definition options.h:165
const char * pcmk_readable_score(int score)
Return a displayable static string for a score value.
Definition scores.c:102
#define PCMK_SCORE_INFINITY
Integer score to use to represent "infinity".
Definition scores.h:26
#define PCMK__UNIT_TEST(group_setup, group_teardown,...)