This source file includes following definitions.
- target_is_NULL
- src_is_NULL
- copying_is_successful
1
2
3
4
5
6
7
8
9
10 #include <crm_internal.h>
11
12 #include <crm/common/unittest_internal.h>
13
14 #include <glib.h>
15
16 static void
17 target_is_NULL(void **state)
18 {
19 xmlNode *test_xml_1 = create_xml_node(NULL, "test_xml_1");
20 xmlNode *test_xml_2 = NULL;
21
22 pcmk__xe_set_props(test_xml_1, "test_prop", "test_value", NULL);
23
24 copy_in_properties(test_xml_2, test_xml_1);
25
26 assert_ptr_equal(test_xml_2, NULL);
27 }
28
29 static void
30 src_is_NULL(void **state)
31 {
32 xmlNode *test_xml_1 = NULL;
33 xmlNode *test_xml_2 = create_xml_node(NULL, "test_xml_2");
34
35 copy_in_properties(test_xml_2, test_xml_1);
36
37 assert_ptr_equal(test_xml_2->properties, NULL);
38 }
39
40 static void
41 copying_is_successful(void **state)
42 {
43 const char *xml_1_value;
44 const char *xml_2_value;
45
46 xmlNode *test_xml_1 = create_xml_node(NULL, "test_xml_1");
47 xmlNode *test_xml_2 = create_xml_node(NULL, "test_xml_2");
48
49 pcmk__xe_set_props(test_xml_1, "test_prop", "test_value", NULL);
50
51 copy_in_properties(test_xml_2, test_xml_1);
52
53 xml_1_value = crm_element_value(test_xml_1, "test_prop");
54 xml_2_value = crm_element_value(test_xml_2, "test_prop");
55
56 assert_string_equal(xml_1_value, xml_2_value);
57 }
58
59 PCMK__UNIT_TEST(NULL, NULL,
60 cmocka_unit_test(target_is_NULL),
61 cmocka_unit_test(src_is_NULL),
62 cmocka_unit_test(copying_is_successful))