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