pacemaker  2.1.9-49aab99839
Scalable High-Availability cluster resource manager
pcmk__xml_new_doc_test.c
Go to the documentation of this file.
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 
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) {
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,
34 
35  pcmk__xml_free_doc(doc);
36 }
37 
39  cmocka_unit_test(create_document_node))
#define PCMK__XML_DOC_PRIVATE_MAGIC
#define PCMK__UNIT_TEST(group_setup, group_teardown,...)
G_GNUC_INTERNAL xmlDoc * pcmk__xml_new_doc(void)
Definition: xml.c:803
int pcmk__xml_test_setup_group(void **state)
Definition: unittest.c:85
int pcmk__xml_test_teardown_group(void **state)
Definition: unittest.c:104
void pcmk__xml_free_doc(xmlDoc *doc)
Definition: xml.c:819