Package: matlab.unittest.constraints
Superclasses: matlab.unittest.constraints.BooleanConstraint
General constraint to compare for equality
The IsEqualTo
class creates a constraint that compares data for equality. The type of comparison it uses is governed by the data type of the expected value. First, the testing framework checks if the expected value is an object. This check is performed first because it is possible for the object to have overridden methods that are used in subsequent checks (e.g. islogical
). The following list categorizes and describes the various tests.
Data Type | Equality Comparison Method |
---|---|
MATLAB® & Java® Objects | If the expected value is a MATLAB or Java object, the If the constraint can determine that the actual and expected values are equal because they are of the same class and size and all properties are equal, then |
Logicals | If the expected value is a |
Numerics | If the expected value is |
Strings | If the expected value is a |
Structures | If the expected value is a |
Cell Arrays | If the expected value is a cell array, the constraint checks the actual and expected values for size equality. If they are not equal in size, the constraint is not satisfied. Otherwise, each element of the array is recursively compared in a manner identical to fields in a structure, described above. |
Tables | If the expected value is a |
IsEqualTo(
provides a general constraint to compare for equality.expVal
)
IsEqualTo(
provides a constraint with additional options specified by one or more expVal
,Name,Value
)Name,Value
pair arguments. Name
must appear inside single quotes (''
). You can specify several name-value pair arguments in any order as Name1,Value1,...,NameN,ValueN
.
|
The expected value that is compared to the actual value. |
Specify optional
comma-separated pairs of Name,Value
arguments. Name
is
the argument name and Value
is the corresponding value.
Name
must appear inside quotes. You can specify several name and value
pair arguments in any order as
Name1,Value1,...,NameN,ValueN
.
|
Indicator if the constraint is insensitive to case, specified as Default: |
|
Fields to ignore during struct comparison, specified as a cell array of character vectors or a string array. Default: (empty) |
|
Indicator if the constraint is insensitive to whitespace, specified as Default: |
|
Particular comparator to use for constraint construction, specified as a Default: (empty) |
|
Tolerance to use in constraint construction, specified as a Default: (empty) |
|
Specific comparator used in construction of the constraint, specified as a |
|
The expected value that is compared to the actual value specified in the |
|
Indicator if the constraint is insensitive to case, specified in the name-value pair argument, |
|
Fields to ignore during struct comparison, specified in the name-value
pair argument, |
|
Indicator if the constraint is insensitive to whitespace, specified in the name-value pair argument, |
|
Specific tolerance used in construction of the constraint, specified as a |
Value. To learn how value classes affect copy operations, see Copying Objects.