matlab.unittest.constraints.IsSameSetAs Class
Namespace: matlab.unittest.constraints
Superclasses: matlab.unittest.constraints.BooleanConstraint
Test if set has same elements as another set
Description
The matlab.unittest.constraints.IsSameSetAs
class provides a constraint to
test if a set is the same as another set. The sets can have the same elements in different
orders, different numbers, or different shapes.
The constraint uses the ismember
function to compare sets. So, the
actual and expected values you use with the constraint must be supported by the
ismember
function.
Creation
Description
c = matlab.unittest.constraints.IsSameSetAs(
creates a constraint to test if a set has the same elements as the
expected
)expected
set. For an actual set actual
, the
constraint is satisfied if ismember(actual,expected)
and
ismember(expected,actual)
both return arrays that contain all
true
values and at least one of these conditions is met:
actual
andexpected
are of the same class.isobject(actual)
returnstrue
.isobject(expected)
returnstrue
.