matlab.unittest.constraints.PublicPropertyComparator Class
Namespace: matlab.unittest.constraints
Comparator for public properties of MATLAB object arrays
Description
The matlab.unittest.constraints.PublicPropertyComparator class provides a
comparator for the public properties of MATLAB® object arrays. To use this comparator in your tests, create a
PublicPropertyComparator instance, and specify it as the value of the
Using name-value argument of the IsEqualTo constraint constructor.
Unlike the isequal function, the isequaln function, or the ObjectComparator class, the PublicPropertyComparator class examines
only the public properties of object arrays.
Creation
Typically, you create a PublicPropertyComparator instance using the supportingAllValues static method. The resulting instance operates recursively and
supports all data types contained in the public properties. To create an instance for a
specific use case, such as when you need to test for a given data type, use one of the
syntaxes in this section.
Description
c = matlab.unittest.constraints.PublicPropertyComparator
creates a comparator for empty object arrays or object arrays with no public properties.
The comparator is satisfied if the actual and expected values are object arrays with the
same class and size that either are empty or have no public properties.
c = matlab.unittest.constraints.PublicPropertyComparator(
uses the specified comparators comp)comp to compare the values contained
in the public properties. When you use this syntax, the comparator is satisfied if the
actual and expected values are object arrays with the same class and size, and the values
in their corresponding public properties satisfy any of the comparators in
comp.
c = matlab.unittest.constraints.PublicPropertyComparator(___,
sets additional options using one or more name-value arguments in addition to any of the
input argument combinations in the previous syntaxes. For example, Name,Value)c =
matlab.unittest.constraints.PublicPropertyComparator("Recursively",true)
creates a comparator that operates recursively when comparing the values contained in the
public properties.
Input Arguments
Name-Value Arguments
Properties
Methods
Examples
Limitations
The
PublicPropertyComparatorclass does not support the public properties of objects that overload thesubsref,numel, orpropertiesfunctions.
Version History
Introduced in R2014a