收集代码的覆盖率
测量模型元素中或从模型生成的代码的覆盖率
Simulink® Coverage™ 可测量代码覆盖率并指出设计中未经测试的元素。您可以收集支持的模型元素中或 MATLAB® Function 模块中 C/C++ 代码的覆盖率,或者在软件在环 (SIL) 模式或处理器在环 (PIL) 模式下从模型生成的代码的覆盖率。Simulink Coverage 可测量多种类型的代码覆盖率分析,例如语句、条件、决策和修正条件/决策覆盖率。
函数
主题
代码覆盖率基础知识
- Types of Code Coverage
Perform several types of code coverage analysis for the code within supported Simulink elements or for code generated from models in SIL mode or PIL mode. - Specify Code Coverage Options
Set options for code coverage.
Simulink 中使用的 MATLAB 代码的覆盖率
- Model Coverage for MATLAB Functions
Use model coverage for MATLAB Function blocks and interpret the results. - Coverage for MATLAB Function Blocks
This example explains how Model Coverage relates to MATLAB® code inside a MATLAB Function Block.
集成 C/C++ 代码的覆盖率
- Coverage for Models with Code Blocks and Simulink Blocks
Record coverage for models with a combination of code blocks and other Simulink blocks. - Coverage for Custom C/C++ Code in Simulink Models
Analyze model coverage for C/C++ S-Functions. - View Coverage Results for Custom C/C++ Code in S-Function Blocks
View coverage results for the C/C++ code in S-Function blocks in your model.
生成代码的覆盖率
- Code Coverage for Models in Software-in-the-Loop (SIL) Mode and Processor-in-the-Loop (PIL) Mode
Configure code coverage for SIL and PIL simulations and review results. - View and Filter Code Coverage Results Using the Code Pane
This example shows how to view code coverage results and justify code coverage outcomes directly from the Code pane in Simulink®.