## Assertions with GLib support Assertions with GLib support — Checks that your program works as you expect with GLib support. |

## Synopsis

    void                gcut_assert_equal_type              (GType expected,
                                                             GType actual,
                                                             ...);
    void                cut_assert_equal_g_type             (GType expected,
                                                             GType actual,
                                                             ...);
    void                gcut_assert_equal_value             (GValue *expected,
                                                             GValue *actual,
                                                             ...);
    void                cut_assert_equal_g_value            (GValue *expected,
                                                             GValue *actual,
                                                             ...);
    void                gcut_assert_equal_list              (GList *expected,
                                                             GList *actual,
                                                             GEqualFunc equal_function,
                                                             GCutInspectFunction inspect_function,
                                                             gpointer inspect_user_data);
    void                gcut_assert_equal_list_int          (GList *expected,
                                                             GList *actual,
                                                             ...);
    void                cut_assert_equal_g_list_int         (GList *expected,
                                                             GList *actual,
                                                             ...);
    void                gcut_assert_equal_list_uint         (GList *expected,
                                                             GList *actual,
                                                             ...);
    void                gcut_assert_equal_list_string       (GList *expected,
                                                             GList *actual,
                                                             ...);
    void                cut_assert_equal_g_list_string      (GList *expected,
                                                             GList *actual,
                                                             ...);
    void                gcut_assert_equal_list_object       (GList *expected,
                                                             GList *actual,
                                                             ...);
    void                gcut_assert_equal_list_object_custom
                                                            (GList *expected,
                                                             GList *actual,
                                                             GEqualFunc equal_function,
                                                             ...);
    void                gcut_assert_equal_list_enum         (GType type,
                                                             GList *expected,
                                                             GList *actual,
                                                             ...);
    void                gcut_assert_equal_list_flags        (GType type,
                                                             GList *expected,
                                                             GList *actual,
                                                             ...);
    void                gcut_assert_equal_hash_table        (GHashTable *expected,
                                                             GHashTable *actual,
                                                             GEqualFunc equal_function,
                                                             GCutInspectFunction key_inspect_function,
                                                             GCutInspectFunction value_inspect_function,
                                                             gpointer inspect_user_data);
    void                gcut_assert_equal_hash_table_string_string
                                                            (GHashTable *expected,
                                                             GHashTable *actual,
                                                             ...);
    void                gcut_assert_error                   (GError *error,
                                                             ...);
    void                cut_assert_g_error                  (GError *error,
                                                             ...);
    void                gcut_assert_equal_error             (GError *expected,
                                                             GError *actual,
                                                             ...);
    void                gcut_assert_remove_path             (const gchar *path,
                                                             ...);
    void                cut_assert_remove_path              (const gchar *path,
                                                             ...);
    void                gcut_assert_equal_time_val          (GTimeVal expected,
                                                             GTimeVal actual,
                                                             ...);
    void                gcut_assert_equal_enum              (GType enum_type,
                                                             gint expected,
                                                             gint actual,
                                                             ...);
    void                gcut_assert_equal_flags             (GType flags_type,
                                                             guint expected,
                                                             guint actual,
                                                             ...);
    void                gcut_assert_equal_object            (GObject *expected,
                                                             GObject *actual,
                                                             ...);
    void                gcut_assert_equal_object_custom     (GObject *expected,
                                                             GObject *actual,
                                                             GEqualFunc equal_function,
                                                             ...);
    void                gcut_assert_equal_int64             (gint64 expected,
                                                             gint64 actual,
                                                             ...);
    void                gcut_assert_equal_uint64            (guint64 expected,
                                                             guint64 actual,
                                                             ...);
    void                gcut_assert_equal_pid               (GPid expected,
                                                             GPid actual);
    void                gcut_assert_not_equal_pid           (GPid expected,
                                                             GPid actual);

## Description

## Details

### gcut_assert_equal_type ()

    void                gcut_assert_equal_type              (GType expected,
                                                             GType actual,
                                                             ...);

Passes if `expected` == `actual`.

`expected` : | an expected GType.
`actual` : | an actual GType.
`...` : | optional format string, followed by parameters to insert into the format string. (as with `printf()`) This is deprecated since 0.1.6. Use `cut_set_message()` instead.

Since 1.0.3

### cut_assert_equal_g_type ()

    void                cut_assert_equal_g_type             (GType expected,
                                                             GType actual,
                                                             ...);

### Warning

`cut_assert_equal_g_type` has been deprecated since version 1.0.3 and should not be used in newly-written code. Use `gcut_assert_equal_type()` instead.

Passes if `expected` == `actual`.

`expected` : | an expected GType.
`actual` : | an actual GType.
`...` : | optional format string, followed by parameters to insert into the format string. (as with `printf()`) This is deprecated since 0.1.6. Use `cut_set_message()` instead.

### gcut_assert_equal_value ()

    void                gcut_assert_equal_value             (GValue *expected,
                                                             GValue *actual,
                                                             ...);

Passes if `expected` == `actual`.

`expected` : | an expected GValue *.
`actual` : | an actual GValue *.
`...` : | optional format string, followed by parameters to insert into the format string. (as with `printf()`) This is deprecated since 0.1.6. Use `cut_set_message()` instead.

Since 1.0.3

### cut_assert_equal_g_value ()

    void                cut_assert_equal_g_value            (GValue *expected,
                                                             GValue *actual,
                                                             ...);

### Warning

`cut_assert_equal_g_value` has been deprecated since version 1.0.3 and should not be used in newly-written code. Use `gcut_assert_equal_value()` instead.

Passes if `expected` == `actual`.

`expected` : | an expected GValue *.
`actual` : | an actual GValue *.
`...` : | optional format string, followed by parameters to insert into the format string. (as with `printf()`) This is deprecated since 0.1.6. Use `cut_set_message()` instead.

### gcut_assert_equal_list ()

    void                gcut_assert_equal_list              (GList *expected,
                                                             GList *actual,
                                                             GEqualFunc equal_function,
                                                             GCutInspectFunction inspect_function,
                                                             gpointer inspect_user_data);

Passes if `equal_function`(`expected`, `actual`) == `CUT_TRUE`.

`expected` : | an expected list.
`actual` : | an actual list.
`equal_function` : | a function that compares each elements of `expected` and `actual` list.
`inspect_function` : | a function that inspected `expected` and `actual` list.
`inspect_user_data` : | a data to be passed to `inspect_function`.

Since 1.0.6

### gcut_assert_equal_list_int ()

    void                gcut_assert_equal_list_int          (GList *expected,
                                                             GList *actual,
                                                             ...);

Passes if `expected` == `actual`.

`expected` : | an expected GList * of integer.
`actual` : | an actual GList * of integer.
`...` : | optional format string, followed by parameters to insert into the format string. (as with `printf()`) This is deprecated since 0.1.6. Use `cut_set_message()` instead.

Since 1.0.3

### cut_assert_equal_g_list_int ()

    void                cut_assert_equal_g_list_int         (GList *expected,
                                                             GList *actual,
                                                             ...);

### Warning

`cut_assert_equal_g_list_int` has been deprecated since version 1.0.3 and should not be used in newly-written code. Use `gcut_assert_equal_list_int()` instead.

Passes if `expected` == `actual`.

`expected` : | an expected GList * of integer.
`actual` : | an actual GList * of integer.
`...` : | optional format string, followed by parameters to insert into the format string. (as with `printf()`) This is deprecated since 0.1.6. Use `cut_set_message()` instead.

Since 0.8

### gcut_assert_equal_list_uint ()

    void                gcut_assert_equal_list_uint         (GList *expected,
                                                             GList *actual,
                                                             ...);

Passes if `expected` == `actual`.

`expected` : | an expected GList * of unsigned integer.
`actual` : | an actual GList * of unsigned integer.
`...` : | optional format string, followed by parameters to insert into the format string. (as with `printf()`) This is deprecated since 0.1.6. Use `cut_set_message()` instead.

Since 1.0.3

### gcut_assert_equal_list_string ()

    void                gcut_assert_equal_list_string       (GList *expected,
                                                             GList *actual,
                                                             ...);

Passes if `expected` == `actual`.

`expected` : | an expected GList * of string.
`actual` : | an actual GList * of string.
`...` : | optional format string, followed by parameters to insert into the format string. (as with `printf()`) This is deprecated since 0.1.6. Use `cut_set_message()` instead.

Since 1.0.3

### cut_assert_equal_g_list_string ()

    void                cut_assert_equal_g_list_string      (GList *expected,
                                                             GList *actual,
                                                             ...);

### Warning

`cut_assert_equal_g_list_string` has been deprecated since version 1.0.3 and should not be used in newly-written code. Use `gcut_assert_equal_list_string()` instead.

Passes if `expected` == `actual`.

`expected` : | an expected GList * of string.
`actual` : | an actual GList * of string.
`...` : | optional format string, followed by parameters to insert into the format string. (as with `printf()`) This is deprecated since 0.1.6. Use `cut_set_message()` instead.

Since 0.8

### gcut_assert_equal_list_object ()

    void                gcut_assert_equal_list_object       (GList *expected,
                                                             GList *actual,
                                                             ...);

Passes if `expected` and `actual` has same GObject * in same order.

`expected` : | an expected GList * of GObject *.
`actual` : | an actual GList * of GObject *.
`...` : | optional format string, followed by parameters to insert into the format string. (as with `printf()`) This is deprecated since 0.1.6. Use `cut_set_message()` instead.

Since 1.0.5

### gcut_assert_equal_list_object_custom ()

    void                gcut_assert_equal_list_object_custom
                                                            (GList *expected,
                                                             GList *actual,
                                                             GEqualFunc equal_function,
                                                             ...);

Passes if `expected` and `actual` has same GObject * in same order. Each comparison of GObject * uses `equal_function`.

`expected` : | an expected GList * of GObject *.
`actual` : | an actual GList * of GObject *.
`equal_function` : | a function that compares two GObject *. (GEqualFunc)
`...` : | optional format string, followed by parameters to insert into the format string. (as with `printf()`) This is deprecated since 0.1.6. Use `cut_set_message()` instead.

Since 1.0.5

### gcut_assert_equal_list_enum ()

    void                gcut_assert_equal_list_enum         (GType type,
                                                             GList *expected,
                                                             GList *actual,
                                                             ...);

Passes if `expected` and `actual` has same enum values in same order.

`type` : | a GEnum type.
`expected` : | an expected GList * of enum value.
`actual` : | an actual GList * of enum value.
`...` : | optional format string, followed by parameters to insert into the format string. (as with `printf()`) This is deprecated since 0.1.6. Use `cut_set_message()` instead.

Since 1.0.5

### gcut_assert_equal_list_flags ()

    void                gcut_assert_equal_list_flags        (GType type,
                                                             GList *expected,
                                                             GList *actual,
                                                             ...);

Passes if `expected` and `actual` has same flags values in same order.

`type` : | a GFlags type.
`expected` : | an expected GList * of flags value.
`actual` : | an actual GList * of flags value.
`...` : | optional format string, followed by parameters to insert into the format string. (as with `printf()`) This is deprecated since 0.1.6. Use `cut_set_message()` instead.

Since 1.0.5

### gcut_assert_equal_hash_table ()

    void                gcut_assert_equal_hash_table        (GHashTable *expected,
                                                             GHashTable *actual,
                                                             GEqualFunc equal_function,
                                                             GCutInspectFunction key_inspect_function,
                                                             GCutInspectFunction value_inspect_function,
                                                             gpointer inspect_user_data);

Passes if `expected` == `actual`.

`expected` : | an expected GHashTable of string.
`actual` : | an actual GHashTable of string.
`equal_function` : | a function that compares each values of `expected` and `actual` hash table.
`key_inspect_function` : | a function that inspected a key of `expected` and `actual` hash table.
`value_inspect_function` : | a function that inspected a value of `expected` and `actual` hash table.
`inspect_user_data` : | a data to be passed to `inspect_function`.

Since 1.0.6

### gcut_assert_equal_hash_table_string_string ()

    void                gcut_assert_equal_hash_table_string_string
                                                            (GHashTable *expected,
                                                             GHashTable *actual,
                                                             ...);

Passes if `expected` == `actual`.

`expected` : | an expected GHashTable of string.
`actual` : | an actual GHashTable of string.
`...` : | optional format string, followed by parameters to insert into the format string. (as with `printf()`) This is deprecated since 0.1.6. Use `cut_set_message()` instead.

Since 1.0.4

### gcut_assert_error ()

    void                gcut_assert_error                   (GError *error,
                                                             ...);

Passes if `error` == `NULL`.

`error` : | a target GError *.
`...` : | optional format string, followed by parameters to insert into the format string. (as with `printf()`) This is deprecated since 0.1.6. Use `cut_set_message()` instead.

Since 1.0.3

### cut_assert_g_error ()

    void                cut_assert_g_error                  (GError *error,
                                                             ...);

### Warning

`cut_assert_g_error` has been deprecated since version 1.0.3 and should not be used in newly-written code. Use `gcut_assert_error()` instead.

Passes if `error` == `NULL`.

`error` : | a target GError *.
`...` : | optional format string, followed by parameters to insert into the format string. (as with `printf()`) This is deprecated since 0.1.6. Use `cut_set_message()` instead.

Since 1.0

### gcut_assert_equal_error ()

    void                gcut_assert_equal_error             (GError *expected,
                                                             GError *actual,
                                                             ...);

Passes if `expected` == `actual`.

`expected` : | an expected GError *.
`actual` : | an actual GError *.
`...` : | optional format string, followed by parameters to insert into the format string. (as with `printf()`) This is deprecated since 0.1.6. Use `cut_set_message()` instead.

Since 1.0.5

### gcut_assert_remove_path ()

    void                gcut_assert_remove_path             (const gchar *path,
                                                             ...);

Passes if cut_utils_build_path(`path`, ...) is removed successfully.

`path` : | a first element of the path to the removed path.
`...` : | remaining elements in path. NULL terminated.

Since 1.0.3

### cut_assert_remove_path ()

    void                cut_assert_remove_path              (const gchar *path,
                                                             ...);

### Warning

`cut_assert_remove_path` has been deprecated since version 1.0.3 and should not be used in newly-written code. Use `gcut_assert_remove_path()` instead.

Passes if cut_utils_build_path(`path`, ...) is removed successfully.

`path` : | a first element of the path to the removed path.
`...` : | remaining elements in path. NULL terminated.

Since 1.0.2

### gcut_assert_equal_time_val ()

    void                gcut_assert_equal_time_val          (GTimeVal expected,
                                                             GTimeVal actual,
                                                             ...);

Passes if `expected` == `actual`.

`expected` : | an expected GTimeVal.
`actual` : | an actual GTimeVal.
`...` : | optional format string, followed by parameters to insert into the format string. (as with `printf()`) This is deprecated since 0.1.6. Use `cut_set_message()` instead.

Since 1.0.4

### gcut_assert_equal_enum ()

    void                gcut_assert_equal_enum              (GType enum_type,
                                                             gint expected,
                                                             gint actual,
                                                             ...);

Passes if `expected` == `actual`.

e.g.:

    gcut_assert_equal_enum(GTK_TYPE_DIRECTION_TYPE,
                              GTK_DIR_LEFT, GTK_DIR_LEFT); -> Pass
    gcut_assert_equal_enum(GTK_TYPE_DIRECTION_TYPE,
                              GTK_DIR_DOWN, GTK_DIR_LEFT); -> Fail

`enum_type` : | a GEnum type.
`expected` : | an expected enum value.
`actual` : | an actual enum value.
`...` : | optional format string, followed by parameters to insert into the format string. (as with `printf()`) This is deprecated since 0.1.6. Use `cut_set_message()` instead.

Since 1.0.5

### gcut_assert_equal_flags ()

    void                gcut_assert_equal_flags             (GType flags_type,
                                                             guint expected,
                                                             guint actual,
                                                             ...);

Passes if `expected` == `actual`.

e.g.:

    gcut_assert_equal_flags(GTK_TYPE_DIALOG_FLAGS,
                            GTK_DIALOG_DESTROY_MODAL |
                              GTK_DIALOG_DESTROY_WITH_PARENT,
                            GTK_DIALOG_DESTROY_MODAL |
                              GTK_DIALOG_DESTROY_WITH_PARENT); -> Pass
    gcut_assert_equal_flags(GTK_TYPE_DIALOG_FLAGS,
                            GTK_DIALOG_DESTROY_MODAL |
                              GTK_DIALOG_DESTROY_WITH_PARENT,
                            GTK_DIALOG_DESTROY_MODAL); -> Fail

`flags_type` : | a GFlags type.
`expected` : | an expected flags value.
`actual` : | an actual flags value.
`...` : | optional format string, followed by parameters to insert into the format string. (as with `printf()`) This is deprecated since 0.1.6. Use `cut_set_message()` instead.

Since 1.0.5

### gcut_assert_equal_object ()

    void                gcut_assert_equal_object            (GObject *expected,
                                                             GObject *actual,
                                                             ...);

Passes if `expected` == `actual`. See `gcut_assert_equal_object_custom()` when you need to customize equality check.

e.g.:

    gcut_assert_equal_object(object, object);   -> Pass
    gcut_assert_equal_object(object1, object2); -> Fail
    gcut_assert_equal_object(NULL, NULL);       -> Pass
    gcut_assert_equal_object(object1, NULL);    -> Fail

`expected` : | an expected object. (GObject *)
`actual` : | an actual object. (GObject *)
`...` : | optional format string, followed by parameters to insert into the format string. (as with `printf()`) This is deprecated since 0.1.6. Use `cut_set_message()` instead.

Since 1.0.5

### gcut_assert_equal_object_custom ()

    void                gcut_assert_equal_object_custom     (GObject *expected,
                                                             GObject *actual,
                                                             GEqualFunc equal_function,
                                                             ...);

Passes if `equal_function`(`expected`, `actual`) == `CUT_TRUE`.

e.g.:

    static gboolean
    equal_name (gconstpointer data1, gconstpointer data2)
    {
        return g_str_equal(my_object_get_name(MY_OBJECT(data1)),
                           my_object_get_name(MY_OBJECT(data2)));
    }

    gcut_assert_equal_object_custom(object, object, equal_name);   -> Pass
    gcut_assert_equal_object_custom(same_name_object1,
                                    same_name_object2,
                                    equal_name);                   -> Pass
    gcut_assert_equal_object_custom(different_name_object1,
                                    different_name_object2,
                                    equal_name);                   -> Fail

`expected` : | an expected object. (GObject *)
`actual` : | an actual object. (GObject *)
`equal_function` : | a function that compare two object. (GEqualFunc)
`...` : | optional format string, followed by parameters to insert into the format string. (as with `printf()`) This is deprecated since 0.1.6. Use `cut_set_message()` instead.

Since 1.0.5

### gcut_assert_equal_int64 ()

    void                gcut_assert_equal_int64             (gint64 expected,
                                                             gint64 actual,
                                                             ...);

Passes if `expected` == `actual`.

`expected` : | an expected 64 bit integer value. (gint64)
`actual` : | an actual 64 bit integer value. (gint64)
`...` : | optional format string, followed by parameters to insert into the format string. (as with `printf()`) This is deprecated since 0.1.6. Use `cut_set_message()` instead.

Since 1.0.5

### gcut_assert_equal_uint64 ()

    void                gcut_assert_equal_uint64            (guint64 expected,
                                                             guint64 actual,
                                                             ...);

Passes if `expected` == `actual`.

`expected` : | an expected unsigned integer value. (guint64)
`actual` : | an actual unsigned integer value. (guint64)
`...` : | optional format string, followed by parameters to insert into the format string. (as with `printf()`) This is deprecated since 0.1.6. Use `cut_set_message()` instead.

Since 1.0.5

### gcut_assert_equal_pid ()

    void                gcut_assert_equal_pid               (GPid expected,
                                                             GPid actual);

Passes if `expected` == `actual`.

`expected` : | an expected value.
`actual` : | an actual value.

Since 1.0.6

### gcut_assert_not_equal_pid ()

    void                gcut_assert_not_equal_pid           (GPid expected,
                                                             GPid actual);

Passes if `expected` != `actual`.

`expected` : | an expected value.
`actual` : | an actual value.

Since 1.0.7