valueIsNotEqualTo
Short summary
This assertion method checks if the current value is not equal to the unexpected value
Attention:
Nothing is equal to NaN, that means if currentValue OR unexpectedValue OR tolerance
is NaN then is the assertion true. For details check IEEE 754_
Attention:
infinity is equal to infinity and -infinity is equal to -infinity, that means if
currentValue AND unexpectedValue have the value infinity
OR currentValue AND unexpectedValue have the value -infinity
the assertion is false. For details check IEEE 754_
Attention:
If tolerance has the value infinity or -infinity and
currentValue is not NaN and unexpectedValue is not NaN
then is the assertion false. for details check IEEE 754
Parameters
| Name | Type | Comment | Kind |
|---|---|---|---|
| currentValue | LREAL | current value to check | input |
| unexpectedValue | LREAL | unexpected value to compare | input |
| tolerance | LREAL | tolerance to compensate twiddling floats, it has no sign | input |
| message | AssertMessage | message if the assertion is false | input |
Code
Declaration
METHOD valueIsNotEqualTo
VAR_INPUT
(* current value to check *)
currentValue :LREAL;
(* unexpected value to compare *)
unexpectedValue :LREAL;
(* tolerance to compensate twiddling floats, it has no sign *)
tolerance :LREAL;
(* message if the assertion is false *)
message :AssertMessage;
END_VAR
Implementation
IF (
THIS^.isValueNaN(currentValue)
OR_ELSE THIS^.isValueNaN(unexpectedValue)
OR_ELSE THIS^.isValueNaN(tolerance)
) THEN
RETURN;
ELSIF (THIS^.isValueInfinite(tolerance)) THEN
THIS^.assertionWasWrong(message, THIS^.getDebugInfo('valueIsNotEqualTo'));
ELSIF (
THIS^.isValueInfinite(currentValue)
OR_ELSE THIS^.isValueInfinite(unexpectedValue)
) THEN
RETURN (THIS^.isValuePositiveInfinite(currentValue) AND_THEN (NOT THIS^.isValuePositiveInfinite(unexpectedValue)));
RETURN (THIS^.isValueNegativeInfinite(currentValue) AND_THEN (NOT THIS^.isValueNegativeInfinite(unexpectedValue)));
RETURN (THIS^.isValuePositiveInfinite(unexpectedValue) AND_THEN (NOT THIS^.isValuePositiveInfinite(currentValue)));
RETURN (THIS^.isValueNegativeInfinite(unexpectedValue) AND_THEN (NOT THIS^.isValueNegativeInfinite(currentValue)));
THIS^.assertionWasWrong(message, THIS^.getDebugInfo('valueIsNotEqualTo'));
ELSIF (ABS(currentValue-unexpectedValue) <= ABS(tolerance)) THEN
THIS^.assertionWasWrong(message, THIS^.getDebugInfo('valueIsNotEqualTo'));
END_IF