Main Content

Verify Generated Code and Deployed Code Artifacts

Verify generated C/C++ code and deployed code artifacts by using equivalence tests
Since R2023a

With MATLAB® Test™, you can verify generated C/C++ code and deployed code artifacts by using equivalence tests, which are also referred to as back-to-back tests.

Author equivalence tests that generate C/C++ code by using MATLAB Coder™ and verify that the generated code is functionally equivalent to the MATLAB source code. If you have Embedded Coder®, you can measure the coverage of your generated C/C++ code when you run your equivalence tests.

Alternatively, you can author equivalence tests that generate deployed code artifacts by using MATLAB Compiler SDK™, including Java® and Python® packages and .NET assemblies, and test for equivalence.

Classes

matlabtest.coder.TestCaseTest case for generated C/C++ equivalence tests
matlabtest.coder.MATLABCoderTesterFormal tester for generated C/C++ equivalence tests
matlabtest.coder.plugins.GeneratedCodeCoveragePluginPlugin for code coverage information for generated C/C++ code equivalence tests
matlabtest.coder.MEXReplacementTestSuiteVerify generated C/C++ code by using MEX replacement test suites (Since R2025a)
matlabtest.compiler.TestCaseTest case for deployed code artifact equivalence tests

Functions

expand all

buildGenerate C/C++ code in equivalence tests
executeExecute generated C/C++ code in equivalence tests
verifyExecutionMatchesMATLABVerify that generated C/C++ code execution results match MATLAB results
buildGenerate C/C++ code in formal equivalence tests
executeExecute generated C/C++ code in formal equivalence tests
buildGenerate deployed code artifacts in equivalence tests
executeExecute deployed code artifacts in equivalence tests
verifyExecutionMatchesMATLABVerify that deployed code artifact execution results match MATLAB results
matlabtest.coder.MEXReplacementTestSuite.fromClass Create MEX replacement test suite from test class (Since R2025a)
matlabtest.coder.MEXReplacementTestSuite.fromFileCreate MEX replacement test suite from test file (Since R2025a)
matlabtest.coder.MEXReplacementTestSuite.fromFolderCreate MEX replacement test suite from tests in folder (Since R2025a)
matlabtest.coder.MEXReplacementTestSuite.fromMethodCreate MEX replacement test suite from test method (Since R2025a)
matlabtest.coder.MEXReplacementTestSuite.fromNameCreate MEX replacement test suite from test name (Since R2025a)
matlabtest.coder.MEXReplacementTestSuite.fromNamespaceCreate MEX replacement test suite from tests in namespace (Since R2025a)
matlabtest.coder.MEXReplacementTestSuite.fromProjectCreate MEX replacement test suite from tests in project (Since R2025a)
matlabtest.coder.MEXReplacementTestSuite.fromRequirementsCreate MEX replacement test suite from requirements (Since R2025a)

Topics

Test MATLAB Code for Equivalence

Collect Coverage for Generated Code

Featured Examples