AssertAbsEqual

AssertAbsEqual 1:

Similar to the AssertEqual method, this method is also used to verify whether the expected value of a test preparation step matches the actual result.

Similarly, a message is displayed here as well in the event of an error. However, the AssertAbsEqual method checks whether the expected value and the result are close enough to each other in terms of magnitude (absolute value). The absolute value must fall within the tolerance range, which you can also specify.

Syntax

METHOD PUBLIC AssertAbsEqual
VAR_INPUT
    fActual       : LREAL;
    fExpected     : LREAL;
    fTolerance    : LREAL;
    sMessage      : STRING(255) := ''; // optional assert message
END_VAR

AssertAbsEqual 2: Inputs

Name

Type

Description

fActual

LREAL

Value determined by the test performed

fExpected

LREAL

Expected value for the test case.

fTolerance

LREAL

Permissible tolerance for this test case between the expected value and the determined value.

sMessage

STRING(255)

Error message if the test fails.

Sample


AssertAbsEqual(fActual:=<actual Value>, fExpected:=<expectedValue>, fTolerance:=<tolerance>, sMessage:= ' Error message to be displayed in the client!');