17 null_xml(
void **state)
24 #define XML_NO_SIBLINGS \ 27 " <foo id='child1'>text</foo>" \ 28 " <!-- another comment -->" \ 32 no_siblings(
void **state)
35 xmlNode *child = NULL;
40 assert_non_null(child);
41 assert_string_equal(pcmk__xe_id(child),
"child1");
49 #define XML_SIBLINGS \ 52 " <foo id='child1'>text</foo>" \ 53 " <!-- another comment -->" \ 54 " <bar id='child2'>text</bar>" \ 55 " <!-- yet another comment -->" \ 56 " <foo id='child3'>text</foo>" \ 60 with_siblings(
void **state)
63 xmlNode *child = NULL;
69 assert_non_null(child);
70 assert_string_equal(pcmk__xe_id(child),
"child1");
73 assert_non_null(next);
74 assert_string_equal(pcmk__xe_id(next),
"child2");
77 assert_non_null(next);
78 assert_string_equal(pcmk__xe_id(next),
"child2");
81 assert_non_null(next);
82 assert_string_equal(pcmk__xe_id(next),
"child3");
91 cmocka_unit_test(null_xml),
92 cmocka_unit_test(no_siblings),
93 cmocka_unit_test(with_siblings));
xmlNode * pcmk__xe_first_child(const xmlNode *parent, const char *node_name, const char *attr_n, const char *attr_v)
void pcmk__xml_free(xmlNode *xml)
int pcmk__xml_test_setup_group(void **state)
Wrappers for and extensions to libxml2.
int pcmk__xml_test_teardown_group(void **state)
xmlNode * pcmk__xml_parse(const char *input)
xmlNode * pcmk__xe_next(const xmlNode *node, const char *element_name)
PCMK__UNIT_TEST(pcmk__xml_test_setup_group, pcmk__xml_test_teardown_group, cmocka_unit_test(null_xml), cmocka_unit_test(no_siblings), cmocka_unit_test(with_siblings))