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 returns the specified error message.
Syntax
METHOD PROTECTED AssertRelEqual
VAR_INPUT
actual : LREAL;
expected : LREAL;
precision : LREAL;
message : STRING(255) := ''; // optional assert message
END_VAR
Inputs
Name | Type | Description |
|---|---|---|
actual | LREAL | Value determined by executing the test case. |
expected | LREAL | Expected value for the test case |
precision | LREAL | Relative tolerance for comparison |
message | STRING(255) | Error message if the test fails. |
Example
AssertRelEqual(actual:= result, expected:= expectedValue, precision, message:= ‘Error message to be displayed in the client!')