Testing Records with Discriminants
Component Testing for Ada
You can use record types with discriminants, with the following Ada restrictions:
-
The initialization part must be complete.
-
The evaluation can omit every field except discriminant fields.
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 Records | Testing a Record with Ada Expressions | Testing a Record with Another Record | Testing Tagged Records | No Test