AdaCL.Test_Cases.Parameters

Calling AUnit test with parameters.

More...

Entities

Tagged types

Parameter

Dispatching subprograms

Expected
Input
Register_Routine

Generic instantiations

Expected_Maps (generic instantiation)
Input_Maps (generic instantiation)

Description

It's tedious to create a large amount of very similar AUnit tests who only differ in the input and expected data. This package tries to remedies this by aiding you in registering the test procedure multiple and then providing test data for each call. @formal Input_Type type holding the input data. @formal Expected_Type type holding the expected result.

Parameter [source]

46 type Parameter is tagged private;

Collection of input and expected parameter

Expected [source]

68 function Expected
69 (P : in Parameter;
70 Routine_Name : AUnit.Message_String)
71 return Expected_Type with
72 Pre => Routine_Name /= null;

get the expected value

P of type AdaCL.Test_Cases.Parameters.Parameter

the collection of input and expected parameter

Routine_Name of type AUnit.Message_String

the name of the test. Only the first word is used to locate the data.

Return value

the expected result

Input [source]

55 function Input
56 (P : in Parameter;
57 Routine_Name : AUnit.Message_String)
58 return Input_Type with
59 Pre => Routine_Name /= null;

get input data to use.

P of type AdaCL.Test_Cases.Parameters.Parameter

the collection of input and expected parameter

Routine_Name of type AUnit.Message_String

the name of the test. Only the first word is used to locate the data.

Return value

the input data

Register_Routine [source]

Register a test for given data. Call multiple times with different names to call execute the test with different data

P of type AdaCL.Test_Cases.Parameters.Parameter

the collection of input and expected parameter

T of type AUnit.Test_Cases.Test_Case

Test case to register the test with.

Routine of type AUnit.Test_Cases.Test_Routine

Routine to call.

Name of type String

Name of the test. Must be unique and one word only.

Description of type String

Additional description. Is appended to the name to create the Routine_Name

Input of type AdaCL.Test_Cases.Parameters.Input_Type

Input test data.

Expected of type AdaCL.Test_Cases.Parameters.Expected_Type

Expected test result.

Expected_Maps (generic instantiation) [source]

105package Expected_Maps is new Ada.Containers.Indefinite_Ordered_Maps (String, Expected_Type);

Map to hold the expected values

Input_Maps (generic instantiation) [source]

100package Input_Maps is new Ada.Containers.Indefinite_Ordered_Maps (String, Input_Type);

Map to hold the input values