pacemaker 3.0.1-16e74fc4da
Scalable High-Availability cluster resource manager
Loading...
Searching...
No Matches
pcmk__xml_new_doc_test.c
Go to the documentation of this file.
1/*
2 * Copyright 2024-2025 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
21static void
22create_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_int_equal(docpriv->flags, pcmk__xf_none);
33
35}
36
38 cmocka_unit_test(create_document_node))
G_GNUC_INTERNAL xmlDoc * pcmk__xml_new_doc(void)
Definition xml.c:499
#define PCMK__XML_DOC_PRIVATE_MAGIC
uint32_t check
Magic number for checking integrity.
uint32_t flags
Group of enum pcmk__xml_flags
int pcmk__xml_test_teardown_group(void **state)
Definition unittest.c:105
#define PCMK__UNIT_TEST(group_setup, group_teardown,...)
int pcmk__xml_test_setup_group(void **state)
Definition unittest.c:87
@ pcmk__xf_none
This flag has no effect.
void pcmk__xml_free_doc(xmlDoc *doc)
Definition xml.c:515