19 #define XML_DOC_PRIVATE_MAGIC 0x81726354UL 20 #define XML_NODE_PRIVATE_MAGIC 0x54637281UL 29 teardown(
void **state) {
35 buffer_scheme_test(
void **state) {
36 assert_int_equal(XML_BUFFER_ALLOC_DOUBLEIT, xmlGetBufferAllocationScheme());
50 create_document_node(
void **state) {
56 assert_int_equal(doc->type, XML_DOCUMENT_NODE);
59 docpriv = doc->_private;
60 assert_non_null(docpriv);
69 create_element_node(
void **state) {
73 xmlNodePtr node = xmlNewDocNode(doc, NULL, (
pcmkXmlStr)
"test", NULL);
76 docpriv = doc->_private;
80 assert_non_null(node);
81 assert_int_equal(node->type, XML_ELEMENT_NODE);
84 priv = node->_private;
85 assert_non_null(priv);
95 create_attr_node(
void **state) {
99 xmlNodePtr node = xmlNewDocNode(doc, NULL, (
pcmkXmlStr)
"test", NULL);
104 docpriv = doc->_private;
108 assert_non_null(attr);
109 assert_int_equal(attr->type, XML_ATTRIBUTE_NODE);
112 priv = attr->_private;
113 assert_non_null(priv);
123 create_comment_node(
void **state) {
127 xmlNodePtr node = xmlNewDocComment(doc, (
pcmkXmlStr)
"blahblah");
130 docpriv = doc->_private;
134 assert_non_null(node);
135 assert_int_equal(node->type, XML_COMMENT_NODE);
138 priv = node->_private;
139 assert_non_null(priv);
149 create_text_node(
void **state) {
153 xmlNodePtr node = xmlNewDocText(doc, (
pcmkXmlStr)
"blahblah");
156 docpriv = doc->_private;
160 assert_non_null(node);
161 assert_int_equal(node->type, XML_TEXT_NODE);
164 priv = node->_private;
173 create_dtd_node(
void **state) {
182 docpriv = doc->_private;
186 assert_non_null(dtd);
187 assert_int_equal(dtd->type, XML_DTD_NODE);
190 priv = dtd->_private;
199 create_cdata_node(
void **state) {
203 xmlNodePtr node = xmlNewCDataBlock(doc, (
pcmkXmlStr)
"blahblah", 8);
206 docpriv = doc->_private;
210 assert_non_null(node);
211 assert_int_equal(node->type, XML_CDATA_SECTION_NODE);
214 priv = node->_private;
223 cmocka_unit_test(buffer_scheme_test),
224 cmocka_unit_test(create_document_node),
225 cmocka_unit_test(create_element_node),
226 cmocka_unit_test(create_attr_node),
227 cmocka_unit_test(create_comment_node),
228 cmocka_unit_test(create_text_node),
229 cmocka_unit_test(create_dtd_node),
230 cmocka_unit_test(create_cdata_node));
#define XML_NODE_PRIVATE_MAGIC
void crm_xml_cleanup(void)
#define XML_DOC_PRIVATE_MAGIC
void crm_xml_init(void)
Initialize the CRM XML subsystem.
Wrappers for and extensions to libxml2.
const xmlChar * pcmkXmlStr
#define PCMK__XML_VERSION
libxml2 supports only XML version 1.0, at least as of libxml2-2.12.5
PCMK__UNIT_TEST(setup, teardown, cmocka_unit_test(buffer_scheme_test), cmocka_unit_test(create_document_node), cmocka_unit_test(create_element_node), cmocka_unit_test(create_attr_node), cmocka_unit_test(create_comment_node), cmocka_unit_test(create_text_node), cmocka_unit_test(create_dtd_node), cmocka_unit_test(create_cdata_node))