Main Content


Class: matlab.unittest.constraints.Tolerance
Package: matlab.unittest.constraints

Produce diagnostic for two values specified to be within tolerance


diag = getDiagnosticFor(tolObj,actVal,expVal)


diag = getDiagnosticFor(tolObj,actVal,expVal) produces a diagnostic, diag, for a value, actVal, evaluated against another value, expVal, within the tolerance defined by tolObj. When creating a custom tolerance, the class author must implement the getDiagnosticFor method so that it analyzes the two values, actVal and expVal, against the tolerance, tolObj, and instantiates and returns a matlab.unittest.diagnostics.Diagnostic object.

Typically, this diagnostic is used when the getDiagnosticFor method of IsEqualTo is invoked, and the result is incorporated into the diagnostic output of the IsEqualTo constraint.

Input Arguments


Value to determine if is within tolerance of expVal


Tolerance instance


Expected value