Testing Tolerances

Component Testing for Ada

You can associate a tolerance with an expected value for numerical variables. To do this, use the keyword DELTA with the expected value EV.

This tolerance can either be an absolute value (the default option) or relative (in the form of a percentage <value>%).

Example

 TEST 5

 FAMILY nominal

 ELEMENT

 VAR a, INIT in (1,2,3), EV = INIT

 VAR b, INIT = 3, EV = INIT

 VAR c, INIT = 0, EV = 5, DELTA = 1

 #c = add(a,b);

 END ELEMENT

 END TEST

or

 TEST 6

 FAMILY nominal

 ELEMENT

 VAR a, INIT in (1,2,3), EV = INIT

 VAR b, INIT = 3, EV = INIT

 VAR c, INIT = 0, EV = 5, DELTA = 20%

 #c = add(a,b);

 END ELEMENT

 END TEST

 

Related Topics

Testing variablesTesting intervalsReporting a variable without testingTesting expressions