C Caller ブロックをもつモデルでのテスト生成
この例では、C Caller ブロックおよびカスタム C コードをもつモデルに対するテスト生成の使用方法について説明します。
C Caller ブロックおよびカスタム コードが含まれるモデルを開く
open_system('sldvexCCallerBlock');

モデルのカバレッジを確認するテストの生成
関数sldvrunを使用して Simulink ® Design Verifier ™ 解析を実行します。
opts = sldvoptions; opts.Mode = 'TestGeneration'; opts.ModelCoverageObjectives = 'ConditionDecision'; opts.SaveHarnessModel = 'off'; opts.SaveReport = 'off'; [status, fileNames] = sldvrun('sldvexCCallerBlock', opts);
12-Aug-2025 18:17:11
Checking compatibility for test generation: model 'sldvexCCallerBlock'
Compiling model...done
Building model representation...done
12-Aug-2025 18:17:33
'sldvexCCallerBlock' is compatible for test generation with Simulink Design Verifier.
Generating tests using model representation from 12-Aug-2025 18:17:33...
..........
12-Aug-2025 18:17:46
Completed normally.
Generating output files:
12-Aug-2025 18:17:47
Results generation completed.
Data file:
/tmp/Bdoc25b_2988451_683368/tpfb6fc956/sldv-ex07804984/sldv_output/sldvexCCallerBlock/sldvexCCallerBlock_sldvdata.mat
カバレッジの検証
関数sldvruntestを使用して、テスト スイートがすべてのモデル カバレッジを達成することを検証します。
[~, finalCov] = sldvruntest('sldvexCCallerBlock', fileNames.DataFile, [], true); cvhtml('Final Coverage', finalCov);
クリーン アップ
すべてのモデルを閉じて例を完了します。
close_system('sldvexCCallerBlock', 0);