Skip to main content

LrealAssertions

Short summary

This class provides assert statements for 64 bit floatings (LREAL).

AccessAbstractFinalExtendsImplements
INTERNALNoNoAbstractAssertionILRealAssertions

UML Diagram

Parameters

none

Properties

className

Type: CNM_AbstractObject.ClassName

This abstract property returns the class name of the concrete object,

Methods

isValueInfinite

  • Parameters:
    • value (LREAL): value to check
  • Return type: BOOL

This method checks if a value is infinite

isValueNaN

  • Parameters:
    • value (LREAL): value to check
  • Return type: BOOL

This method checks if a value is not a number

isValueNegativeInfinite

  • Parameters:
    • value (LREAL): value to check
  • Return type: BOOL

This method checks if a value is negative infinite

isValuePositiveInfinite

  • Parameters:
    • value (LREAL): value to check
  • Return type: BOOL

This method checks if a value is positive infinite

isValueSpecial

  • Parameters:
    • value (LREAL): value to check
  • Return type: BOOL

This method checks if a value is a special value

valueIsANumber

  • Parameters:
    • currentValue (LREAL): current value to check
    • message (AssertMessage): message if the assertion is false
  • Return type: VOID

This assertion method checks if the current value is a number (NOT NaN)

valueIsEqualTo

  • Parameters:
    • currentValue (LREAL): current value to check
    • expectedValue (LREAL): expected value to compare
    • tolerance (LREAL): tolerance to compensate twiddling floats, it has no sign
    • message (AssertMessage): message if the assertion is false
  • Return type: VOID

This assertion method checks if the current value is equal to the expected value

valueIsFinite

  • Parameters:
    • currentValue (LREAL): current value to check
    • message (AssertMessage): message if the assertion is false
  • Return type: VOID

This assertion method checks if the current value is finite

valueIsGreaterThan

  • Parameters:
    • currentValue (LREAL): current value to check
    • lessValue (LREAL): less than lower limit
    • message (AssertMessage): message if the assertion is false
  • Return type: VOID

This assertion method checks if the current value is greater than the less value

valueIsInfinite

  • Parameters:
    • currentValue (LREAL): current value to check
    • message (AssertMessage): message if the assertion is false
  • Return type: VOID

This assertion method checks if the current value is infinite

valueIsInRangeOf

  • Parameters:
    • lowerLimit (LREAL): lower limit for the current value
    • currentValue (LREAL): current value to check
    • upperLimit (LREAL): upper limit for the current value
    • message (AssertMessage): message if the assertion is false
  • Return type: VOID

This assertion method checks if the current value is inside a limit

valueIsLessThan

  • Parameters:
    • currentValue (LREAL): current value to check
    • greaterValue (LREAL): greater than upper limit
    • message (AssertMessage): message if the assertion is false
  • Return type: VOID

This assertion method checks if the current value is greater than the less value

valueIsMax

  • Parameters:
    • currentValue (LREAL): current value to check
    • maximumValue (LREAL): upper limit for the current value
    • message (AssertMessage): message if the assertion is false
  • Return type: VOID

This assertion method checks if the current value is less than or equal to the maximum value

valueIsMin

  • Parameters:
    • currentValue (LREAL): current value to check
    • minimumValue (LREAL): lower limit for the current value
    • message (AssertMessage): message if the assertion is false
  • Return type: VOID

This assertion method checks if the current value is greater than or equal to the minimum value

valueIsNaN

  • Parameters:
    • currentValue (LREAL): current value to check
    • message (AssertMessage): message if the assertion is false
  • Return type: VOID

This assertion method checks if the current value is a not a number (NaN)

valueIsNegative

  • Parameters:
    • currentValue (LREAL): current value to check
    • message (AssertMessage): message if the assertion is false
  • Return type: VOID

This assertion method checks if the current value is negative

valueIsNegativeInfinite

  • Parameters:
    • currentValue (LREAL): current value to check
    • message (AssertMessage): message if the assertion is false
  • Return type: VOID

This assertion method checks if the current value is negative infinite

valueIsNegativeZero

  • Parameters:
    • currentValue (LREAL): current value to check
    • message (AssertMessage): message if the assertion is false
  • Return type: VOID

This assertion method checks if the current value is -0.0

valueIsNormal

  • Parameters:
    • currentValue (LREAL): current value to check
    • message (AssertMessage): message if the assertion is false
  • Return type: VOID

This assertion method checks if the current value is a normal number

valueIsNotEqualTo

  • Parameters:
    • currentValue (LREAL): current value to check
    • unexpectedValue (LREAL): unexpected value to compare
    • tolerance (LREAL): tolerance to compensate twiddling floats, it has no sign
    • message (AssertMessage): message if the assertion is false
  • Return type: VOID

This assertion method checks if the current value is not equal to the unexpected value

valueIsNotNegativeInfinite

  • Parameters:
    • currentValue (LREAL): current value to check
    • message (AssertMessage): message if the assertion is false
  • Return type: VOID

This assertion method checks if the current value is not negative infinite

valueIsNotPositiveInfinite

  • Parameters:
    • currentValue (LREAL): current value to check
    • message (AssertMessage): message if the assertion is false
  • Return type: VOID

This assertion method checks if the current value is not positive infinite

valueIsNotSpecial

  • Parameters:
    • currentValue (LREAL): current value to check
    • message (AssertMessage): message if the assertion is false
  • Return type: VOID

This assertion method checks if the current value is a non special number

valueIsPositive

  • Parameters:
    • currentValue (LREAL): current value to check
    • message (AssertMessage): message if the assertion is false
  • Return type: VOID

This assertion method checks if the current value is positve

valueIsPositiveInfinite

  • Parameters:
    • currentValue (LREAL): current value to check
    • message (AssertMessage): message if the assertion is false
  • Return type: VOID

This assertion method checks if the current value is positive infinite

valueIsPositiveZero

  • Parameters:
    • currentValue (LREAL): current value to check
    • message (AssertMessage): message if the assertion is false
  • Return type: VOID

This assertion method checks if the current value is +0.0

valueIsSpecial

  • Parameters:
    • currentValue (LREAL): current value to check
    • message (AssertMessage): message if the assertion is false
  • Return type: VOID

This assertion method checks if the current value is a special

valueIsSubnormal

  • Parameters:
    • currentValue (LREAL): current value to check
    • message (AssertMessage): message if the assertion is false
  • Return type: VOID

This assertion method checks if the current value is a subnormal number

Code

Declaration

{attribute 'reflection'}
FUNCTION_BLOCK INTERNAL LrealAssertions EXTENDS AbstractAssertion IMPLEMENTS ILRealAssertions
VAR
END_VAR
VAR CONSTANT
(* mask for determining value as a special value *)
MASK_FOR_EXPONENT :LWORD := 16#7FF0_0000_0000_0000;
(* mask for determining a special value as NaN or infinite *)
MASK_FOR_FRACTION :LWORD := 16#000F_FFFF_FFFF_FFFF;
(* mask to get the sign bit of an infinite or zero value *)
MASK_FOR_SIGN_BIT :LWORD := 16#8000_0000_0000_0000;
(* just to compare results or the memory of a float value *)
ZERO :DWORD := 16#0000_0000_0000_0000;
END_VAR