root/lib/common/tests/resources/pcmk_resource_id_test.c

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

DEFINITIONS

This source file includes following definitions.
  1. null_resource
  2. resource_with_id

   1 /*
   2  * Copyright 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 
  12 #include <stdio.h>  // NULL
  13 
  14 #include <crm/common/resources.h>
  15 #include <crm/common/unittest_internal.h>
  16 
  17 static void
  18 null_resource(void **state)
     /* [previous][next][first][last][top][bottom][index][help] */
  19 {
  20     assert_null(pcmk_resource_id(NULL));
  21 }
  22 
  23 static void
  24 resource_with_id(void **state)
     /* [previous][next][first][last][top][bottom][index][help] */
  25 {
  26     char rsc1_id[] = "rsc1";
  27     pcmk_resource_t rsc1 = {
  28         .id = rsc1_id,
  29     };
  30 
  31     assert_string_equal(pcmk_resource_id(&rsc1), "rsc1");
  32 }
  33 
  34 PCMK__UNIT_TEST(NULL, NULL,
  35                 cmocka_unit_test(null_resource),
  36                 cmocka_unit_test(resource_with_id))

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