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

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

DEFINITIONS

This source file includes following definitions.
  1. null_resource
  2. resource_is_managed
  3. resource_is_not_managed

   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_false(pcmk_resource_is_managed(NULL));
  21 }
  22 
  23 static void
  24 resource_is_managed(void **state)
     /* [previous][next][first][last][top][bottom][index][help] */
  25 {
  26     pcmk_resource_t rsc1 = {
  27         .flags = pcmk_rsc_managed,
  28     };
  29 
  30     assert_true(pcmk_resource_is_managed(&rsc1));
  31 }
  32 
  33 static void
  34 resource_is_not_managed(void **state)
     /* [previous][next][first][last][top][bottom][index][help] */
  35 {
  36     pcmk_resource_t rsc1 = {
  37         .flags = 0,
  38     };
  39 
  40     assert_false(pcmk_resource_is_managed(&rsc1));
  41 }
  42 
  43 PCMK__UNIT_TEST(NULL, NULL,
  44                 cmocka_unit_test(null_resource),
  45                 cmocka_unit_test(resource_is_managed),
  46                 cmocka_unit_test(resource_is_not_managed))

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