## Assertion Utilities for GEnum and GFlags Assertion Utilities for GEnum and GFlags — Utilities to write assertions related to GEnum or GFlags more easily. |

## Synopsis

    #define             GCUT_ENUM_ERROR
    GQuark              gcut_enum_error_quark               (void);
    enum                GCutEnumError;
    gchar *             gcut_enum_inspect                   (GType enum_type,
                                                             gint enum_value);
    gint                gcut_enum_parse                     (GType enum_type,
                                                             const gchar *enum_value,
                                                             GError **error);
    gchar *             gcut_flags_inspect                  (GType flags_type,
                                                             guint flags_value);
    guint               gcut_flags_parse                    (GType flags_type,
                                                             const gchar *flags_value,
                                                             GError **error);
    guint               gcut_flags_get_all                  (GType flags_type,
                                                             GError **error);

## 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 GEnum or GFlags.

## Details

### GCUT_ENUM_ERROR

    #define GCUT_ENUM_ERROR (gcut_enum_error_quark())

Error domain for enum related operations. Errors in this domain will be from the GCutEnumError enumeration.

Since 1.0.6

### gcut_enum_error_quark ()

    GQuark              gcut_enum_error_quark               (void);

Returns : |

### enum GCutEnumError

    typedef enum
    {
        GCUT_ENUM_ERROR_INVALID_TYPE,
        GCUT_ENUM_ERROR_INVALID_VALUE
    } GCutEnumError;

Error codes returned by enum related operation.

`GCUT_ENUM_ERROR_INVALID_TYPE` | Invalid type.
`GCUT_ENUM_ERROR_INVALID_VALUE` | Invalid value.

Since 1.0.6

### gcut_enum_inspect ()

    gchar *             gcut_enum_inspect                   (GType enum_type,
                                                             gint enum_value);

Inspects `enum_type` value, `enum_value`. The returned string should be freed when no longer needed.

`enum_type` : | a GEnum type.
`enum_value` : | a GEnum value to be inspected.
Returns : | inspected `enum_value` as a string.

Since 1.0.5

### gcut_enum_parse ()

    gint                gcut_enum_parse                     (GType enum_type,
                                                             const gchar *enum_value,
                                                             GError **error);

Parses `enum_value` and returns a enum value of `enum_type`. `enum_value` should be enum name or nick name. If `enum_value` isn't match then `error` is set to a GCutEnumError.

`enum_type` : | a GEnum type.
`enum_value` : | a string to be parsed.
`error` : | return location for an error, or `NULL`
Returns : | enum value of `enum_type` corresponded to `enum_value`.

Since 1.0.6

### gcut_flags_inspect ()

    gchar *             gcut_flags_inspect                  (GType flags_type,
                                                             guint flags_value);

Inspects `flags_type` value, `flags_value`. The returned string should be freed when no longer needed.

`flags_type` : | a GFlags type.
`flags_value` : | a GFlags value to be inspected.
Returns : | inspected `flags_value` as a string.

Since 1.0.5

### gcut_flags_parse ()

    guint               gcut_flags_parse                    (GType flags_type,
                                                             const gchar *flags_value,
                                                             GError **error);

Parses `flags_value` and returns a flags value of `flags_type`. `flags_value` should be formated as "nick-or-name1|nick-or-name2|...|nick-or-nameN". If `flags_value` includes unknown flag then `error` is set to a GCutEnumError.

`flags_type` : | a GFlags type.
`flags_value` : | a string to be parsed.
`error` : | return location for an error, or `NULL`
Returns : | flags value of `flags_type` corresponded to `flags_value`.

Since 1.0.6

### gcut_flags_get_all ()

    guint               gcut_flags_get_all                  (GType flags_type,
                                                             GError **error);

Gets a flags value that includes all available flag values.

`flags_type` : | a GFlags type.
`error` : | return location for an error, or `NULL`
Returns : | a flags value that includes all available flag values.

Since 1.0.6