AUnit.Assertions

More...

Entities

Constants and variables

Null_Id

Simple types

Test_Id

Access types

Test_Access
Throwing_Exception_Proc

Record types

Failure_Elt
Failure_Iter

Tagged types

Test

Subprograms

Assert
Assert
Assert
Assert_Exception
Copy_Id
Current_Test
Get_Failure
Has_Failure
Next
Set_Current_Test

Dispatching subprograms

Clear_Failures
First_Failure
Has_Failures
Init_Test

Generic instantiations

Failure_Lists (generic instantiation)

Description

Null_Id [source]

138Null_Id : constant Test_Id := 0;

Test_Id [source]

137 type Test_Id is new Natural;

Test_Access [source]

99 type Test_Access is access all Test'Class;

Throwing_Exception_Proc [source]

46 procedure;

Failure_Elt [source]

140 type Failure_Elt is record
141 Failure : Test_Failure;
142 Id : Test_Id := Null_Id;
143 end record;
Failure of type AUnit.Test_Results.Test_Failure
Id of type AUnit.Assertions.Test_Id

Failure_Iter [source]

110 type Failure_Iter is private;

Iterator used to retrieve failures.

Test [source]

96 type Test is abstract new AUnit.Tests.Test with private;

Test is used as root type for all Test cases, but also for Test fixtures This allows easy access to all Assert procedures from user tests.

Inherits Test

Inherited by Test_Case, Test_Fixture

Assert [source]

48 procedure Assert
49 (Condition : Boolean;
50 Message : String;
51 Source : String := GNAT.Source_Info.File;
52 Line : Natural := GNAT.Source_Info.Line);

Test "Condition" and record "Message" if false. If the condition is false, an exception is then raised and the running test is aborted.

Condition of type Boolean
Message of type String
Source of type String
Line of type Natural

Assert [source]

57 function Assert
58 (Condition : Boolean;
59 Message : String;
60 Source : String := GNAT.Source_Info.File;
61 Line : Natural := GNAT.Source_Info.Line) return Boolean;

Functional version to allow the calling routine to decide whether to continue or abandon the execution.

Condition of type Boolean
Message of type String
Source of type String
Line of type Natural
Return value

Assert [source]

72 procedure Assert
73 (Actual : String;
74 Expected : String;
75 Message : String;
76 Source : String := GNAT.Source_Info.File;
77 Line : Natural := GNAT.Source_Info.Line);

Specialized versions of Assert, they call the general version that takes a Condition as a parameter

Actual of type String
Expected of type String
Message of type String
Source of type String
Line of type Natural

Assert_Exception [source]

81 procedure Assert_Exception
82 (Proc : Throwing_Exception_Proc;
83 Message : String;
84 Source : String := GNAT.Source_Info.File;
85 Line : Natural := GNAT.Source_Info.Line);

Test that Proc throws an exception and record "Message" if not.

Proc of type AUnit.Assertions.Throwing_Exception_Proc
Message of type String
Source of type String
Line of type Natural

Copy_Id [source]

125 procedure Copy_Id (From : Test'Class; To : in out Test'Class);

Copy From's Id to To so that failures reported via To are identified as belonging to From.

From of type AUnit.Assertions.Test
To of type AUnit.Assertions.Test

Current_Test [source]

122 function Current_Test return Test_Access;

The following is used for the non-dispatching Assert methods. This uses global variables, and thus is incompatible with multitasking.

Return value

Get_Failure [source]

115 function Get_Failure
116 (I : Failure_Iter) return AUnit.Test_Results.Test_Failure;
I of type AUnit.Assertions.Failure_Iter
Return value

Has_Failure [source]

114 function Has_Failure (I : Failure_Iter) return Boolean;
I of type AUnit.Assertions.Failure_Iter
Return value

Next [source]

117 procedure Next (I : in out Failure_Iter);

Failures list handling

I of type AUnit.Assertions.Failure_Iter

Set_Current_Test [source]

123 procedure Set_Current_Test (T : Test_Access);
T of type AUnit.Assertions.Test_Access

Clear_Failures [source]

104 procedure Clear_Failures (T : Test);

Clear all failures related to T

T of type AUnit.Assertions.Test

First_Failure [source]

113 function First_Failure (T : Test) return Failure_Iter;
T of type AUnit.Assertions.Test
Return value

Has_Failures [source]

107 function Has_Failures (T : Test) return Boolean;

The number of failures reported by test

T of type AUnit.Assertions.Test
Return value

Init_Test [source]

101 procedure Init_Test (T : in out Test);

Init a new test

T of type AUnit.Assertions.Test

Failure_Lists (generic instantiation) [source]

145package Failure_Lists is
146 new Ada_Containers.AUnit_Lists (Failure_Elt);

Container for failed assertion messages per routine

Instantiation of Ada_Containers.AUnit_Lists