since: 2.16


g_test_add_data_func (
  const char* testpath,
  gconstpointer test_data,
  GTestDataFunc test_func


Create a new test case, similar to g_test_create_case(). However the test is assumed to use no fixture, and test suites are automatically created on the fly and added to the root fixture, based on the slash-separated portions of testpath. The test_data argument will be passed as first argument to test_func.

If testpath includes the component “subprocess” anywhere in it, the test will be skipped by default, and only run if explicitly required via the -p command-line option or g_test_trap_subprocess().

No component of testpath may start with a dot (.) if the G_TEST_OPTION_ISOLATE_DIRS option is being used; and it is recommended to do so even if it isn’t.

Available since: 2.16



Type: const char*

/-separated test case path name for the test.

The data is owned by the caller of the function.
The value is a NUL terminated UTF-8 string.

Type: gconstpointer

Test data argument for the test function.

The argument can be NULL.
The data is owned by the caller of the function.

Type: GTestDataFunc

The test function to invoke for this test.