According to "How to Write Tests That Share Common Set-Up Code" is it possible to:
function test_suite = testSetupExample
initTestSuite;
function fh = setup
fh = figure;
function teardown(fh)
delete(fh);
function testColormapColumns(fh)
assertEqual(size(get(fh, 'Colormap'), 2), 3);
function testPointer(fh)
assertEqual(get(fh, 'Pointer'), 'arrow');
But I couldn't make it work with more parameters:
function test_suite = testSetupExample
initTestSuite;
function [fh,fc] = setup
fh = figure;
fc = 2;
end
function teardown(fh,fc)
delete(fh);
function testColormapColumns(fh,fc)
assertEqual(size(get(fh, 'Colormap'), fc), 3);
function testPointer(fh,fc)
assertEqual(get(fh, 'Pointer'), 'arrow');
When I runtests it says:
Input argument "fc" is undefined.
Why is that? I done something wrong or it is unsupported in the current version of Matlab xUnit? How to circumvent that?
PS: Actually my MATLAB requires each function to have an end. I didn't wrote them here to keep consistency with the manual examples.