AssertRelEqual

The AssertRelEqual method uses the IsRelEqual method to check whether two floating-point values (the result of the preparation step and the expected value) fall within a defined relative or absolute tolerance. If this is not the case, the test case fails and passes the specified error message.
Syntax
METHOD PUBLIC AssertRelEqual
VAR_INPUT
fActual : LREAL;
fExpected : LREAL;
fPrecision : LREAL;
smessage : STRING(255) := ''; // optional assert message
END_VAR
Inputs
Name | Type | Description |
|---|---|---|
fActual | LREAL | Value determined by executing the test case. |
fExpected | LREAL | Expected value for the test case |
fPrecision | LREAL | Relative tolerance for comparison |
sMessage | STRING(255) | Error message if the test fails. |
Sample
AssertRelEqual(fActual:= <actualValue>, fExpected:= <expectedValue>, fPrecision:=<precisionValue>, sMessage:= 'Error message to be displayed in the client!')