TestCase


Description:

[ Version ( since = "2.16" ) ]
[ CCode ( cname = "g_test_create_case" ) ]
public TestCase (string test_name, TestFixtureFunc data_setup, TestFixtureFunc data_func, TestFixtureFunc data_teardown, size_t data_size = 0)

Create a new TestCase, named test_name.

This API is fairly low level, and calling add or 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, TestCase will be called with the same type of fixture (the data_size argument), but varying test_name and data_test arguments.

Parameters:

test_name

the name for the test case

data_setup

the function to set up the fixture data

data_teardown

the function to teardown the fixture data

data_size

the size of the fixture data structure

data_test

the actual test function

test_data

test data argument for the test functions

Returns:

a newly allocated TestCase.