if (shouldPass) {
if (t == null) // no exceptions encountered, passed.
return new TestResult.TestSuccess();
if (t instanceof SimplifierError) { // encountered compilation error.
SimplifierError ce = (SimplifierError)t;
return new TestResult.ExpectedPass(ce);
}
} else {
if (t == null) // expected a compilation error, but passed.
return new TestResult.ExpectedError(error);
if (t instanceof SimplifierError) {
SimplifierError ce = (SimplifierError)t;
if (ce.getErrorClass().equals(error)) // correct error encountered.
return new TestResult.TestSuccess();
else // incorrect compilation error.
return new TestResult.IncorrectError(error, ce);
}
}