function tests = solverTest
tests = functiontests(localfunctions);
end
function testRealSolution(testCase)
actSolution = quadraticSolver(1,-3,2);
expSolution = [2 1];
verifyEqual(testCase,actSolution,expSolution)
end
function testImaginarySolution(testCase)
actSolution = quadraticSolver(1,2,10);
expSolution = [-1+3i -1-3i];
verifyEqual(testCase,actSolution,expSolution)
end
Run Tests in solverTest Function
Run the tests.
results = runtests('solverTest.m')
Running solverTest
..
Done solverTest
__________
results =
1x2 TestResult array with properties:
Name
Passed
Failed
Incomplete
Duration
Totals:
2 Passed, 0 Failed, 0 Incomplete.
0.19172 seconds testing time.
Both of the tests passed.
33 Unit Testing