oaUnitAssertEqualDelta()
The function checks if the checked value is in good range.
Synopsis
int oaUnitAssertEqualDelta(string TC_ID, float checkedValue, float goodValue, float delta, [anytype userTcData]);
Parameter
Parameters | Meaning |
---|---|
TC ID | The test ID. Each test case must contain a test ID. |
checkedValue | The value that is tested. |
goodValue | The value specifies the good range. |
delta | The delta (difference) that is considered for the good range. |
userTcData | Optional parameter. Test case specific data can be set for the test case. |
Return Value
The error code. In case of wrong or missing parameters, the function returns -1 or -2. If the condition was fulfilled meaning that the value is in the good range, the function returns 0. If the condition was not fulfilled meaning that the value is outside the good range, the function returns 1.
Error
The function returns the error code.
Description
The CTRL OA Unit CTRL extension contains a set of functions that can be used for testing purposes. The function checks if the checked value is in good range : goodValue +- delta. All values that are goodValue+- delta, are in good range. Values outside this range (range: goodValue+- Delta) are the values in bad range. The checkedValue, goodValue, and delta must be of the same variable type.
Example
The following example checks if the value returned by the function getTestValue() is in the good range 95-105.
#uses "CtrlOaUnit"
main()
{
const int _VALUE1 = 100;
/* The following example checks if the function getTestValue() returns a value in
the range from 95 to 105 (100-5 and 100+5) This is a good case since the returned
value is 98*/
oaUnitAssertEqualDelta("IS-VALUE-IN-GOOD-RANGE", getTestValue(), VALUE1 , 5);
}
int getTestValue()
{
return 100 - 2;
}
Assignment
Availability
CTRL
See also