![]() |
![]() |
![]() |
Cutter Reference Manual | ![]() |
---|---|---|---|---|
Assertion Utilities for GHashTableAssertion Utilities for GHashTable — Utilities to write assertions related to GHashTable more easily. |
gboolean gcut_hash_table_equal (GHashTable *hash1, GHashTable *hash2, GEqualFunc equal_func); gchar* gcut_hash_table_inspect (GHashTable *hash, GCutInspectFunc key_inspect_func, GCutInspectFunc value_inspect_func, gpointer user_data); gboolean gcut_hash_table_string_equal (GHashTable *hash1, GHashTable *hash2); gchar* gcut_hash_table_string_string_inspect (GHashTable *hash);
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.
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
|
a GHashTable to be compared. |
|
a GHashTable to be compared. |
|
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
gchar* gcut_hash_table_inspect (GHashTable *hash, GCutInspectFunc key_inspect_func, GCutInspectFunc 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
|
a GHashTable to be inspected. |
|
a function that inspects each key. |
|
a function that inspects each value. |
|
user data to pass to the function. |
Returns : |
inspected hash as a string.
|
Since 1.0.5
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.
|
a GHashTable to be compared. |
|
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
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.
|
a GHashTable to be inspected. |
Returns : |
inspected hash as a string.
|
Since 1.0.5