0001 classdef dsUnitTest_autogen_all_localfn < matlab.unittest.TestCase
0002 properties
0003 unitTestDataPath = dsGetConfig('ds_unitTestData_path');
0004 end
0005
0006 properties (TestParameter)
0007 dataFileName = dsUnitGetAutogenFiles(true, false);
0008 end
0009
0010 methods (Test, TestTags = {'autogen'})
0011 function testCellIn(testCase, dataFileName)
0012 args = load(fullfile(testCase.unitTestDataPath, 'autogen', dataFileName));
0013 expectedOut = args.argout;
0014
0015
0016 [~,filename] = fileparts2(dataFileName);
0017 dataNameSplit = strsplit(filename,'_autogen_');
0018 fnNameCat = dataNameSplit{1};
0019 splitName = strsplit(fnNameCat,'__');
0020 fnName = splitName{1};
0021 localfFnName = splitName{2};
0022
0023
0024 fnHandle = str2func(fnName);
0025 localFnHandles = feval(fnHandle);
0026 localFnStrs = cellfun(@func2str,localFnHandles, 'uni',false);
0027
0028
0029 localFnHandle = localFnHandles{strcmp(localFnStrs, localfFnName)};
0030
0031 [testOut{1:length(expectedOut)}] = feval(localFnHandle, args.argin{:});
0032
0033 for ind = 1:length(expectedOut)
0034 testCase.verifyEqual(testOut{ind}, expectedOut{ind});
0035 end
0036
0037 end
0038 end
0039
0040 end