root/lib/common/tests/scheduler/pcmk_get_dc_test.c

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

DEFINITIONS

This source file includes following definitions.
  1. null_scheduler
  2. null_dc
  3. valid_dc

   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 <crm/common/scheduler.h>
  13 #include <crm/common/unittest_internal.h>
  14 
  15 static void
  16 null_scheduler(void **state)
     /* [previous][next][first][last][top][bottom][index][help] */
  17 {
  18     assert_null(pcmk_get_dc(NULL));
  19 }
  20 
  21 static void
  22 null_dc(void **state)
     /* [previous][next][first][last][top][bottom][index][help] */
  23 {
  24     pcmk_scheduler_t scheduler = {
  25         .dc_node = NULL,
  26     };
  27 
  28     assert_null(pcmk_get_dc(&scheduler));
  29 }
  30 
  31 static void
  32 valid_dc(void **state)
     /* [previous][next][first][last][top][bottom][index][help] */
  33 {
  34     pcmk_node_t dc = {
  35         .weight = 1,
  36     };
  37     pcmk_scheduler_t scheduler = {
  38         .dc_node = &dc,
  39     };
  40 
  41     assert_ptr_equal(&dc, pcmk_get_dc(&scheduler));
  42 }
  43 
  44 PCMK__UNIT_TEST(NULL, NULL,
  45                 cmocka_unit_test(null_scheduler),
  46                 cmocka_unit_test(null_dc),
  47                 cmocka_unit_test(valid_dc))

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