verifyThat
Class: matlab.unittest.qualifications.Verifiable
Namespace: matlab.unittest.qualifications
Verify value meets specified constraint
Description
verifyThat(
verifies that testCase
,actual
,constraint
)actual
is a value that satisfies the specified
constraint. If the testing framework displays diagnostic information for the test, it uses
only the diagnostics provided by the constraint.
verifyThat(
also associates the diagnostic information in testCase
,actual
,constraint
,diagnostic
)diagnostic
with the qualification. When you use this syntax, the framework displays the diagnostic information
provided by both constraint
and diagnostic
.
Input Arguments
Examples
Tips
Use verification qualifications to produce and record failures without throwing an exception. Because verifications do not throw exceptions, all test content runs to completion even when verification failures occur. Typically, verifications are the primary qualification for a unit test because they typically do not require an early exit from the test. Use other qualification types to test for violation of preconditions or incorrect test setup:
Use assumption qualifications to ensure that the test environment meets preconditions that otherwise do not result in a test failure. Assumption failures result in filtered tests, and the testing framework marks the tests as
Incomplete
. For more information, seematlab.unittest.qualifications.Assumable
.Use assertion qualifications when the failure condition invalidates the remainder of the current test content but does not prevent proper execution of subsequent tests. A failure at the assertion point renders the current test as
Failed
andIncomplete
. For more information, seematlab.unittest.qualifications.Assertable
.Use fatal assertion qualifications to abort the test session upon failure. These qualifications are useful when the failure is so fundamental that continuing testing does not make sense. Fatal assertion qualifications are also useful when fixture teardown does not restore the environment state correctly, and aborting testing and starting a fresh session is preferable. For more information, see
matlab.unittest.qualifications.FatalAssertable
.
To use
verifyThat
in a formal equivalence test for generated C/C++ code, specifyactual
as an instance ofmatlabtest.coder.MATLABCoderTester
(MATLAB Test) and specifyconstraint
as an instance ofmatlabtest.constraints.ExecutionMatchesMATLAB
(MATLAB Test).
Version History
Introduced in R2013a