16 null_node(
void **state)
22 null_format(
void **state)
29 #ifdef HAVE_FORMAT_NONLITERAL 30 #pragma GCC diagnostic push 31 #pragma GCC diagnostic ignored "-Wformat-zero-length" 32 #endif // HAVE_FORMAT_NONLITERAL 34 #ifdef HAVE_FORMAT_NONLITERAL 35 #pragma GCC diagnostic pop 36 #endif // HAVE_FORMAT_NONLITERAL 42 valid_id(
void **state)
46 const char *
id = NULL;
50 assert_string_equal(pcmk__xe_id(test_xml),
"test_id");
54 id =
"\xF3\xAF\xBF\xBF" "\xC2\xB7";
56 assert_string_equal(pcmk__xe_id(test_xml),
id);
62 invalid_id(
void **state)
69 assert_string_equal(pcmk__xe_id(test_xml),
"_ab");
73 assert_string_equal(pcmk__xe_id(test_xml),
"a.b");
76 assert_string_equal(pcmk__xe_id(test_xml),
"ab.");
79 assert_string_equal(pcmk__xe_id(test_xml),
"_..");
85 format_args(
void **state)
88 const char *str =
"test";
92 assert_string_equal(pcmk__xe_id(test_xml),
"rsc-test-42");
98 cmocka_unit_test(null_node),
99 cmocka_unit_test(null_format),
100 cmocka_unit_test(valid_id),
101 cmocka_unit_test(invalid_id),
102 cmocka_unit_test(format_args))
#define PCMK__UNIT_TEST(group_setup, group_teardown,...)
xmlNode * pcmk__xe_create(xmlNode *parent, const char *name)
void pcmk__xml_free(xmlNode *xml)
int pcmk__xml_test_setup_group(void **state)
#define pcmk__assert_asserts(stmt)
int pcmk__xml_test_teardown_group(void **state)
void pcmk__xe_set_id(xmlNode *xml, const char *format,...) G_GNUC_PRINTF(2