testWithinRange
Checks that the given actual
value is in the range [min, max]
. The range is inclusive. If the value is not in the range, an error message is printed to S_TEST_ERR.
This method is intended to be used in the context of a test case from the student.
Example:
public static void main(String[] args) {
testWithinRange(0, 10, 5);
testWithinRange(0, 10, 0);
testWithinRange(0, 10, 10);
testWithinRange(0, 10, -1); // will print an error message
}
Content copied to clipboard
Parameters
min
the minimum value of the range
max
the maximum value of the range
actual
the actual value
Checks that the given actual
value is in the range [min, max]
. The range is inclusive. If the value is not in the range, an error message is printed to S_TEST_ERR.
This method is intended to be used in the context of a test case from the student.
Example:
public static void main(String[] args) {
testWithinRange(0, 10, 5);
testWithinRange(0, 10, 0);
testWithinRange(0, 10, 10);
testWithinRange(0, 10, -1); // will print an error message
}
Content copied to clipboard
Parameters
min
the minimum value of the range
max
the maximum value of the range
actual
the actual value