Main Content

Generated Code Tests

Run tests for integrated code, C code, and code from previous releases

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.CodeImporterImport C or C++ code into Simulink for testing
sltest.CodeImporter.SandboxSettingsSandbox settings for C code testing
createSandboxCreate sandbox for C code unit testing

Topics

Importing and Testing Custom C/C++ Code

You 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 Code

Test code integrated in a Simulink model using C Caller blocks or S-Functions.

Test Models Using MATLAB Unit Test

Test integration with MATLAB test scripts.

Use SIL/PIL to Verify Generated Code from an Earlier Release

Use 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 Test

Perform code generation verification for a model.

Test Execution Order

Order in which models load, and test cases, iterations, and callbacks run.

Featured Examples