Initializes the GLib testing framework.
This includes seeding the test random number generator, setting the program name, and parsing test-related commandline args.
This should be called before calling any other `g_test_*()` functions.
The following arguments are understood:
`perf`: Performance tests, may take long and report results (off by default).
`slow`, `thorough`: Slow and thorough tests, may take quite long and maximize coverage (off by default).
`quick`: Quick tests, should run really quickly and give good coverage (the default).
`undefined`: Tests for undefined behaviour, may provoke programming errors under [func@GLib.test_trap_subprocess] or [ func@GLib.test_expect_message] to check that appropriate assertions or warnings are given (the default).
`no-undefined`: Avoid tests for undefined behaviour.
Any parsed arguments are removed from argv, and argc is adjust accordingly.
The following options are supported:
Since 2.58, if tests are compiled with `G_DISABLE_ASSERT` defined, `g_test_init()` will print an error and exit. This is to prevent no-op tests from being executed, as [func@GLib.assert] is commonly (erroneously) used in unit tests, and is a no-op when compiled with `G_DISABLE_ASSERT`. Ensure your tests are compiled without `G_DISABLE_ASSERT` defined.
Example: Test, initialization:
public static int main (string[] args) {
// Use ./test --help to review our options
Test.init (ref args);
// Register test cases via Test.add_func & friends
Test.run ();
return 0;
}
valac --pkg glib-2.0 GLib.Test.init.vala
| ... |
`NULL`-terminated list of special options |
| argc |
address of the |
| argv |
address of the |