Main Content

matlabtest.compiler.results.ExecutionResults Class

Namespace: matlabtest.compiler.results

Deployed code artifact execution results for equivalence tests

Since R2023a

Description

Objects of the matlabtest.compiler.results.ExecutionResults class contain the results from the execution of a compiler.build.Results (MATLAB Compiler SDK) object in a matlabtest.compiler.TestCase equivalence test case.

The matlabtest.compiler.results.ExecutionResults class is a handle class.

Class Attributes

Abstract
true

For information on class attributes, see Class Attributes.

Creation

Create an instance of matlabtest.compiler.results.ExecutionResults by using execute to execute a compiler.build.Results (MATLAB Compiler SDK) object in an equivalence test for a deployed code artifact. Creating an instance of this class requires MATLAB® Compiler SDK™.

Properties

expand all

Name of function that executed, returned as a string scalar.

Example: "makesquare"

Attributes:

GetAccess
public
SetAccess
immutable

Inputs that the function executed with, returned as a cell array. Each element in the cell array corresponds to an input to the function.

Example: {3,5}

Attributes:

GetAccess
public
SetAccess
immutable

Function execution output, returned as a cell array

Attributes:

GetAccess
public
SetAccess
immutable

Examples

collapse all

This example shows how to generate a Python® package from MATLAB source code and test for equivalence by using MATLAB Compiler SDK.

The function makesquare generates an n-by-n matrix:

function y = makesquare(x)
y = magic(x);
end

This class definition file defines an equivalence test case that inherits from matlabtest.compiler.TestCase. The test case in the methods block defines a test case that:

  1. Builds the Python package from the makesquare function

  2. Executes the Python package with input set to 5

  3. Verifies the execution of the Python package against the execution of the MATLAB function makesquare with the same input

classdef tDeployment < matlabtest.compiler.TestCase
    methods(Test)
        function pythonEquivalence(testCase)
            buildResults = build(testCase,"makesquare.m", ...
                "pythonPackage");
            executionResults = execute(testCase,buildResults,{5});
            verifyExecutionMatchesMATLAB(testCase,executionResults);
        end
    end
end

Run the pythonEquivalence test.

runtests("tDeployment", ...
    ProcedureName="pythonEquivalence")
Running pythonEquivalence
..
Done pythonEquivalence
__________


ans = 

  TestResult with properties:

          Name: 'tDeployment/pythonEquivalence'
        Passed: 1
        Failed: 0
    Incomplete: 0
      Duration: 93.1237
       Details: [1×1 struct]

Totals:
   1 Passed, 0 Failed, 0 Incomplete.
   93.1237 seconds testing time.

Version History

Introduced in R2023a