Testing Records with Discriminants

Component Testing for Ada

You can use record types with discriminants, with the following Ada restrictions:

Initialization and expected value expressions are Ada aggregates beginning with the value of the discriminant.

Example

Ada example:

type rec (discr:boolean:=TRUE)

 case discr is

 when TRUE =>

 ch2:float;

 when FALSE =>

 ch3:integer;

 end case;

end record;

 

Test Script Sample:

#r1: rec(TRUE);

#r2: rec;

TEST 1

FAMILY nominal

 ELEMENT

 var r1, init = (TRUE, 0.0), ev ==

 var r2, init = (FALSE, 1), ev = (TRUE, 1.0)

 #func (r);

 END ELEMENT

END TEST

 

Related Topics

Testing RecordsTesting a Record with Ada ExpressionsTesting a Record with Another RecordTesting Tagged RecordsNo Test