root/lib/common/tests/xml/pcmk__xml_new_doc_test.c

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

DEFINITIONS

This source file includes following definitions.
  1. create_document_node

   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/unittest_internal.h>
  13 
  14 #include "crmcommon_private.h"
  15 
  16 /* This tests new_private_data() indirectly for document nodes. Testing
  17  * free_private_data() would be much less straightforward and is not worth the
  18  * hassle.
  19  */
  20 
  21 static void
  22 create_document_node(void **state) {
     /* [previous][next][first][last][top][bottom][index][help] */
  23     xml_doc_private_t *docpriv = NULL;
  24     xmlDoc *doc = pcmk__xml_new_doc();
  25 
  26     assert_non_null(doc);
  27     assert_int_equal(doc->type, XML_DOCUMENT_NODE);
  28 
  29     docpriv = doc->_private;
  30     assert_non_null(docpriv);
  31     assert_int_equal(docpriv->check, PCMK__XML_DOC_PRIVATE_MAGIC);
  32     assert_true(pcmk_all_flags_set(docpriv->flags,
  33                                    pcmk__xf_dirty|pcmk__xf_created));
  34 
  35     pcmk__xml_free_doc(doc);
  36 }
  37 
  38 PCMK__UNIT_TEST(pcmk__xml_test_setup_group, pcmk__xml_test_teardown_group,
  39                 cmocka_unit_test(create_document_node))

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