testEquals
Checks that the given expected
value is equal to the given actual
value. If the values are not equal, 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 int max(int a, int b) {
return a > b ? a : b;
}
public static void main(String[] args) {
testEquals(3, max(2, 3));
testEquals(3, max(3, 2));
testEquals(3, max(3, 3));
}
Content copied to clipboard
Parameters
expected
the expected value
actual
the actual value