root/lib/common/tests/flags/pcmk__clear_flags_as_test.c

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

DEFINITIONS

This source file includes following definitions.
  1. clear_none
  2. clear_some
  3. clear_all

   1 /*
   2  * Copyright 2020-2021 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 clear_none(void **state) {
     /* [previous][next][first][last][top][bottom][index][help] */
  16     assert_int_equal(pcmk__clear_flags_as(__func__, __LINE__, LOG_TRACE, "Test",
  17                                           "test", 0x0f0, 0x00f, NULL), 0x0f0);
  18     assert_int_equal(pcmk__clear_flags_as(__func__, __LINE__, LOG_TRACE, "Test",
  19                                           "test", 0x0f0, 0xf0f, NULL), 0x0f0);
  20 }
  21 
  22 static void
  23 clear_some(void **state) {
     /* [previous][next][first][last][top][bottom][index][help] */
  24     assert_int_equal(pcmk__clear_flags_as(__func__, __LINE__, LOG_TRACE, "Test",
  25                                           "test", 0x0f0, 0x020, NULL), 0x0d0);
  26     assert_int_equal(pcmk__clear_flags_as(__func__, __LINE__, LOG_TRACE, "Test",
  27                                           "test", 0x0f0, 0x030, NULL), 0x0c0);
  28 }
  29 
  30 static void
  31 clear_all(void **state) {
     /* [previous][next][first][last][top][bottom][index][help] */
  32     assert_int_equal(pcmk__clear_flags_as(__func__, __LINE__, LOG_TRACE, "Test",
  33                                           "test", 0x0f0, 0x0f0, NULL), 0x000);
  34     assert_int_equal(pcmk__clear_flags_as(__func__, __LINE__, LOG_TRACE, "Test",
  35                                           "test", 0x0f0, 0xfff, NULL), 0x000);
  36 }
  37 
  38 PCMK__UNIT_TEST(NULL, NULL,
  39                 cmocka_unit_test(clear_none),
  40                 cmocka_unit_test(clear_some),
  41                 cmocka_unit_test(clear_all))

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