root/lib/common/tests/nvpair/pcmk__xe_set_bool_attr_test.c

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

DEFINITIONS

This source file includes following definitions.
  1. set_attr

   1 /*
   2  * Copyright 2021-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/unittest_internal.h>
  13 #include <crm/common/xml_internal.h>
  14 #include <crm/common/xml.h>
  15 
  16 static void
  17 set_attr(void **state)
     /* [previous][next][first][last][top][bottom][index][help] */
  18 {
  19     xmlNode *node = pcmk__xml_parse("<node/>");
  20 
  21     pcmk__xe_set_bool_attr(node, "a", true);
  22     pcmk__xe_set_bool_attr(node, "b", false);
  23 
  24     assert_string_equal(crm_element_value(node, "a"), PCMK_VALUE_TRUE);
  25     assert_string_equal(crm_element_value(node, "b"), PCMK_VALUE_FALSE);
  26 
  27     free_xml(node);
  28 }
  29 
  30 PCMK__UNIT_TEST(pcmk__xml_test_setup_group, NULL,
  31                 cmocka_unit_test(set_attr))

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