root/lib/pengine/tests/unpack/pe_base_name_end_test.c

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

DEFINITIONS

This source file includes following definitions.
  1. bad_args
  2. no_suffix
  3. has_suffix

   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 
  12 #include <crm/common/unittest_internal.h>
  13 #include <crm/pengine/internal.h>
  14 
  15 static void
  16 bad_args(void **state) {
     /* [previous][next][first][last][top][bottom][index][help] */
  17     assert_null(pe_base_name_end(NULL));
  18     assert_null(pe_base_name_end(""));
  19 }
  20 
  21 static void
  22 no_suffix(void **state) {
     /* [previous][next][first][last][top][bottom][index][help] */
  23     assert_string_equal(pe_base_name_end("rsc"), "c");
  24     assert_string_equal(pe_base_name_end("rsc0"), "0");
  25 }
  26 
  27 static void
  28 has_suffix(void **state) {
     /* [previous][next][first][last][top][bottom][index][help] */
  29     assert_string_equal(pe_base_name_end("rsc:0"), "c:0");
  30     assert_string_equal(pe_base_name_end("rsc:100"), "c:100");
  31 }
  32 
  33 PCMK__UNIT_TEST(NULL, NULL,
  34                 cmocka_unit_test(bad_args),
  35                 cmocka_unit_test(no_suffix),
  36                 cmocka_unit_test(has_suffix))

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