AssertAbsEqual

AssertAbsEqual 1:

The AssertAbsEqual method can be used to check whether the result of a test case falls within a tolerance in terms of magnitude (absolute value). A message is displayed in the event of an error.

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!');