Create a test suite and run the tests. The testSquare test fails because the
implementation of exampleFunction is incorrect.
suite = testsuite('ExampleTest.m');
results = run(suite)
Running exampleTest
================================================================================
Verification failed in exampleTest/testSquare.
Framework Diagnostic:
verifyEqual failed.
--> The values are not equal using "isequaln".
--> Failure table:
Actual Expected Error RelativeError
27 9 18 2
Actual Value:
27
Expected Value:
9
Stack Information:
In C:\Work\exampleTest.m (testSquare) at 7
..
Done exampleTest
Failure Summary:
Name Failed Incomplete Reason(s)
exampleTest/testSquare X Failed by verification.
results =
1×2 TestResult array with properties:
Name
Passed
Failed
Incomplete
Duration
Details
Totals:
1 Passed, 1 Failed (rerun), 0 Incomplete.
0.24851 seconds testing time.
Update the code in exampleFunction to fix the coding error.
Rerun Failed Tests