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
  4. main

   1 /*
   2  * Copyright 2020 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 static void
  13 clear_none(void) {
     /* [previous][next][first][last][top][bottom][index][help] */
  14     g_assert_cmphex(pcmk__clear_flags_as(__func__, __LINE__, LOG_TRACE, "Test",
  15                                          "test", 0x0f0, 0x00f, NULL), ==, 0x0f0);
  16     g_assert_cmphex(pcmk__clear_flags_as(__func__, __LINE__, LOG_TRACE, "Test",
  17                                          "test", 0x0f0, 0xf0f, NULL), ==, 0x0f0);
  18 }
  19 
  20 static void
  21 clear_some(void) {
     /* [previous][next][first][last][top][bottom][index][help] */
  22     g_assert_cmphex(pcmk__clear_flags_as(__func__, __LINE__, LOG_TRACE, "Test",
  23                                          "test", 0x0f0, 0x020, NULL), ==, 0x0d0);
  24     g_assert_cmphex(pcmk__clear_flags_as(__func__, __LINE__, LOG_TRACE, "Test",
  25                                          "test", 0x0f0, 0x030, NULL), ==, 0x0c0);
  26 }
  27 
  28 static void
  29 clear_all(void) {
     /* [previous][next][first][last][top][bottom][index][help] */
  30     g_assert_cmphex(pcmk__clear_flags_as(__func__, __LINE__, LOG_TRACE, "Test",
  31                                          "test", 0x0f0, 0x0f0, NULL), ==, 0x000);
  32     g_assert_cmphex(pcmk__clear_flags_as(__func__, __LINE__, LOG_TRACE, "Test",
  33                                          "test", 0x0f0, 0xfff, NULL), ==, 0x000);
  34 }
  35 
  36 int
  37 main(int argc, char **argv)
     /* [previous][next][first][last][top][bottom][index][help] */
  38 {
  39     g_test_init(&argc, &argv, NULL);
  40 
  41     g_test_add_func("/common/flags/clear/clear_none", clear_none);
  42     g_test_add_func("/common/flags/clear/clear_some", clear_some);
  43     g_test_add_func("/common/flags/clear/clear_all", clear_all);
  44     return g_test_run();
  45 }

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