Main Content

Simulink.SubsystemReference.showSignatureDiffDialogForUnitTests

Display differences in signatures of Subsystem Reference block in model with unit test signatures of subsystem file

Since R2023a

    Description

    Simulink.SubsystemReference.showSignatureDiffDialogForUnitTests(ssRefBlock) compares the simulation signatures of the Subsystem Reference block ssRefBlock in the model with the simulation signatures of the Subsystem Reference blocks in all the unit tests of the subsystem file and displays the differences between the signatures in the Signature Difference Viewer.

    example

    Simulink.SubsystemReference.showSignatureDiffDialogForUnitTests(___,Name=Value) displays the differences between the signatures using one or more name-value arguments in addition to the input argument in the previous syntax. For example, to compare the signatures generated for code generation of the Subsystem Reference block in the model with the unit test signatures, set forCodeGen to true.

    example

    Examples

    collapse all

    Consider a subsystem file slexReusableSS with two unit tests ssref1_double and ssref1_int32. There are three instances of slexReusableSS in a model slexModelUsingReusableSS.

    ssfile = "slexReusableSS";
    open_system(ssfile);

    Set the test harnesses ssref1_double and ssref1_int32 as unit tests of the subsystem file.

    set_param(ssfile,"UnitTestNames",{'ssref1_double','ssref1_int32'});

    Generate signatures of all the unit tests of the subsystem file.

    Simulink.SubsystemReference.generateSignatures(ssfile);
    save_system(ssfile);

    Compare the simulation signature of the instance slexModelUsingReusableSS/Int8 Input with the simulation signatures of both the unit tests of slexReusableSS.

    open_system("slexModelUsingReusableSS");
    ssrefInstance = "slexModelUsingReusableSS/Int8 Input";
    Simulink.SubsystemReference.showSignatureDiffDialogForUnitTests(ssrefInstance);

    A subsystem file slexReusableSS has two unit tests ssref1_double and ssref1_int32. There are three instances of slexReusableSS in a model slexModelUsingReusableSS.

    ssfile = "slexReusableSS";
    open_system(ssfile);

    Set the test harnesses ssref1_double and ssref1_int32 as unit tests of the subsystem file.

    set_param(ssfile,"UnitTestNames",{'ssref1_double','ssref1_int32'});

    Generate simulation signatures of all the unit tests of the subsystem file.

    Simulink.SubsystemReference.generateSignatures(ssfile);
    save_system(ssfile);

    Compare the simulation signature of the instance slexModelUsingReusableSS/Int8 Input with the simulation signatures of the unit test ssref1_double.

    open_system("slexModelUsingReusableSS");
    ssrefInstance = "slexModelUsingReusableSS/Int8 Input";
    Simulink.SubsystemReference.showSignatureDiffDialogForUnitTests(ssrefInstance,unitTestNames={'ssref1_double'});

    The Signature Difference Viewer displays the differences in signatures.

    Input Arguments

    collapse all

    Path or handle of a Subsystem Reference block in a model, specified as a string or character vector.

    Example: "slexModelUsingReusableSS/Int8 Input"

    Data Types: char | string

    Name-Value Arguments

    Specify optional pairs of arguments as Name1=Value1,...,NameN=ValueN, where Name is the argument name and Value is the corresponding value. Name-value arguments must appear after other arguments, but the order of the pairs does not matter.

    Example: Simulink.SubsystemReference.showSignatureDiffDialogForUnitTests("slexModelUsingReusableSS/Int8 Input",unitTestNames={'ssref1_double'},forCodeGen=true) displays the differences between the signatures generated for code generation of the Subsystem Reference block slexModelUsingReusableSS/Int8 Input and the code generation signatures of the unit test ssref1_double.

    Names of unit tests of the subsystem file, specified as a cell array of character vectors. The Signature Difference Viewer displays the differences between the signatures of the unit tests and the signatures of the Subsystem Reference block in the model.

    Example: unitTestNames={'ssref1_double'}

    Example: unitTestNames={'ssref1_double','ssref1_int32'}

    Data Types: cell

    Option to compare signatures generated either for simulation or code generation of the Subsystem Reference block in the model with the unit tests of the subsystem file, specified as one of these values:

    • false — Display differences in simulation signatures

    • true — Display differences in code generation signatures

    Example: forCodeGen=true

    Option to compare signatures for a single type of execution or all types of execution, specified as one of these values:

    • true — Display differences between simulation signatures of Subsystem Reference block with simulation signatures of unit tests or code generation signatures of Subsystem Reference block with code generation signatures of unit tests, depending on the value specified for the argument forCodeGen.

    • false — Display differences between signatures for all types of execution. For example, this displays differences in simulation signatures of Subsystem Reference block with both simulation and code generation signatures of unit tests.

    Example: diffMatchingCompilation=false

    Version History

    Introduced in R2023a

    expand all