21 store_strs(
void **state)
23 GHashTable *tbl = NULL;
28 assert_true(g_hash_table_insert(tbl, strdup(
"key-abc"), strdup(
"val-abc")));
29 assert_int_equal(g_hash_table_size(tbl), 1);
30 assert_string_equal(g_hash_table_lookup(tbl,
"key-abc"),
"val-abc");
32 assert_false(g_hash_table_insert(tbl, strdup(
"key-abc"), strdup(
"val-def")));
33 assert_int_equal(g_hash_table_size(tbl), 1);
34 assert_string_equal(g_hash_table_lookup(tbl,
"key-abc"),
"val-def");
36 assert_true(g_hash_table_insert(tbl, strdup(
"key-ABC"), strdup(
"val-abc")));
37 assert_int_equal(g_hash_table_size(tbl), 2);
38 assert_string_equal(g_hash_table_lookup(tbl,
"key-ABC"),
"val-abc");
40 g_hash_table_destroy(tbl);
43 int main(
int argc,
char **argv) {
44 const struct CMUnitTest tests[] = {
45 cmocka_unit_test(store_strs),
48 cmocka_set_message_output(CM_OUTPUT_TAP);
49 return cmocka_run_group_tests(tests, NULL, NULL);
GHashTable * pcmk__strkey_table(GDestroyNotify key_destroy_func, GDestroyNotify value_destroy_func)
int main(int argc, char **argv)