verifyExecutionMatchesMATLAB
Class: matlabtest.coder.TestCase
Namespace: matlabtest.coder
Verify that generated C/C++ code execution results match MATLAB results
Since R2023a
Syntax
Description
verifyExecutionMatchesMATLAB(
verifies that the execution results specified by testCase,executionResults)executionResults for
the C/C++ code generated by MATLAB®
Coder™ match the execution of the MATLAB source code in the equivalence test case testCase.
verifyExecutionMatchesMATLAB(
returns diagnostic information specified by testCase,executionResults,diagnostic)diagnostic.
verifyExecutionMatchesMATLAB(___,
specifies options using one or more name-value arguments in addition to the input arguments
in previous syntaxes.Name=Value)
Input Arguments
Name-Value Arguments
Examples
Tips
To specify multiple tolerances in the verification method, use the
verifyThatmethod and pass anmatlabtest.constraints.ExecutionMatchesMATLABobject as an input. Specify the tolerances by using theWithinname-value argument.This example test class contains a test that generates C code for a MATLAB function called
myAdd, executes the generated code using the specified inputs, and compares the result to the execution of the MATLAB source code with absolute tolerances that have two different data types.classdef tDemoTolerance < matlabtest.coder.TestCase methods(Test) function specifyMultipleTolerances(testCase) import matlab.unittest.constraints.AbsoluteTolerance import matlabtest.constraints.ExecutionMatchesMATLAB buildResults = build(testCase,"myAdd", ... Inputs={int16(1),single(1)}); actual = execute(testCase,buildResults); absTol = AbsoluteTolerance(int16(0.5), ... single(0.5)); verifyThat(testCase,actual, ... ExecutionMatchesMATLAB("Within",absTol)); end end end
Version History
Introduced in R2023a
See Also
Classes
matlabtest.coder.TestCase|matlabtest.coder.results.ExecutionResults|matlab.unittest.qualifications.Verifiable