Function
GLibtest_create_case
Declaration
GTestCase*
g_test_create_case (
const char* test_name,
gsize data_size,
gconstpointer test_data,
GTestFixtureFunc data_setup,
GTestFixtureFunc data_test,
GTestFixtureFunc data_teardown
)
Description
Create a new GTestCase
, named test_name
.
This API is fairly low level, and calling g_test_add()
or g_test_add_func()
is preferable.
When this test is executed, a fixture structure of size data_size
will be automatically allocated and filled with zeros. Then data_setup
is
called to initialize the fixture. After fixture setup, the actual test
function data_test
is called. Once the test run completes, the
fixture structure is torn down by calling data_teardown
and
after that the memory is automatically released by the test framework.
Splitting up a test run into fixture setup, test function and
fixture teardown is most useful if the same fixture type is used for
multiple tests. In this cases, g_test_create_case()
will be
called with the same type of fixture (the data_size
argument), but varying
test_name
and data_test
arguments.
Available since: | 2.16 |
This function is not directly available to language bindings |
Parameters
test_name |
const char* |
The name for the test case. |
|
The data is owned by the caller of the function. | |
The value is a NUL terminated UTF-8 string. | |
data_size |
gsize |
The size of the fixture data structure. |
|
test_data |
gconstpointer |
Test data argument for the test functions. |
|
The argument can be NULL . | |
The data is owned by the caller of the function. | |
data_setup |
GTestFixtureFunc |
The function to set up the fixture data. |
|
data_test |
GTestFixtureFunc |
The actual test function. |
|
data_teardown |
GTestFixtureFunc |
The function to teardown the fixture data. |
Return value
Returns: | GTestCase |
A newly allocated |
|
The data is owned by the called function. |