GLib.test_create_case
Description: Reference for GLib.test_create_case

### Function

# GLibtest_create_case

since: 2.16

#### Declaration [src]

    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 [src]

Creates a new `GTestCase`.

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`

  Type: `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`

  Type: `gsize`

  The size of the fixture data structure.

`test_data`

  Type: `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`

  Type: `GTestFixtureFunc`

  The function to set up the fixture data.

`data_test`

  Type: `GTestFixtureFunc`

  The actual test function.

`data_teardown`

  Type: `GTestFixtureFunc`

  The function to teardown the fixture data.

#### Return value

Type: `GTestCase`

A newly allocated test case.

The data is owned by the called function.