Generated Code Tests
You can create and run tests to verify generated code, hand-written code, as well code generated in a previous release. You can also use the MATLAB Unit Test framework to test models and code.
Functions
| sltest.CodeImporter | Import C or C++ code into Simulink for testing (Since R2021a) | 
| sltest.CodeImporter.SandboxSettings | Sandbox settings for C code testing (Since R2021a) | 
| createSandbox | Create sandbox for C code unit testing (Since R2021a) | 
Topics
- Importing and Testing Custom C/C++ CodeYou can test custom C or C++ code by importing it into Simulink® using the Code Importer wizard in the Test Manager or API commands at the MATLAB® command line. 
- Test Integrated CodeTest code integrated in a Simulink model using C Caller blocks or S-Functions. 
- Test Models Using MATLAB Unit TestTest integration with MATLAB test scripts. 
- Use SIL/PIL to Verify Generated Code from an Earlier ReleaseUse generated code that was verified using SIL or PIL in a previous release to verify code in current release. 
- Code Generation Verification Workflow with Simulink TestPerform code generation verification for a model. 
- Test Execution OrderOrder in which models load, and test cases, iterations, and callbacks run. 

