Testing a Record with Ada Expressions

Component Testing for Ada

To initialize and test a structured variable or record, you must initialize or test all the fields using a list of native language expressions (one per field). The following example illustrates this form:

STR l.all, init == , ev = ("myfoo",NIL,NIL)

Each element in the list must correspond to the structured variable field as it was declared.

Every expression in the list must obey the rules described so far, according to the type of field being initialized and tested:

Using Field Names in Native Expressions

As with arrays, you can specify field names in native expressions by following the field name of the structure with the characters =>, as follows:


 FAMILY nominal


 VAR l, init = NIL, ev = NONIL

 VAR l.all, init == , ev = (str=>"myfoo",next=>NIL,prev=>NIL)

 VAR s, init = "myfoo", ev = init

 #l = push(l,s);



When using this form, you do not have to respect the order of expressions in the list.

Related Topics

Testing RecordsTesting a Record with Another RecordTesting Records with DiscriminantsTesting Tagged RecordsNo Test