Documentation Center

  • Trial Software
  • Product Updates

matlab.unittest.constraints

Summary of classes in MATLAB Constraints Interface

Description

Constraints specify business rules against which to qualify a calculated value. Use constraints in conjunction with the matlab.unittest.qualifications qualification methods assertThat, assumeThat, fatalAssertThat, or verifyThat. Constraints determine whether or not a calculated (actual) value satisfies the constraint. Constraints also provide diagnostics. The matlab.unittest.constraints package consists of the following 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.HasFieldConstraint specifying structure containing particular field
matlab.unittest.constraints.IsAnythingConstraint specifying any value
matlab.unittest.constraints.IsEqualToGeneral constraint to compare for equality
matlab.unittest.constraints.IsFalseConstraint specifying false value
matlab.unittest.constraints.IsSameHandleAsConstraint specifying handle instance same as another
matlab.unittest.constraints.IsTrueConstraint specifying true value
matlab.unittest.constraints.ReturnsTrueConstraint specifying function handle that 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.IsGreaterThanConstraint specifying value greater than another value
matlab.unittest.constraints.IsGreaterThanOrEqualToConstraint specifying value greater than or equal to another value
matlab.unittest.constraints.IsLessThanConstraint specifying value less than another value
matlab.unittest.constraints.IsLessThanOrEqualToConstraint specifying value less than or equal to another value

Array Size

matlab.unittest.constraints.HasElementCountConstraint specifying expected number of elements
matlab.unittest.constraints.HasLengthConstraint specifying expected length of array
matlab.unittest.constraints.HasSizeConstraint specifying expected size of array
matlab.unittest.constraints.IsEmptyConstraint specifying empty value

Type

matlab.unittest.constraints.IsInstanceOfConstraint specifying inclusion in given class hierarchy
matlab.unittest.constraints.IsOfClassConstraint specifying class type

Strings

matlab.unittest.constraints.ContainsSubstringConstraint specifying string containing substring
matlab.unittest.constraints.EndsWithSubstringConstraint specifying string ending with substring
matlab.unittest.constraints.IsSubstringOfConstraint specifying substring of another string
matlab.unittest.constraints.MatchesConstraint specifying string matches regular expression
matlab.unittest.constraints.StartsWithSubstringConstraint specifying string starting with substring

Finiteness

matlab.unittest.constraints.HasInfConstraint specifying array containing any infinite value
matlab.unittest.constraints.HasNaNConstraint specifying array containing NaN value
matlab.unittest.constraints.IsFiniteConstraint specifying finite value

Numeric Attributes

matlab.unittest.constraints.IsRealConstraint specifying real valued array
matlab.unittest.constraints.IsSparseConstraint specifying sparse array

Actual Value Proxies

matlab.unittest.constraints.AnyCellOfTest if any element of cell array meets constraint
matlab.unittest.constraints.AnyElementOfTest if any element of array meets constraint
matlab.unittest.constraints.EveryCellOfTest if all elements of cell array meet constraint
matlab.unittest.constraints.EveryElementOfTest if all elements of array meet constraint

Tolerances

matlab.unittest.constraints.AbsoluteToleranceAbsolute numeric tolerance
matlab.unittest.constraints.RelativeToleranceRelative numeric tolerance
matlab.unittest.constraints.ToleranceAbstract interface class for tolerances

Comparators

matlab.unittest.constraints.CellComparatorComparator for cell arrays
matlab.unittest.constraints.LogicalComparatorComparator for two logical values
matlab.unittest.constraints.NumericComparatorComparator for numeric data types
matlab.unittest.constraints.ObjectComparatorComparator for MATLAB or Java objects
matlab.unittest.constraints.PublicPropertyComparatorComparator for public properties of MATLAB objects
matlab.unittest.constraints.StringComparatorComparator for two strings
matlab.unittest.constraints.StructComparatorComparator for MATLAB structure arrays
Was this topic helpful?