Этот пример показывает, как использовать генерацию тестов на модели с блоком C Caller и пользовательским кодом С
open_system('sldvexCCallerBlockExample');

Используйте функцию sldvrun, чтобы запустить Simulink ® Верификатор Проекта ™ анализ.
opts = sldvoptions; opts.Mode = 'TestGeneration'; opts.ModelCoverageObjectives = 'ConditionDecision'; opts.SaveHarnessModel = 'off'; opts.SaveReport = 'off'; [status, fileNames] = sldvrun('sldvexCCallerBlockExample', opts);
Checking compatibility for test generation: model 'sldvexCCallerBlockExample'
Compiling model...done
Building model representation...done
'sldvexCCallerBlockExample' is compatible for test generation with Simulink Design Verifier.
Generating tests using model representation from 24-Jan-2019 16:49:07...
..........
Completed normally.
Generating output files:
Results generation completed.
Data file:
/tmp/BR2019ad_1046204_242911/publish_examples0/tp2eb718db/ex07804984/sldv_output/sldvexCCallerBlockExample/sldvexCCallerBlockExample_sldvdata.mat
Используйте функцию sldvruntest, чтобы проверить, что тестовый набор достигает полного покрытия модели.
[~, finalCov] = sldvruntest('sldvexCCallerBlockExample', fileNames.DataFile, [], true); cvhtml('Final Coverage', finalCov);
Чтобы завершить пример, закройте все модели.
close_system('sldvexCCallerBlockExample', 0);