Main Content

matlab.unittest.constraints Package

Summary of classes in MATLAB Constraints Interface

Description

You can use constraints to specify business rules for qualifying calculated (actual) values in tests. To test whether or not an actual value satisfies a constraint, use the constraint in conjunction with the matlab.unittest.qualifications qualification methods assertThat, assumeThat, fatalAssertThat, or verifyThat. While constraints are primarily intended for qualifications, you also can use them with the classes in the matlab.unittest.selectors package to select test elements and with the mocking framework to specify behavior and qualify interactions.

The matlab.unittest.constraints package consists of the following classes.

Classes

Constraint Implementations

Fundamental Constraint-Related Interfaces

matlab.unittest.constraints.BooleanConstraintInterface class for Boolean combinations of constraints
matlab.unittest.constraints.ConstraintFundamental interface class for comparisons

General Purpose

matlab.unittest.constraints.EventuallyPoll for value to asynchronously satisfy constraint
matlab.unittest.constraints.HasFieldTest if structure array has specified field
matlab.unittest.constraints.IsAnythingConstraint specifying any value
matlab.unittest.constraints.IsEqualToConstraint to test for equality
matlab.unittest.constraints.IsFalseTest if value is false
matlab.unittest.constraints.IsSameHandleAsTest if two handle arrays are the same
matlab.unittest.constraints.IsTrueTest if value is true
matlab.unittest.constraints.ReturnsTrueTest if function returns true

Errors and Warnings

matlab.unittest.constraints.IssuesNoWarningsConstraint specifying function that issues no warnings
matlab.unittest.constraints.IssuesWarningsConstraint specifying function that issues expected warning profile
matlab.unittest.constraints.ThrowsConstraint specifying function handle that throws MException

Inequalities

matlab.unittest.constraints.IsGreaterThanTest if value is greater than specified value
matlab.unittest.constraints.IsGreaterThanOrEqualToTest if value is greater than or equal to specified value
matlab.unittest.constraints.IsLessThanTest if value is less than specified value
matlab.unittest.constraints.IsLessThanOrEqualToTest if value is less than or equal to specified value

Array Size

matlab.unittest.constraints.HasElementCountTest if array has specified number of elements
matlab.unittest.constraints.HasLengthTest if array has specified length
matlab.unittest.constraints.HasSizeTest if array has specified size
matlab.unittest.constraints.IsEmptyTest if value is empty
matlab.unittest.constraints.IsScalarTest if value is scalar

Type

matlab.unittest.constraints.IsInstanceOfTest if value is instance of specified class
matlab.unittest.constraints.IsOfClassTest if class of value is specified class

Strings

matlab.unittest.constraints.ContainsSubstringTest if value contains specified string
matlab.unittest.constraints.EndsWithSubstringTest if value ends with specified string
matlab.unittest.constraints.IsSubstringOfTest if value is substring of specified string
matlab.unittest.constraints.MatchesTest if value matches specified regular expression
matlab.unittest.constraints.StartsWithSubstringTest if value starts with specified string

Finiteness

matlab.unittest.constraints.HasInfTest if array has infinite values
matlab.unittest.constraints.HasNaNTest if array has NaN values
matlab.unittest.constraints.IsFiniteTest if array elements are finite values

Numeric Attributes

matlab.unittest.constraints.IsRealTest if array elements are real values
matlab.unittest.constraints.IsSparseTest if array is sparse

Set

matlab.unittest.constraints.HasUniqueElementsTest if set contains unique elements
matlab.unittest.constraints.IsSameSetAsTest if set contains same elements as another set
matlab.unittest.constraints.IsSubsetOfTest if actual set is subset of expected set
matlab.unittest.constraints.IsSupersetOfTest if actual set is superset of expected set

Files and Folders

Actual Value Proxies

matlab.unittest.constraints.AnyCellOfTest if any element of cell array satisfies constraint
matlab.unittest.constraints.AnyElementOfTest if any element of array satisfies constraint
matlab.unittest.constraints.EveryCellOfTest if every element of cell array satisfies constraint
matlab.unittest.constraints.EveryElementOfTest if every element of array satisfies constraint

Tolerances

matlab.unittest.constraints.AbsoluteToleranceAbsolute numeric tolerance
matlab.unittest.constraints.AndToleranceLogical conjunction of numeric tolerances
matlab.unittest.constraints.OrToleranceLogical disjunction of numeric tolerances
matlab.unittest.constraints.RelativeToleranceRelative numeric tolerance
matlab.unittest.constraints.ToleranceInterface for tolerances

Comparators

matlab.unittest.constraints.CellComparatorComparator for cell arrays
matlab.unittest.constraints.DictionaryComparatorComparator for dictionaries
matlab.unittest.constraints.LogicalComparatorComparator for logical arrays
matlab.unittest.constraints.NumericComparatorComparator for numeric arrays
matlab.unittest.constraints.ObjectComparatorComparator for MATLAB or Java object arrays
matlab.unittest.constraints.PublicPropertyComparatorComparator for public properties of MATLAB object arrays
matlab.unittest.constraints.StringComparatorComparator for string arrays, character arrays, or cell arrays of character arrays
matlab.unittest.constraints.StructComparatorComparator for structure arrays
matlab.unittest.constraints.TableComparatorComparator for table arrays

Version History

Introduced in R2013a