21 null_input_table(
void **state)
27 empty_input_table(
void **state)
30 GHashTable *copy = NULL;
33 assert_int_equal(g_hash_table_size(copy), 0);
35 g_hash_table_destroy(tbl);
36 g_hash_table_destroy(copy);
40 regular_input_table(
void **state)
43 GHashTable *copy = NULL;
45 g_hash_table_insert(tbl, strdup(
"abc"), strdup(
"123"));
46 g_hash_table_insert(tbl, strdup(
"def"), strdup(
"456"));
47 g_hash_table_insert(tbl, strdup(
"ghi"), strdup(
"789"));
50 assert_int_equal(g_hash_table_size(copy), 3);
52 assert_string_equal(g_hash_table_lookup(tbl,
"abc"),
"123");
53 assert_string_equal(g_hash_table_lookup(tbl,
"def"),
"456");
54 assert_string_equal(g_hash_table_lookup(tbl,
"ghi"),
"789");
56 g_hash_table_destroy(tbl);
57 g_hash_table_destroy(copy);
60 int main(
int argc,
char **argv) {
61 const struct CMUnitTest tests[] = {
62 cmocka_unit_test(null_input_table),
63 cmocka_unit_test(empty_input_table),
64 cmocka_unit_test(regular_input_table),
67 cmocka_set_message_output(CM_OUTPUT_TAP);
68 return cmocka_run_group_tests(tests, NULL, NULL);
int main(int argc, char **argv)
GHashTable * pcmk__strkey_table(GDestroyNotify key_destroy_func, GDestroyNotify value_destroy_func)
GHashTable * pcmk__str_table_dup(GHashTable *old_table)