procedure Add_Data_Func
(Testpath : UTF8_String;
Test_Data : System.Address;
Test_Func : Test_Data_Function)
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. Since: gtk+ 2.16
/-separated test case path name for the test.
Test data argument for the test function.
The test function to invoke for this test.
procedure Add_Func (Testpath : UTF8_String; Test_Func : Test_Function)
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. 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. Since: gtk+ 2.16
/-separated test case path name for the test.
The test function to invoke for this test.
procedure Assert
(Condition : Boolean;
Expr : UTF8_String := "";
File : UTF8_String := GNAT.Source_Info.File;
Line : Natural := GNAT.Source_Info.Line;
Func : UTF8_String := GNAT.Source_Info.Enclosing_Entity)
g_assert: fail unless Condition is True.
procedure Assert_Cmpfloat_Eq
(N1, N2 : Glib.Gdouble;
File : UTF8_String := GNAT.Source_Info.File;
Line : Natural := GNAT.Source_Info.Line;
Func : UTF8_String := GNAT.Source_Info.Enclosing_Entity)
procedure Assert_Cmpfloat_Ge
(N1, N2 : Glib.Gdouble;
File : UTF8_String := GNAT.Source_Info.File;
Line : Natural := GNAT.Source_Info.Line;
Func : UTF8_String := GNAT.Source_Info.Enclosing_Entity)
procedure Assert_Cmpfloat_Gt
(N1, N2 : Glib.Gdouble;
File : UTF8_String := GNAT.Source_Info.File;
Line : Natural := GNAT.Source_Info.Line;
Func : UTF8_String := GNAT.Source_Info.Enclosing_Entity)
procedure Assert_Cmpfloat_Le
(N1, N2 : Glib.Gdouble;
File : UTF8_String := GNAT.Source_Info.File;
Line : Natural := GNAT.Source_Info.Line;
Func : UTF8_String := GNAT.Source_Info.Enclosing_Entity)
procedure Assert_Cmpfloat_Lt
(N1, N2 : Glib.Gdouble;
File : UTF8_String := GNAT.Source_Info.File;
Line : Natural := GNAT.Source_Info.Line;
Func : UTF8_String := GNAT.Source_Info.Enclosing_Entity)
procedure Assert_Cmpfloat_Ne
(N1, N2 : Glib.Gdouble;
File : UTF8_String := GNAT.Source_Info.File;
Line : Natural := GNAT.Source_Info.Line;
Func : UTF8_String := GNAT.Source_Info.Enclosing_Entity)
procedure Assert_Cmpfloat_With_Epsilon
(N1, N2, Epsilon : Glib.Gdouble;
File : UTF8_String := GNAT.Source_Info.File;
Line : Natural := GNAT.Source_Info.Line;
Func : UTF8_String := GNAT.Source_Info.Enclosing_Entity)
g_assert_cmpfloat_with_epsilon: fail unless abs (N1 - N2) < Epsilon.
procedure Assert_Cmphex_Eq
(N1, N2 : Glib.Guint;
File : UTF8_String := GNAT.Source_Info.File;
Line : Natural := GNAT.Source_Info.Line;
Func : UTF8_String := GNAT.Source_Info.Enclosing_Entity)
procedure Assert_Cmphex_Ge
(N1, N2 : Glib.Guint;
File : UTF8_String := GNAT.Source_Info.File;
Line : Natural := GNAT.Source_Info.Line;
Func : UTF8_String := GNAT.Source_Info.Enclosing_Entity)
procedure Assert_Cmphex_Gt
(N1, N2 : Glib.Guint;
File : UTF8_String := GNAT.Source_Info.File;
Line : Natural := GNAT.Source_Info.Line;
Func : UTF8_String := GNAT.Source_Info.Enclosing_Entity)
procedure Assert_Cmphex_Le
(N1, N2 : Glib.Guint;
File : UTF8_String := GNAT.Source_Info.File;
Line : Natural := GNAT.Source_Info.Line;
Func : UTF8_String := GNAT.Source_Info.Enclosing_Entity)
procedure Assert_Cmphex_Lt
(N1, N2 : Glib.Guint;
File : UTF8_String := GNAT.Source_Info.File;
Line : Natural := GNAT.Source_Info.Line;
Func : UTF8_String := GNAT.Source_Info.Enclosing_Entity)
procedure Assert_Cmphex_Ne
(N1, N2 : Glib.Guint;
File : UTF8_String := GNAT.Source_Info.File;
Line : Natural := GNAT.Source_Info.Line;
Func : UTF8_String := GNAT.Source_Info.Enclosing_Entity)
procedure Assert_Cmpint_Eq
(N1, N2 : Glib.Gint;
File : UTF8_String := GNAT.Source_Info.File;
Line : Natural := GNAT.Source_Info.Line;
Func : UTF8_String := GNAT.Source_Info.Enclosing_Entity)
procedure Assert_Cmpint_Ge
(N1, N2 : Glib.Gint;
File : UTF8_String := GNAT.Source_Info.File;
Line : Natural := GNAT.Source_Info.Line;
Func : UTF8_String := GNAT.Source_Info.Enclosing_Entity)
procedure Assert_Cmpint_Gt
(N1, N2 : Glib.Gint;
File : UTF8_String := GNAT.Source_Info.File;
Line : Natural := GNAT.Source_Info.Line;
Func : UTF8_String := GNAT.Source_Info.Enclosing_Entity)
procedure Assert_Cmpint_Le
(N1, N2 : Glib.Gint;
File : UTF8_String := GNAT.Source_Info.File;
Line : Natural := GNAT.Source_Info.Line;
Func : UTF8_String := GNAT.Source_Info.Enclosing_Entity)
procedure Assert_Cmpint_Lt
(N1, N2 : Glib.Gint;
File : UTF8_String := GNAT.Source_Info.File;
Line : Natural := GNAT.Source_Info.Line;
Func : UTF8_String := GNAT.Source_Info.Enclosing_Entity)
procedure Assert_Cmpint_Ne
(N1, N2 : Glib.Gint;
File : UTF8_String := GNAT.Source_Info.File;
Line : Natural := GNAT.Source_Info.Line;
Func : UTF8_String := GNAT.Source_Info.Enclosing_Entity)
procedure Assert_Cmpstr_Eq
(S1, S2 : UTF8_String;
File : UTF8_String := GNAT.Source_Info.File;
Line : Natural := GNAT.Source_Info.Line;
Func : UTF8_String := GNAT.Source_Info.Enclosing_Entity)
procedure Assert_Cmpstr_Ge
(S1, S2 : UTF8_String;
File : UTF8_String := GNAT.Source_Info.File;
Line : Natural := GNAT.Source_Info.Line;
Func : UTF8_String := GNAT.Source_Info.Enclosing_Entity)
procedure Assert_Cmpstr_Gt
(S1, S2 : UTF8_String;
File : UTF8_String := GNAT.Source_Info.File;
Line : Natural := GNAT.Source_Info.Line;
Func : UTF8_String := GNAT.Source_Info.Enclosing_Entity)
procedure Assert_Cmpstr_Le
(S1, S2 : UTF8_String;
File : UTF8_String := GNAT.Source_Info.File;
Line : Natural := GNAT.Source_Info.Line;
Func : UTF8_String := GNAT.Source_Info.Enclosing_Entity)
procedure Assert_Cmpstr_Lt
(S1, S2 : UTF8_String;
File : UTF8_String := GNAT.Source_Info.File;
Line : Natural := GNAT.Source_Info.Line;
Func : UTF8_String := GNAT.Source_Info.Enclosing_Entity)
procedure Assert_Cmpstr_Ne
(S1, S2 : UTF8_String;
File : UTF8_String := GNAT.Source_Info.File;
Line : Natural := GNAT.Source_Info.Line;
Func : UTF8_String := GNAT.Source_Info.Enclosing_Entity)
procedure Assert_Cmpuint_Eq
(N1, N2 : Glib.Guint;
File : UTF8_String := GNAT.Source_Info.File;
Line : Natural := GNAT.Source_Info.Line;
Func : UTF8_String := GNAT.Source_Info.Enclosing_Entity)
procedure Assert_Cmpuint_Ge
(N1, N2 : Glib.Guint;
File : UTF8_String := GNAT.Source_Info.File;
Line : Natural := GNAT.Source_Info.Line;
Func : UTF8_String := GNAT.Source_Info.Enclosing_Entity)
procedure Assert_Cmpuint_Gt
(N1, N2 : Glib.Guint;
File : UTF8_String := GNAT.Source_Info.File;
Line : Natural := GNAT.Source_Info.Line;
Func : UTF8_String := GNAT.Source_Info.Enclosing_Entity)
procedure Assert_Cmpuint_Le
(N1, N2 : Glib.Guint;
File : UTF8_String := GNAT.Source_Info.File;
Line : Natural := GNAT.Source_Info.Line;
Func : UTF8_String := GNAT.Source_Info.Enclosing_Entity)
procedure Assert_Cmpuint_Lt
(N1, N2 : Glib.Guint;
File : UTF8_String := GNAT.Source_Info.File;
Line : Natural := GNAT.Source_Info.Line;
Func : UTF8_String := GNAT.Source_Info.Enclosing_Entity)
procedure Assert_Cmpuint_Ne
(N1, N2 : Glib.Guint;
File : UTF8_String := GNAT.Source_Info.File;
Line : Natural := GNAT.Source_Info.Line;
Func : UTF8_String := GNAT.Source_Info.Enclosing_Entity)
procedure Assert_Error
(Error : Glib.Error.GError;
Domain : Glib.GQuark;
Code : Glib.Gint;
Expr : UTF8_String := "Assert_Error";
File : UTF8_String := GNAT.Source_Info.File;
Line : Natural := GNAT.Source_Info.Line;
Func : UTF8_String := GNAT.Source_Info.Enclosing_Entity)
g_assert_error: fail unless Error is non-null and matches Domain/Code.
procedure Assert_False
(Condition : Boolean;
Expr : UTF8_String := "should be FALSE";
File : UTF8_String := GNAT.Source_Info.File;
Line : Natural := GNAT.Source_Info.Line;
Func : UTF8_String := GNAT.Source_Info.Enclosing_Entity)
g_assert_false: fail unless Condition is False.
procedure Assert_No_Error
(Error : Glib.Error.GError;
Expr : UTF8_String := "Assert_No_Error";
File : UTF8_String := GNAT.Source_Info.File;
Line : Natural := GNAT.Source_Info.Line;
Func : UTF8_String := GNAT.Source_Info.Enclosing_Entity)
g_assert_no_error: fail unless Error is null.
procedure Assert_Nonnull
(Object : System.Address;
Expr : UTF8_String := "should not be NULL";
File : UTF8_String := GNAT.Source_Info.File;
Line : Natural := GNAT.Source_Info.Line;
Func : UTF8_String := GNAT.Source_Info.Enclosing_Entity)
g_assert_nonnull: fail if Object is the null address.
procedure Assert_Not_Reached
(File : UTF8_String := GNAT.Source_Info.File;
Line : Natural := GNAT.Source_Info.Line;
Func : UTF8_String := GNAT.Source_Info.Enclosing_Entity)
g_assert_not_reached: fail unconditionally; flags code that should never be executed.
procedure Assert_Null
(Object : System.Address;
Expr : UTF8_String := "should be NULL";
File : UTF8_String := GNAT.Source_Info.File;
Line : Natural := GNAT.Source_Info.Line;
Func : UTF8_String := GNAT.Source_Info.Enclosing_Entity)
g_assert_null: fail unless Object is the null address.
procedure Assert_True
(Condition : Boolean;
Expr : UTF8_String := "should be TRUE";
File : UTF8_String := GNAT.Source_Info.File;
Line : Natural := GNAT.Source_Info.Line;
Func : UTF8_String := GNAT.Source_Info.Enclosing_Entity)
g_assert_true: fail unless Condition is True.
procedure Fail
Indicates that a test failed. This function can be called multiple times from the same test. You can use this function if your test failed in a recoverable way. Do not use this function if the failure of a test could cause other tests to malfunction. Calling this function will not stop the test from running, you need to return from the test function yourself. So you can produce additional diagnostic messages or even continue running the test. If not called from inside a test, this function does nothing. Note that unlike Glib.Test.Skip and g_test_incomplete, this function does not log a message alongside the test failure. If details of the test failure are available, either log them with g_test_message before Glib.Test.Fail, or use g_test_fail_printf instead. Since: gtk+ 2.30
function Failed return Boolean
Returns whether a test has already failed. This will be the case when Glib.Test.Fail, g_test_incomplete or Glib.Test.Skip have been called, but also if an assertion has failed. This can be useful to return early from a test if continuing after a failed assertion might be harmful. The return value of this function is only meaningful if it is called from inside a test function. Since: gtk+ 2.38
True if the test has failed
procedure Init
Initialize the GLib testing framework, parsing the test-related command-line arguments visible through Ada.Command_Line (e.g. -p, --seed=N, --verbose). Must be called before any other subprogram in this package.
procedure Message (Msg : UTF8_String)
Add Msg to the test report.
function Run return Ada.Command_Line.Exit_Status
Runs all tests under the toplevel suite which can be retrieved with g_test_get_root. Similar to g_test_run_suite, the test cases to be run are filtered according to test path arguments (-p testpath and -s testpath) as parsed by g_test_init. g_test_run_suite or Glib.Test.Run may only be called once in a program. In general, the tests and sub-suites within each suite are run in the order in which they are defined. However, note that prior to GLib 2.36, there was a bug in the g_test_add_* functions which caused them to create multiple suites with the same name, meaning that if you created tests "/foo/simple", "/bar/simple", and "/foo/using-bar" in that order, they would get run in that order (since Glib.Test.Run would run the first "/foo" suite, then the "/bar" suite, then the second "/foo" suite). As of 2.36, this bug is fixed, and adding the tests in that order would result in a running order of "/foo/simple", "/foo/using-bar", "/bar/simple". If this new ordering is sub-optimal (because it puts more-complicated tests before simpler ones, making it harder to figure out exactly what has failed), you can fix it by changing the test paths to group tests by suite in a way that will result in the desired running order. Eg, "/simple/foo", "/simple/bar", "/complex/foo-using-bar". However, you should never make the actual result of a test depend on the order that tests are run in. If you need to ensure that some particular code runs before or after a given test case, use g_test_add, which lets you specify setup and teardown functions. If all tests are skipped or marked as incomplete (expected failures), this function will return 0 if producing TAP output, or 77 (treated as "skip test" by Automake) otherwise. Since: gtk+ 2.16
0 on success, 1 on failure (assuming it returns at all), 0 or 77 if all tests were skipped with Glib.Test.Skip and/or g_test_incomplete
procedure Skip (Msg : UTF8_String := "")
Indicates that a test was skipped. Calling this function will not stop the test from running, you need to return from the test function yourself. So you can produce additional diagnostic messages or even continue running the test. If not called from inside a test, this function does nothing. Since: gtk+ 2.38
explanation
type Test_Data_Function is access procedure (User_Data : System.Address);
A test function that receives the user-data pointer passed to Add_Data_Func.
type Test_Function is access procedure;
A test function with no fixture, registered via Add_Func.