GLibサポート付きテストユーティリティ

GLibサポート付きテストユーティリティ — テストをもっと簡単に書くためのGLibサポート付きユーティリティ。

Functions

説明

テストを書くためには、テスト環境を前処理・後処理するコードや、検証する結果を準備するコードなどたくさんのコードを書く必要があります。Cutterはもっと簡単にテストを書くためにユーティリティを提供します。

このユーティリティはGLibと一緒に使います。

Functions

gcut_take_object ()

GObject *
gcut_take_object (GObject *object);

Passes ownership of object to Cutter and returns object .

Parameters

object

Cutterに所有権を渡すGObject

 

Returns

Cutterが所有権をもつobjectg_object_unref()しないでください。

Since: 1.0.3


gcut_take_error ()

GError *
gcut_take_error (GError *error);

Cutterにerrorの所有権を渡し、errorそれ自身を返します。

Parameters

error

Cutterに所有権を渡すGError

 

Returns

Cutterが所有権をもつGErrorg_error_free()しないでください。

Since: 1.0.3


gcut_take_list ()

const GList *
gcut_take_list (const GList *list,
                CutDestroyFunction destroy_function);

listの所有権をCutterに渡し、listそれ自身を返します。

Parameters

list

Cutterに所有権を渡すGList

 

destroy_function

the destroy function that destroys the elements of list , or NULL.

 

Returns

Cutterが所有権を持つGListg_list_free()しないでください。

Since: 1.0.3


gcut_take_hash_table ()

GHashTable *
gcut_take_hash_table (GHashTable *hash_table);

hash_tableの所有権をCutterに渡し、hash_tableそれ自身を返します。

Parameters

hash_table

Cutterに所有権を渡すGHashTable

 

Returns

Cutterが所有権をもつGHashTableg_hash_table_unref()しないでください。

Since: 1.0.4


gcut_take_string ()

GString *
gcut_take_string (GString *string);

stringの所有権をCutterに渡し、stringそれ自身を返します。

Parameters

string

Cutterに所有権を渡すGString

 

Returns

Cutterが所有権を持つGStringg_string_free()しないでください。

Since: 1.1.6


gcut_take_new_string ()

GString *
gcut_take_new_string (const gchar *string);

渡された文字列からGStringを作成します。

Parameters

string

文字列。NULLも可。

 

Returns

Cutterが所有権を持つGStringg_string_free()しないでください。

Since: 1.1.6


gcut_list_new ()

GList *
gcut_list_new (const gpointer element,
               ...);

渡された要素を含むリストを作ります。

例:

1
2
3
4
5
GCutEgg *echo_egg, *cat_egg;

echo_egg = gcut_egg_new("echo", "Hello", NULL);
cat_egg = gcut_egg_new("cat", "/etc/hosts", NULL);
egg_list = gcut_list_new(echo_egg, cat_egg, NULL);

Parameters

element

最初のgpointer

 

...

パスの残りの要素。NULL終端。

 

Returns

新しく割り当てられたGList。渡された要素を持ちます。

Since: 1.1.1


gcut_list_int_new ()

GList *
gcut_list_int_new (guint n,
                   gint value,
                   ...);

渡された整数からリストを作ります。

例:

1
gcut_list_int_new(3, -10, 1, 29); -> (-10, 1, 29)

Parameters

n

整数の数。

 

value

最初の整数値。

 

...

リストの残りの整数値。

 

Returns

渡された整数を含むGListg_list_free()で開放すること。

Since: 1.1.5


gcut_list_uint_new ()

GList *
gcut_list_uint_new (guint n,
                    guint value,
                    ...);

渡された符号無し整数からリストを作ります。

例:

1
gcut_list_uint_new(3, 0, 1, 2); -> (0, 1, 2)

Parameters

n

符号無し符号整数の数。

 

value

最初の符号無し符号整数値。

 

...

リストの残りの符号無し符号整数値。

 

Returns

渡された符号無し整数を含むGListg_list_free()で開放すること。

Since: 1.1.5


gcut_list_string_new ()

GList *
gcut_list_string_new (const gchar *value,
                      ...);

渡された文字列からリストを作ります。

Parameters

value

最初の文字列。

 

...

リストの残りの文字列。NULL終端。

 

Returns

渡された文字列を含むGListgcut_list_string_free()で開放すること。

Since: 1.0.3


gcut_list_string_new_array ()

GList *
gcut_list_string_new_array (const gchar **strings);

渡された文字列配列からリストを作ります。

Parameters

strings

文字列の配列。NULL終端。

 

Returns

渡された文字列配列と同じ内容のGListgcut_list_string_free()で開放すること。

Since: 1.0.6


gcut_take_new_list_int ()

const GList *
gcut_take_new_list_int (guint n,
                        gint value,
                        ...);

渡された整数からリストを作ります。作られたリストはCutterが所有権を持ちます。

例:

1
gcut_take_new_list_int(3, -10, 1, 29); -> (-10, 1, 29)

Parameters

n

整数の数。

 

value

最初の整数値。

 

...

リストの残りの文字列。

 

Returns

渡された整数と同じ内容のGList。Cutterが所有権を持ちます。

Since: 1.1.5


gcut_take_new_list_uint ()

const GList *
gcut_take_new_list_uint (guint n,
                         guint value,
                         ...);

渡された符号無し整数からリストを作ります。作られたリストはCutterが所有権を持ちます。

例:

1
gcut_take_new_list_uint(3, 0, 1, 2); -> (0, 1, 2)

Parameters

n

符号無し符号整数の数。

 

value

最初の符号無し符号整数値。

 

...

リストの残りの文字列。

 

Returns

渡された符号無し整数と同じ内容のGList。Cutterが所有権を持ちます。

Since: 1.1.5


gcut_take_new_list_string ()

const GList *
gcut_take_new_list_string (const gchar *value,
                           ...);

渡された文字列からリストを作ります。作られたリストはCutterが所有権を持ちます。

Parameters

value

最初の文字列。

 

...

リストの残りの文字列。NULL終端。

 

Returns

渡された文字列と同じ内容のGList。Cutterが所有権を持ちます。

Since: 1.0.5


gcut_take_new_list_string_backward_compatibility()

#define             gcut_take_new_list_string_backward_compatibility(value, ...)

gcut_take_new_list_string_backward_compatibilityは非推奨です。新しいコードでは使わないでください。


gcut_take_new_list_string_array ()

const GList *
gcut_take_new_list_string_array (const gchar **strings);

渡された文字列の配列からリストを作ります。Cutterが所有権を持ちます。

Parameters

strings

文字列の配列。NULL終端。

 

Returns

渡された文字列の配列と同じ内容のGList。Cutterが所有。

Since: 1.0.6


gcut_take_new_list_object()

#define             gcut_take_new_list_object(object, ...)

渡されたオブジェクトからリストを作ります。作られたリストはCutterが所有権を持ちます。

Parameters

object

最初のGObject

 

...

リストの残りのオブジェクト。NULL終端。

 

Returns

新しく割り当てられたGList。リストには渡されたオブジェクトが含まれます。Cutterが所有権を持ちます。

Since: 1.1.1


gcut_list_string_free ()

void
gcut_list_string_free (GList *list);

listlist内にある文字列を開放します。

Parameters

list

開放する文字列のリスト。

 

Since: 1.0.3


gcut_list_object_free ()

void
gcut_list_object_free (GList *list);

listと中のオブジェクトを破棄します。listNULLが含まれていても大丈夫です。

Parameters

list

リファレンスを減らしたいGObjectを含んだリスト。

 

Since: 1.1.1


gcut_hash_table_string_string_new ()

GHashTable *
gcut_hash_table_string_string_new (const gchar *key,
                                   ...);

引数で指定されたキーと値のペアから、文字列のキーと値を持つハッシュテーブルを作成します。

Parameters

key

最初のキー文字列。

 

...

残りの引数のNULL終端のリスト。まず、最初のキーの文字列値を指定します。続いて、任意の数だけキー・値のペアを指定します。最後にNULLを指定しなければいけません。

 

Returns

渡されたキー・値を持つGHashTableg_hash_table_unref()で開放してください。

Since: 1.0.4


gcut_hash_table_string_string_new_va_list ()

GHashTable *
gcut_hash_table_string_string_new_va_list
                               (const gchar *key,
                                va_list args);

引数で指定されたキーと値のペアから、文字列のキーと値を持つハッシュテーブルを作成します。

Parameters

key

最初のキー文字列。

 

args

残りの引数のNULL終端のリスト。まず、最初のキーの文字列値を指定します。続いて、任意の数だけキー・値のペアを指定します。最後にNULLを指定しなければいけません。

 

Returns

渡されたキー・値を持つGHashTableg_hash_table_unref()で開放してください。

Since: 1.0.5


gcut_take_new_hash_table_string_string ()

GHashTable *
gcut_take_new_hash_table_string_string
                               (const gchar *key,
                                ...);

渡されたキー・値のペアから文字列のキー・値を持つハッシュテーブルを作成します。作成されたハッシュテーブルはCutterが所有権を持つので、g_hash_table_unref()を呼ばないでください。

Parameters

key

最初のキー文字列。

 

...

残りの引数のNULL終端のリスト。まず、最初のキーの文字列値を指定します。続いて、任意の数だけキー・値のペアを指定します。最後にNULLを指定しなければいけません。

 

Returns

渡されたキー・値を持つGHashTable

Since: 1.0.5


gcut_get_fixture_data ()

GString *
gcut_get_fixture_data (const gchar *path,
                       ...);

Reads the fixture data at "path /..." and returns it as a GString that is owned by Cutter. The description of cut_build_fixture_path() shows how the fixture data path is determined.

Parameters

path

フィクスチャデータのパスの最初の要素。

 

...

パスの残りの要素。NULL終端が必須です。

 

Returns

フィクスチャデータの内容が入ったGString。GStringはCutterが所持します。開放しないでください。

Since: 1.1.6

Types and Values