21 null_args(
void **state)
29 g_hash_table_destroy(tbl);
33 missing_key(
void **state)
39 assert_int_equal(
result, 123);
41 g_hash_table_destroy(tbl);
45 standard_usage(
void **state)
50 g_hash_table_insert(tbl, strdup(
"abc"), strdup(
"123"));
53 assert_int_equal(
result, 123);
55 g_hash_table_destroy(tbl);
59 conversion_errors(
void **state)
64 g_hash_table_insert(tbl, strdup(
"negative"), strdup(
"-3"));
65 g_hash_table_insert(tbl, strdup(
"toobig"), strdup(
"20000000000000000"));
68 assert_int_equal(
result, 456);
71 assert_int_equal(
result, 456);
73 g_hash_table_destroy(tbl);
76 int main(
int argc,
char **argv) {
77 const struct CMUnitTest tests[] = {
78 cmocka_unit_test(null_args),
79 cmocka_unit_test(missing_key),
80 cmocka_unit_test(standard_usage),
81 cmocka_unit_test(conversion_errors),
84 cmocka_set_message_output(CM_OUTPUT_TAP);
85 return cmocka_run_group_tests(tests, NULL, NULL);
int pcmk__guint_from_hash(GHashTable *table, const char *key, guint default_val, guint *result)
GHashTable * pcmk__strkey_table(GDestroyNotify key_destroy_func, GDestroyNotify value_destroy_func)
pcmk__action_result_t result
int main(int argc, char **argv)