В этом примере показано, как использовать генерацию тестов на модели с блоком 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 27-Jan-2021 09:47:56...
..........
Completed normally.
Generating output files:
Results generation completed.
Data file:
/tmp/BR2021ad_1584584_202060/publish_examples4/tp686bd2dc/ex07804984/sldv_output/sldvexCCallerBlockExample/sldvexCCallerBlockExample_sldvdata.mat
Используйте sldvruntest функция, чтобы проверить, что тестовый набор достигает полного покрытия модели.
[~, finalCov] = sldvruntest('sldvexCCallerBlockExample', fileNames.DataFile, [], true); cvhtml('Final Coverage', finalCov);
Чтобы завершить пример, закройте все модели.
close_system('sldvexCCallerBlockExample', 0);