Main Content

sltest.harness.check

Compare component under test between harness model and main model

Description

[CheckResult,CheckDetails] = sltest.harness.check(harnessOwner,harnessName) computes the checksum of the component under test in the harness model harnessName and compares it to the checksum of the component harnessOwner in the main model, returning the overall CheckResult and additional CheckDetails of the comparison. You cannot use sltest.harness.check on Subsystem models test harnesses.

Examples

collapse all

This example shows how to compare a component under test between the main model and the test harness. Comparing the component under test can help you determine if the CUT contains unsynchronized changes.

Check the Controller subsystem in the f14 model against the Controller subsystem in a test harness.

1. Load the model.

f14

2. Create a test harness for Controller.

sltest.harness.create('f14/Controller','Name','ControllerHarness');

3. Run the comparison.

[CheckResult,CheckDetails] = sltest.harness.check('f14/Controller',...
    'ControllerHarness');

4. View the overall result.

CheckResult
CheckResult = logical
   1

5. View the details of the comparison.

CheckDetails
CheckDetails = struct with fields:
     overall: 1
    contents: 1
      reason: 'The checksum of the harnessed component and the component in the main model are same.'

clear('CheckResult','CheckDetails');
close_system('f14',0);

Input Arguments

collapse all

Model or component handle or path, specified as a character vector or double.

Example: 1.9500e+03

Example: 'model_name'

Example: 'model_name/Subsystem'

The name of the harness, specified as a character vector.

Example: 'harness_name'

Output Arguments

collapse all

The result of the component comparison between the harness model and the system model, returned as true or false.

For a block diagram harness, the function returns CheckResult = true.

For a virtual subsystem harness, the function returns CheckResult = false.

Details of the check operation, returned as a structure. Structure fields contain the comparison results for the overall component, the component contents, the component interface, and a reason for the comparison result. If sltest.harness.check returns false, rebuild the test harness and retry sltest.harness.check.

Version History

Introduced in R2015a