![]() |
![]() |
![]() |
Cutter Reference Manual | ![]() |
---|---|---|---|---|
Top | Description |
Test Utilities with GLib supportTest Utilities with GLib support — Utilities to write tests more easily with GLib support. |
#define gcut_take_object (object) #define gcut_take_error (error) const GList * gcut_take_list (const GList *list, CutDestroyFunction destroy_function); #define gcut_take_hash_table (hash_table) GList * gcut_list_string_new (const gchar *value, ...); GList * gcut_list_string_new_array (const gchar **strings); const GList * gcut_take_new_list_string (const gchar *value, ...); #define gcut_take_new_list_string_backward_compatibility(value, ...) const GList * gcut_take_new_list_string_array (const gchar **strings); void gcut_list_string_free (GList *list); GHashTable * gcut_hash_table_string_string_new (const gchar *key, ...); GHashTable * gcut_hash_table_string_string_new_va_list (const gchar *key, va_list args); GHashTable * gcut_take_new_hash_table_string_string (const gchar *key, ...);
To write tests, you need to write codes that set up/tear down test environment, prepare expected and actual values and so on. Cutter provides test utilities to you write your tests more easily.
The utilities work with GLib.
#define gcut_take_object(object)
Passes ownership of object
to Cutter and returns object
.
|
the GObject to be owned by Cutter. |
Since 1.0.3
#define gcut_take_error(error)
Passes ownership of error
to Cutter and returns
a error
itself.
|
the GError to be owned by Cutter. |
Since 1.0.3
const GList * gcut_take_list (const GList *list, CutDestroyFunction destroy_function);
Passes ownership of list
to Cutter and returns
list
itself.
|
the GList to be owned by Cutter. |
|
the destroy function that destroys the
elements of list , or NULL .
|
Returns : |
a GList owned by Cutter. Don't g_list_free()
it.
|
Since 1.0.3
#define gcut_take_hash_table(hash_table)
Passes ownership of hash_table
to Cutter and returns
hash_table
itself.
|
the GHashTable to be owned by Cutter. |
Since 1.0.4
GList * gcut_list_string_new (const gchar *value, ...);
Creates a list from passed strings.
|
the first string. |
|
remaining strings in list. NULL -terminate.
|
Returns : |
a newly-allocated GList that contains passed
strings and must be freed with gcut_list_string_free() .
|
Since 1.0.3
GList * gcut_list_string_new_array (const gchar **strings);
Creates a list from passed string array.
|
the string array. NULL -terminate.
|
Returns : |
a newly-allocated GList that contains passed
string array and must be freed with gcut_list_string_free() .
|
Since 1.0.6
const GList * gcut_take_new_list_string (const gchar *value, ...);
Creates a list from passed strings that is owned by Cutter.
|
the first string. |
|
remaining strings in list. NULL -terminate.
|
Returns : |
a newly-allocated GList that contains passed strings and is owned by Cutter. |
Since 1.0.5
#define gcut_take_new_list_string_backward_compatibility(value, ...)
gcut_take_new_list_string_backward_compatibility
is deprecated and should not be used in newly-written code.
|
|
|
const GList * gcut_take_new_list_string_array (const gchar **strings);
Creates a list from passed string array that is owned by Cutter.
|
the string array. NULL -terminate.
|
Returns : |
a newly-allocated GList that contains passed string array and is owned by Cutter. |
Since 1.0.6
void gcut_list_string_free (GList *list);
Frees list
and contained strings.
|
the list that contains strings to be freed. |
Since 1.0.3
GHashTable * gcut_hash_table_string_string_new (const gchar *key, ...);
Creates a hash table that has string key and string value from passed key/value pairs.
|
The first key string. |
|
A NULL -terminated list of rest arguments. The
first item is the string value of the first key,
followed optionally by more key/value pairs. It
must end with NULL .
|
Returns : |
a newly-allocated GHashTable that contains
passed key/value pairs and must be freed with
g_hash_table_unref() .
|
Since 1.0.4
GHashTable * gcut_hash_table_string_string_new_va_list (const gchar *key, va_list args);
Creates a hash table that has string key and string value from passed key/value pairs.
|
The first key string. |
|
A NULL -terminated list of rest arguments. The
first item is the string value of the first key,
followed optionally by more key/value pairs. It
must end with NULL .
|
Returns : |
a newly-allocated GHashTable that contains
passed key/value pairs and must be freed with
g_hash_table_unref() .
|
Since 1.0.5
GHashTable * gcut_take_new_hash_table_string_string (const gchar *key, ...);
Creates a hash table that has string key and string value
from passed key/value pairs. The created hash table is
owned by Cutter. So don't g_hash_table_unref()
it.
|
The first key string. |
|
A NULL -terminated list of rest arguments. The
string value of the first key, followed optionally
by more key/value pairs. It must end with NULL .
|
Returns : |
a newly-allocated GHashTable that contains passed key/value pairs. |
Since 1.0.5