根据 "如何编写共享设置代码的测试",是否有可能:
但我无法使用更多的参数使其工作:
当我运行测试时,它会显示:
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');
但我无法使用更多的参数使其工作:
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');
当我运行测试时,它会显示:
输入参数“fc”未定义。
为什么会这样?是我做错了还是当前版本的Matlab xUnit不支持它?如何规避这个问题?
PS:实际上,我的MATLAB要求每个函数都有一个结束。我没有在这里写它们,以保持与手册示例的一致性。