root/lib/common/tests/agents/crm_generate_ra_key_test.c

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

DEFINITIONS

This source file includes following definitions.
  1. all_params_null
  2. some_params_null
  3. no_params_null

   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/common/agents.h>
  14 
  15 static void
  16 all_params_null(void **state) {
     /* [previous][next][first][last][top][bottom][index][help] */
  17     assert_null(crm_generate_ra_key(NULL, NULL, NULL));
  18 }
  19 
  20 static void
  21 some_params_null(void **state) {
     /* [previous][next][first][last][top][bottom][index][help] */
  22     char *retval;
  23 
  24     assert_null(crm_generate_ra_key("std", "prov", NULL));
  25 
  26     retval = crm_generate_ra_key("std", NULL, "ty");
  27     assert_string_equal(retval, "std:ty");
  28     free(retval);
  29 
  30     assert_null(crm_generate_ra_key(NULL, "prov", "ty"));
  31     assert_null(crm_generate_ra_key("std", NULL, NULL));
  32     assert_null(crm_generate_ra_key(NULL, "prov", NULL));
  33     assert_null(crm_generate_ra_key(NULL, NULL, "ty"));
  34 }
  35 
  36 static void
  37 no_params_null(void **state) {
     /* [previous][next][first][last][top][bottom][index][help] */
  38     char *retval;
  39 
  40     retval = crm_generate_ra_key("std", "prov", "ty");
  41     assert_string_equal(retval, "std:prov:ty");
  42     free(retval);
  43 }
  44 
  45 PCMK__UNIT_TEST(NULL, NULL,
  46                 cmocka_unit_test(all_params_null),
  47                 cmocka_unit_test(some_params_null),
  48                 cmocka_unit_test(no_params_null))

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