Testing tolerances
Component Testing for C
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>%).
You can rewrite the test from the previous example as follows:
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 variables | Testing intervals | Initializing without testing | Testing expressions | Declaring parameters | Testing arrays | Testing structured variables