matlab.unittest.constraints Namespace
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
namespace to select
Test
elements and with the mocking framework to specify behavior
and qualify interactions.
The matlab.unittest.constraints
namespace consists of the following
classes.
Classes
Constraint Implementations
Fundamental Constraint-Related Interfaces
matlab.unittest.constraints.BooleanConstraint | Fundamental interface for constraints that support Boolean operations |
matlab.unittest.constraints.Constraint | Fundamental interface for constraints |
General Purpose
matlab.unittest.constraints.Eventually | Test if function asynchronously satisfies constraint |
matlab.unittest.constraints.HasField | Test if structure array has specified field |
matlab.unittest.constraints.IsAnything | Test for any value |
matlab.unittest.constraints.IsEqualTo | Constraint to test for equality |
matlab.unittest.constraints.IsFalse | Test if value is false |
matlab.unittest.constraints.IsSameHandleAs | Test if two handle arrays are the same |
matlab.unittest.constraints.IsTrue | Test if value is true |
matlab.unittest.constraints.IsValid | Test if array elements are valid handles |
matlab.unittest.constraints.ReturnsTrue | Test if function returns true |
Errors and Warnings
matlab.unittest.constraints.IssuesNoWarnings | Test if function issues no warnings |
matlab.unittest.constraints.IssuesWarnings | Test if function issues specified warnings |
matlab.unittest.constraints.Throws | Test if function throws specified error |
Inequalities
matlab.unittest.constraints.IsGreaterThan | Test if value is greater than specified value |
matlab.unittest.constraints.IsGreaterThanOrEqualTo | Test if value is greater than or equal to specified value |
matlab.unittest.constraints.IsLessThan | Test if value is less than specified value |
matlab.unittest.constraints.IsLessThanOrEqualTo | Test if value is less than or equal to specified value |
Array Size
matlab.unittest.constraints.HasElementCount | Test if array has specified number of elements |
matlab.unittest.constraints.HasLength | Test if array has specified length |
matlab.unittest.constraints.HasSize | Test if array has specified size |
matlab.unittest.constraints.IsEmpty | Test if value is empty |
matlab.unittest.constraints.IsScalar | Test if value is scalar |
Type
matlab.unittest.constraints.IsInstanceOf | Test if value is instance of specified class |
matlab.unittest.constraints.IsOfClass | Test if class of value is specified class |
Strings
matlab.unittest.constraints.ContainsSubstring | Test if value contains specified string |
matlab.unittest.constraints.EndsWithSubstring | Test if value ends with specified string |
matlab.unittest.constraints.IsSubstringOf | Test if value is substring of specified string |
matlab.unittest.constraints.Matches | Test if value matches specified regular expression |
matlab.unittest.constraints.StartsWithSubstring | Test if value starts with specified string |
Special Values
matlab.unittest.constraints.HasInf | Test if array has infinite values |
matlab.unittest.constraints.HasMissing | Test if array has missing elements |
matlab.unittest.constraints.HasNaN | Test if array has NaN values |
matlab.unittest.constraints.IsFinite | Test if array elements are finite values |
Numeric Attributes
matlab.unittest.constraints.IsReal | Test if array elements are real values |
matlab.unittest.constraints.IsSparse | Test if array is sparse |
Set
matlab.unittest.constraints.HasUniqueElements | Test if set has unique elements |
matlab.unittest.constraints.IsSameSetAs | Test if set has same elements as another set |
matlab.unittest.constraints.IsSubsetOf | Test if set is subset of specified set |
matlab.unittest.constraints.IsSupersetOf | Test if set is superset of specified set |
Files and Folders
matlab.unittest.constraints.IsFile | Test if value is file |
matlab.unittest.constraints.IsFolder | Test if value is folder |
Actual Value Proxies
matlab.unittest.constraints.AnyCellOf | Test if any element of cell array satisfies constraint |
matlab.unittest.constraints.AnyElementOf | Test if any element of array satisfies constraint |
matlab.unittest.constraints.EveryCellOf | Test if every element of cell array satisfies constraint |
matlab.unittest.constraints.EveryElementOf | Test if every element of array satisfies constraint |
Tolerances
matlab.unittest.constraints.AbsoluteTolerance | Absolute numeric tolerance |
matlab.unittest.constraints.AndTolerance | Logical conjunction of numeric tolerances |
matlab.unittest.constraints.OrTolerance | Logical disjunction of numeric tolerances |
matlab.unittest.constraints.RelativeTolerance | Relative numeric tolerance |
matlab.unittest.constraints.Tolerance | Fundamental interface for tolerances |
Comparators
matlab.unittest.constraints.CellComparator | Comparator for cell arrays |
matlab.unittest.constraints.DictionaryComparator | Comparator for dictionaries |
matlab.unittest.constraints.LogicalComparator | Comparator for logical arrays |
matlab.unittest.constraints.NumericComparator | Comparator for numeric arrays |
matlab.unittest.constraints.ObjectComparator | Comparator for MATLAB or Java object arrays |
matlab.unittest.constraints.PublicPropertyComparator | Comparator for public properties of MATLAB object arrays |
matlab.unittest.constraints.StringComparator | Comparator for string arrays, character arrays, or cell arrays of character arrays |
matlab.unittest.constraints.StructComparator | Comparator for structure arrays |
matlab.unittest.constraints.TableComparator | Comparator for table arrays |
Version History
Introduced in R2013a
See Also
verifyThat
| Simulink.sdi.constraints.MatchesSignal
(Simulink)