Table of Qualifications for Equivalence Tests
Equivalence test qualifications compare the execution of a generated target to the execution of the MATLAB® source code with the same inputs. You can use these types of qualifications in equivalence tests:
Verifications — Produce and record failures without returning an exception. When a verification failure occurs, the remaining tests run to completion.
Assumptions — Ensure that the test environment meets preconditions that otherwise do not result in a test failure. When an assumption failure occurs, the testing framework marks the test as filtered.
Assertions — Ensure that the preconditions of the current test are met. When an assertion failure occurs, the framework marks the current test as failed and incomplete. However, the failure does not prevent the execution of subsequent tests.
Fatal assertions — Ensure that the remainder of the current test session is valid and the state is recoverable. When a fatal assertion failure occurs, the testing framework aborts the test session.
For more information about qualifications, see Table of Verifications, Assertions, and Other Qualifications.
Qualifications for Generated C/C++ Code Equivalence Tests
Equivalence tests for generated C/C++ code can inherit from matlabtest.coder.TestCase
or from matlab.unittest.TestCase
.
If your equivalence test inherits from matlabtest.coder.TestCase
, you can use these qualifications:
Type of Test | Method |
---|---|
Verify that execution is equal. | verifyExecutionMatchesMATLAB |
Assume that execution is equal. | assumeExecutionMatchesMATLAB |
Assert that execution is equal. | assertExecutionMatchesMATLAB |
Fatally assert that execution is equal. | fatalAssertExecutionMatchesMATLAB |
If your equivalence test inherits from matlab.unittest.TestCase
, use one of
these qualifications:
Type of Test | Method |
---|---|
Verify that execution is equal. | verifyThat |
Assume that execution is equal. | assumeThat |
Assert that execution is equal. | assertThat |
Fatally assert that execution is equal. | fatalAssertThat |
To use these qualification methods, specify the actual value as an instance of matlabtest.coder.MATLABCoderTester
and specify the constraint to use as an
instance of matlabtest.constraints.ExecutionMatchesMATLAB
.
Qualifications for Deployed Code Artifact Equivalence Tests
Equivalence tests for deployed code artifacts inherit from matlabtest.compiler.TestCase
, which has these qualification
methods:
Type of Test | Method |
---|---|
Verify that execution is equal. | verifyExecutionMatchesMATLAB |
Assume that execution is equal. | assumeExecutionMatchesMATLAB |
Assert that execution is equal. | assertExecutionMatchesMATLAB |
Fatally assert that execution is equal. | fatalAssertExecutionMatchesMATLAB |
See Also
Classes
matlab.unittest.qualifications.Verifiable
|matlab.unittest.qualifications.Assumable
|matlab.unittest.qualifications.Assertable
|matlab.unittest.qualifications.FatalAssertable