root/lib/common/tests/scores/pcmk_readable_score_test.c

/* [previous][next][first][last][top][bottom][index][help] */

DEFINITIONS

This source file includes following definitions.
  1. outside_limits
  2. inside_limits

   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)
     /* [previous][next][first][last][top][bottom][index][help] */
  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)
     /* [previous][next][first][last][top][bottom][index][help] */
  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))

/* [previous][next][first][last][top][bottom][index][help] */