root/lib/common/tests/utils/pcmk__fail_attr_name_test.c

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

DEFINITIONS

This source file includes following definitions.
  1. null_arguments
  2. standard_usage

   1 /*
   2  * Copyright 2023 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 null_arguments(void **state)
     /* [previous][next][first][last][top][bottom][index][help] */
  16 {
  17     assert_null(pcmk__fail_attr_name(NULL, NULL, NULL, 30000));
  18     assert_null(pcmk__fail_attr_name(NULL, "myrsc", "monitor", 30000));
  19     assert_null(pcmk__fail_attr_name("xyz", NULL, "monitor", 30000));
  20     assert_null(pcmk__fail_attr_name("xyz", "myrsc", NULL, 30000));
  21 }
  22 
  23 static void
  24 standard_usage(void **state)
     /* [previous][next][first][last][top][bottom][index][help] */
  25 {
  26     char *s = NULL;
  27 
  28     assert_string_equal(pcmk__fail_attr_name("xyz", "myrsc", "monitor", 30000),
  29                         "xyz-myrsc#monitor_30000");
  30 
  31     free(s);
  32 }
  33 
  34 PCMK__UNIT_TEST(NULL, NULL,
  35                 cmocka_unit_test(null_arguments),
  36                 cmocka_unit_test(standard_usage))

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