Verify Generated Code and Deployed Code Artifacts
Verify generated C/C++ code and deployed code artifacts by using equivalence
tests
Since R2023a
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.TestCase | Test case for generated C/C++ equivalence tests |
matlabtest.coder.MATLABCoderTester | Formal tester for generated C/C++ equivalence tests |
matlabtest.coder.plugins.GeneratedCodeCoveragePlugin | Plugin for code coverage information for generated C/C++ code equivalence tests |
matlabtest.coder.MEXReplacementTestSuite | Verify generated C/C++ code by using MEX replacement test suites (Since R2025a) |
matlabtest.compiler.TestCase | Test case for deployed code artifact equivalence tests |
Functions
Topics
Test MATLAB Code for Equivalence
- Generate C/C++ Code and Test for Equivalence
Generate C/C++ code from MATLAB code and verify that the execution of the generated code and MATLAB code are equivalent. - Equivalence Test C/C++ Code for Multiple Entry-Point Functions and Function Signatures
Generate C/C++ code from multiple entry-point functions and signatures and verify that the execution of the generated code and MATLAB code are equivalent. - Generate Deployed Code Artifacts and Test for Equivalence
Generate deployed code artifacts with MATLAB Compiler SDK and verify that the execution of the generated artifacts and MATLAB code are equivalent. - Choose an Approach for Equivalence Testing Generated C++ Code
Equivalence test C++ code or deployable C++ shared libraries by using MATLAB Coder or MATLAB Compiler SDK. - Table of Qualifications for Equivalence Tests
Qualify equivalence tests by using verifications, assumptions, assertions, and fatal assertions. - Verify Generated C/C++ Code by Running Existing MATLAB Tests
Create and run MEX replacement test suites, which replace calls to MATLAB functions with calls to MEX functions. (Since R2025a)
Collect Coverage for Generated Code
- Collect Coverage for Generated C/C++ Code in Equivalence Tests
Measure the coverage of your generated C/C++ code when you run equivalence tests. - Types of Coverage for Generated C/C++ Code in Equivalence Tests
Use different types of code coverage analysis for generated C/C++ code when you run equivalence tests in SIL mode. - Generate Cobertura Coverage Reports for Generated C/C++ Code in Equivalence Tests
Generate Cobertura XML code coverage reports when you run equivalence tests that execute C/C++ code. (Since R2024a)