matlab.unittest.constraints.AnyElementOf Class
Namespace: matlab.unittest.constraints
Test if any element of array satisfies constraint
Description
The matlab.unittest.constraints.AnyElementOf class provides a proxy of the
actual value, so you can test if at least one element of an array satisfies a given
constraint. When you include the proxy in your test, the testing framework examines the
constraint on an element-by-element basis.
You can use an instance of this class in tests performed with the qualification methods
assertThat, assumeThat, fatalAssertThat,
or verifyThat. The class does not modify the supplied actual value. It serves
only as a wrapper to perform the constraint analysis.
Creation
Description
p = matlab.unittest.constraints.AnyElementOf(actualValue)
creates a proxy to test if any element of the specified array satisfies a constraint and
sets the ActualValue property. When you use this proxy to test against a
constraint, the test passes if at least one element of actualValue
satisfies the constraint.
Properties
Examples
Tips
You can use
AnyElementOfto check if any element of an array satisfies a constraint. However, there are some constraints, such asHasInfandHasNaN, that natively validate if any of the elements satisfy a condition. In these situations, the use ofAnyElementOfis unnecessary and degrades qualification performance.
Version History
Introduced in R2013a