## Assertion Utilities for GHashTable Assertion Utilities for GHashTable — Utilities to write assertions related to GHashTable more easily. |

## Synopsis

    gboolean            gcut_hash_table_equal               (GHashTable *hash1,
                                                             GHashTable *hash2,
                                                             GEqualFunc equal_func);
    gchar *             gcut_hash_table_inspect             (GHashTable *hash,
                                                             GCutInspectFunction key_inspect_func,
                                                             GCutInspectFunction value_inspect_func,
                                                             gpointer user_data);
    gchar *             gcut_hash_table_inspect_sorted      (GHashTable *hash,
                                                             GCutInspectFunction key_inspect_func,
                                                             GCutInspectFunction value_inspect_func,
                                                             GCompareFunc key_compare_func,
                                                             gpointer user_data);
    gboolean            gcut_hash_table_string_equal        (GHashTable *hash1,
                                                             GHashTable *hash2);
    GHashTable *        gcut_hash_table_string_string_copy  (GHashTable *hash);
    gchar *             gcut_hash_table_string_string_inspect
                                                            (GHashTable *hash);

## Description

To write assertions, you need to check equality and show expected and actual values.

The utilities help you to write assertions that are related to GHashTable.

## Details

### gcut_hash_table_equal ()

    gboolean            gcut_hash_table_equal               (GHashTable *hash1,
                                                             GHashTable *hash2,
                                                             GEqualFunc equal_func);

Compares two GHashTable, `hash1` and `hash2`. `equal_func` is called for each values of the same key of `hash1` and `hash2`.

e.g.:

    TODO

`hash1` : | a GHashTable to be compared.
`hash2` : | a GHashTable to be compared.
`equal_func` : | a function that compares two values.
Returns : | TRUE if all same key's values of `hash1` and `hash2` are reported TRUE by `equal_func`, FALSE otherwise.

Since 1.0.5

### gcut_hash_table_inspect ()

    gchar *             gcut_hash_table_inspect             (GHashTable *hash,
                                                             GCutInspectFunction key_inspect_func,
                                                             GCutInspectFunction value_inspect_func,
                                                             gpointer user_data);

Inspects `hash`. Each key of `hash` is inspected by `key_inspect_func` and each value of `hash` is inspected by `value_inspect_func`. The returned string should be freed when no longer needed.

e.g.:

    TODO

`hash` : | a GHashTable to be inspected.
`key_inspect_func` : | a function that inspects each key.
`value_inspect_func` : | a function that inspects each value.
`user_data` : | user data to pass to the function.
Returns : | inspected `hash` as a string.

Since 1.0.5

### gcut_hash_table_inspect_sorted ()

    gchar *             gcut_hash_table_inspect_sorted      (GHashTable *hash,
                                                             GCutInspectFunction key_inspect_func,
                                                             GCutInspectFunction value_inspect_func,
                                                             GCompareFunc key_compare_func,
                                                             gpointer user_data);

Sorts `hash` as key by `key_compare_func` and inspects it. Each key of `hash` is inspected by `key_inspect_func` and each value of `hash` is inspected by `value_inspect_func`. The returned string should be freed when no longer needed.

If `key_compare_func` is `NULL`, `hash` isn't sorted. It is the same behavior as `gcut_hash_table_inspect()`.

e.g.:

    TODO

`hash` : | a GHashTable to be inspected and sorted.
`key_inspect_func` : | a function that inspects each key.
`value_inspect_func` : | a function that inspects each value.
`key_compare_func` : | a function that compares each key.
`user_data` : | user data to pass to the function.
Returns : | inspected and sorted `hash` as a string.

Since 1.0.9

### gcut_hash_table_string_equal ()

    gboolean            gcut_hash_table_string_equal        (GHashTable *hash1,
                                                             GHashTable *hash2);

Compares two GHashTable, `hash1` and `hash2`. `hash1` and `hash2` should have string key and string value.

`hash1` : | a GHashTable to be compared.
`hash2` : | a GHashTable to be compared.
Returns : | TRUE if all same key's values of `hash1` and `hash2` are same string content, FALSE otherwise.

Since 1.0.5

### gcut_hash_table_string_string_copy ()

    GHashTable *        gcut_hash_table_string_string_copy  (GHashTable *hash);

Copy `hash`. `hash` should have string key and string value. The returned `hash` should be freed by `g_hash_table_unref()`.

`hash` : | a GHashTable to be copied.
Returns : | copied GHashTable. It should be freed when no longer needed.

Since 1.0.8

### gcut_hash_table_string_string_inspect ()

    gchar *             gcut_hash_table_string_string_inspect
                                                            (GHashTable *hash);

Inspects `hash`. `hash` should have string key and string value. The returned string should be freed when no longer needed.

`hash` : | a GHashTable to be inspected.
Returns : | inspected `hash` as a string.

Since 1.0.5