%% Test if Actual and Expected Sets Are the Same
% Create a test case for interactive testing.

import matlab.unittest.TestCase;
import matlab.unittest.constraints.IsSameSetAs;

testCase = TestCase.forInteractiveUse;

% Verify that two sets are the same.

actSet = {'a' 'b' 'c'};
expSet = {'a' 'b' 'c'};

testCase.verifyThat(actSet,IsSameSetAs(expSet))

% Repeat the test with a different expected set. The test fails because the sets do not contain the same elements.

expSet = {'a' 'b' 'd'};

testCase.verifyThat(actSet,IsSameSetAs(expSet))

% Verify that two sets are the same. Although the order of the elements and the shape of the sets are different, the sets contain the same elements.

actSet = [1 2 3];
expSet = [3;2;1];

testCase.verifyThat(actSet,IsSameSetAs(expSet))

% Verify that two sets are the same. Although the expSet contains elements that are not unique and has a size that does not match actSet, the two sets have the same elements.

expSet = [1 2 3 1 2];

testCase.verifyThat(actSet,IsSameSetAs(expSet))

% Copyright 2012 The MathWorks, Inc.