Is code coverage for a model equal to code coverage of generated code?
Show older comments
Hi,
I use Simulink Verification and Validation toolbox to measure the code coverage while simulating the model with an automated test execution. In coverage settings I checked "Decision" and "Condition" and get in the coverage report a C1 and D1 result.
My question is how this results correlate with the code coverage of the generated code? Is it same? E.g. C1 and D1 is 100%, do I automatically have 100% for the generated code?
Thanks
Simulink version: R2014a
2 Comments
Carl-Jakob Ulmer
on 18 Sep 2015
Sebastian Castro
on 18 Sep 2015
Yes, the same principles hold for Stateflow... so you should really test code coverage as well if you can!
Accepted Answer
More Answers (1)
Jeevan Thomas
on 17 Sep 2015
1 vote
Coverage of a model doesn't necessarily reflect coverage of generated code.
In the generated code, there will be utility functions/routines generated as part of block settings (for ex: rounding, saturate on integer overflow, div-by-zero etc) which will not be covered using Simulink V&V.
Also optimization settings plays a part too.
For code coverage, you could try tools such as BTC EmbeddedTester (works better with TargetLink as code generator), ReactisForC, BullEyeCoverage etc.
Categories
Find more on Simulink Coder in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!