pacemaker 2.1.4-dc6eb4362e
Scalable High-Availability cluster resource manager
crm_meta_name_test.c
Go to the documentation of this file.
1/*
2 * Copyright 2022 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 Lesser General Public License
7 * version 2.1 or later (LGPLv2.1+) WITHOUT ANY WARRANTY.
8 */
9
10#include <crm_internal.h>
11#include <crm/msg_xml.h>
12
13#include <stdarg.h>
14#include <stddef.h>
15#include <stdint.h>
16#include <setjmp.h>
17#include <cmocka.h>
18
19static void
20empty_params(void **state)
21{
22 assert_null(crm_meta_name(NULL));
23}
24
25static void
26standard_usage(void **state)
27{
28 char *s = NULL;
29
31 assert_string_equal(s, "CRM_meta_notify");
32 free(s);
33
35 assert_string_equal(s, "CRM_meta_resource_stickiness");
36 free(s);
37
38 s = crm_meta_name("blah");
39 assert_string_equal(s, "CRM_meta_blah");
40 free(s);
41}
42
43int main(int argc, char **argv)
44{
45 const struct CMUnitTest tests[] = {
46 cmocka_unit_test(empty_params),
47 cmocka_unit_test(standard_usage),
48 };
49
50 cmocka_set_message_output(CM_OUTPUT_TAP);
51 return cmocka_run_group_tests(tests, NULL, NULL);
52}
char * crm_meta_name(const char *field)
Definition: utils.c:439
int main(int argc, char **argv)
#define XML_RSC_ATTR_NOTIFY
Definition: msg_xml.h:241
#define XML_RSC_ATTR_STICKINESS
Definition: msg_xml.h:242