Skip to main content

valueIsInRangeOf

Short summary

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

Attention: limits are included: valueIsInRangeOf(3, 3, 3) is a true assertion

Parameters

NameTypeCommentKind
lowerLimitBYTElower limit for the current valueinput
currentValueBYTEcurrent value to checkinput
upperLimitBYTEupper limit for the current valueinput
messageAssertMessagemessage if the assertion is falseinput

Code

Declaration

METHOD valueIsInRangeOf
VAR_INPUT
(* lower limit for the current value *)
lowerLimit :BYTE;
(* current value to check *)
currentValue :BYTE;
(* upper limit for the current value *)
upperLimit :BYTE;
(* message if the assertion is false *)
message :AssertMessage;
END_VAR

Implementation

IF (
(currentValue < lowerLimit)
OR (currentValue > upperLimit)
) THEN
THIS^.assertionWasWrong(message, THIS^.getDebugInfo('valueIsInRangeOf'));
END_IF