30 assert_set_score(
const char *initial,
const char *
new,
31 const char *reference_val,
int reference_rc)
33 const char *
name =
"X";
44 value_is_name_plus_plus(
void **state)
50 value_is_name_plus_equals_integer(
void **state)
52 assert_set_score(
"5",
"X+=2",
"7",
pcmk_rc_ok);
58 target_is_NULL(
void **state)
65 name_is_NULL(
void **state)
79 value_is_NULL(
void **state)
87 value_is_wrong_name(
void **state)
89 assert_set_score(
"5",
"Y++",
"Y++",
pcmk_rc_ok);
93 value_is_only_an_integer(
void **state)
101 variable_is_initialized_to_be_non_numeric(
void **state)
103 assert_set_score(
"hello",
"X++",
"1",
pcmk_rc_ok);
107 variable_is_initialized_to_be_non_numeric_2(
void **state)
109 assert_set_score(
"hello",
"X+=2",
"2",
pcmk_rc_ok);
113 variable_is_initialized_to_be_numeric_and_decimal_point_containing(
void **state)
115 assert_set_score(
"5.01",
"X++",
"6",
pcmk_rc_ok);
119 variable_is_initialized_to_be_numeric_and_decimal_point_containing_2(
void **state)
121 assert_set_score(
"5.50",
"X++",
"6",
pcmk_rc_ok);
125 variable_is_initialized_to_be_numeric_and_decimal_point_containing_3(
void **state)
127 assert_set_score(
"5.99",
"X++",
"6",
pcmk_rc_ok);
131 value_is_non_numeric(
void **state)
133 assert_set_score(
"5",
"X+=hello",
"5",
pcmk_rc_ok);
137 value_is_numeric_and_decimal_point_containing(
void **state)
139 assert_set_score(
"5",
"X+=2.01",
"7",
pcmk_rc_ok);
143 value_is_numeric_and_decimal_point_containing_2(
void **state)
145 assert_set_score(
"5",
"X+=1.50",
"6",
pcmk_rc_ok);
149 value_is_numeric_and_decimal_point_containing_3(
void **state)
151 assert_set_score(
"5",
"X+=1.99",
"6",
pcmk_rc_ok);
157 name_is_undefined(
void **state)
159 assert_set_score(NULL,
"X++",
"X++",
pcmk_rc_ok);
165 assignment_result_is_too_large(
void **state)
167 assert_set_score(
"5",
"X+=100000000000",
"1000000",
pcmk_rc_ok);
171 cmocka_unit_test(value_is_name_plus_plus),
172 cmocka_unit_test(value_is_name_plus_equals_integer),
173 cmocka_unit_test(target_is_NULL),
174 cmocka_unit_test(name_is_NULL),
175 cmocka_unit_test(value_is_NULL),
176 cmocka_unit_test(value_is_wrong_name),
177 cmocka_unit_test(value_is_only_an_integer),
178 cmocka_unit_test(variable_is_initialized_to_be_non_numeric),
179 cmocka_unit_test(variable_is_initialized_to_be_non_numeric_2),
180 cmocka_unit_test(variable_is_initialized_to_be_numeric_and_decimal_point_containing),
181 cmocka_unit_test(variable_is_initialized_to_be_numeric_and_decimal_point_containing_2),
182 cmocka_unit_test(variable_is_initialized_to_be_numeric_and_decimal_point_containing_3),
183 cmocka_unit_test(value_is_non_numeric),
184 cmocka_unit_test(value_is_numeric_and_decimal_point_containing),
185 cmocka_unit_test(value_is_numeric_and_decimal_point_containing_2),
186 cmocka_unit_test(value_is_numeric_and_decimal_point_containing_3),
187 cmocka_unit_test(name_is_undefined),
188 cmocka_unit_test(assignment_result_is_too_large))
const char * crm_xml_add(xmlNode *node, const char *name, const char *value)
Create an XML attribute with specified name and value.
#define PCMK__UNIT_TEST(group_setup, group_teardown,...)
G_GNUC_INTERNAL int pcmk__xe_set_score(xmlNode *target, const char *name, const char *value)
const char * crm_element_value(const xmlNode *data, const char *name)
Retrieve the value of an XML attribute.
int pcmk__xml_test_setup_group(void **state)
void free_xml(xmlNode *child)
xmlNode * pcmk__xe_create(xmlNode *parent, const char *name)