MatrixBerryCore
mlunit_test_common.m
Go to the documentation of this file.
1 classdef mlunit_test_common < mxberry.unittest.TestCase
2  methods
3  function self = mlunit_test_common(varargin)
4  self = self@mxberry.unittest.TestCase(varargin{:});
5  end
6  end
7  methods (Test)
8  function testIsVar(self)
9  a=1; %#ok<NASGU>
10  isOk=mxberry.core.isvar('a');
11  self.verifyTrue(isOk);
12  isOk=mxberry.core.isvar('b');
13  self.verifyTrue(~isOk);
14  end
15  function testAbsRelCompare(self)
16  import mxberry.core.absrelcompare;
17  % size error
18  self.runAndCheckError(...
19  'mxberry.core.absrelcompare([1 1], [1; 1], 0.1, [], @abs)', ...
20  'wrongInput:wrongArgs');
21  % absTol error #1
22  self.runAndCheckError(...
23  'mxberry.core.absrelcompare([1 1], [1 1], -0.1, [], @abs)', ...
24  'wrongInput:wrongAbsTol');
25  % absTol error #2
26  self.runAndCheckError([...
27  'mxberry.core.absrelcompare([1 1], [1 1], [0.1, 0.1], [],', ...
28  ' @abs)'], 'wrongInput:wrongAbsTol');
29  % absTol error #3
30  self.runAndCheckError([...
31  'mxberry.core.absrelcompare([1 1], [1 1], [], [],', ...
32  ' @abs)'], 'wrongInput:wrongAbsTol');
33  % relTol error #1
34  self.runAndCheckError(...
35  'mxberry.core.absrelcompare([1 1], [1 1], 0.1, -0.1, @abs)',...
36  'wrongInput:wrongRelTol');
37  % relTol error #2
38  self.runAndCheckError([...
39  'mxberry.core.absrelcompare([1 1], [1 1], 0.1, [0.1, 0.1],',...
40  ' @abs)'], 'wrongInput:wrongRelTol');
41  % fNormOp error
42  self.runAndCheckError(...
43  'mxberry.core.absrelcompare([1 1], [1 1], 0.1, [], 100)', ...
44  'wrongInput:wrongNormOp');
45  % result tests
46  SRes = calc([], [], 0.5, [], @abs);
47  SExpRes = struct('isEqual', true, 'absDiff', [], 'isRel', ...
48  false, 'relDiff', [], 'relMDiff', []);
49  check(SExpRes, SRes);
50  %
51  xVec = [1 2]; yVec = [2 4];
52  SRes = calc(xVec, yVec, 2, [], @abs);
53  SExpRes.isEqual = true;
54  SExpRes.absDiff = 2;
55  check(SExpRes, SRes);
56  %
57  SRes = calc(xVec, yVec, 1, [], @abs);
58  SExpRes.isEqual = false;
59  check(SExpRes, SRes);
60  %
61  SRes = calc(xVec, yVec, 2, 2/3, @abs);
62  SExpRes.isEqual = true;
63  check(SExpRes, SRes);
64  %
65  SRes = calc(xVec, yVec, 1, 2/3, @abs);
66  SExpRes.isRel = true;
67  SExpRes.relDiff = 2/3;
68  SExpRes.relMDiff = 2;
69  check(SExpRes, SRes);
70  %
71  SRes = calc(xVec, yVec, 1, 0.5, @abs);
72  SExpRes.isEqual = false;
73  check(SExpRes, SRes);
74  %
75  SRes = calc(xVec, yVec, 0.5, 0.5, @abs);
76  check(SExpRes, SRes);
77  function SRes = calc(varargin)
78  [SRes.isEqual, SRes.absDiff, SRes.isRel, SRes.relDiff, ...
79  SRes.relMDiff] = mxberry.core.absrelcompare(varargin{:});
80  end
81  function check(leftArray,rightArray)
82  self.verifyEqual(true,isequal(leftArray,...
83  rightArray));
84  end
85  end
86  function self=testCheckMultVar(self)
87  import mxberry.core.check.lib.*;
88  %
89  a='sdfadf';
90  b='asd';
91  %
92  checkP(@(x1)isstring(x1),1,a,'varNameList',{'alpha'});
93  checkP(@(x1)isstring(x1)',1,a);
94  checkP('numel(x1)==numel(x2)',2,a,a);
95  checkP('numel(x1)==numel(x2)',2,a,a,'varNameList',{'alpha'});
96  checkP('numel(x1)==numel(x2)',2,a,a,'varNameList',{'alpha','beta'});
97  %
98  checkNSuperMaster('');
99  checkNSuperMaster('MyMessage','errorMessage','MyMessage');
100  %
101  function checkNSuperMaster(errorMessage,varargin)
102 
103  checkNMaster('',errorMessage,varargin{:});
104  checkNMaster('wrongParam:badType',errorMessage,'errorTag',...
105  'wrongParam:badType',varargin{:});
106  %
107  checkNMaster('wrongParam:badType',errorMessage,'errorTag',...
108  'wrongParam:badType',varargin{:});
109  end
110  %
111  function checkNMaster(expTag,expMessage,varargin)
112  isEmptyMsg=isempty(expMessage);
113  checkN('numel(x1)==numel(x2)',2,expTag,expMessage,a,a,...
114  'varNameList',{'alpha','beta','gamma'},varargin{:});
115  if isEmptyMsg
116  expMessage='Alpha,Beta';
117  end
118  checkN('numel(x1)==numel(x2)',2,expTag,expMessage,a,b,...
119  'varNameList',{'Alpha','Beta'},varargin{:});
120  if isEmptyMsg
121  expMessage='Alpha,b';
122  end
123  checkN('numel(x1)==numel(x2)',2,expTag,expMessage,a,b,...
124  'varNameList',{'Alpha'},varargin{:});
125  end
126 
127  %
128  function checkN(typeSpec,nPlaceHolders,expTag,expMsg,a,b,varargin)
129  if isempty(expMsg)
130  runArgList={};
131  else
132  runArgList={expMsg};
133  end
134  if isempty(expTag)
135  expTag=':wrongInput';
136  end
137  import mxberry.core.check.lib.*;
138  try
139  mxberry.core.checkmultvar(...
140  typeSpec,nPlaceHolders,a,b,varargin{:});
141  catch meObj %#ok<NASGU>
142  self.runAndCheckError(...
143  'rethrow(meObj)',expTag,runArgList{:});
144  end
145  fHandle=typeSpec2Handle(typeSpec,nPlaceHolders);
146  try
147  mxberry.core.checkmultvar(...
148  fHandle,nPlaceHolders,a,b,varargin{:});
149  catch meObj %#ok<NASGU>
150  self.runAndCheckError(...
151  'rethrow(meObj)',expTag,runArgList{:});
152  end
153  end
154  %
155  function checkP(typeSpec,nPlaceHolders,varargin)
156  import mxberry.core.throwerror;
157  mxberry.core.checkmultvar(typeSpec,...
158  nPlaceHolders,varargin{:});
159  fHandle=typeSpec2Handle(typeSpec,nPlaceHolders);
160  mxberry.core.checkmultvar(fHandle,...
161  nPlaceHolders,varargin{:});
162  end
163  %
164  function fHandle=typeSpec2Handle(typeSpec,nPlaceHolders)
165  import mxberry.core.check.lib.*;
166  if ischar(typeSpec)
167  switch nPlaceHolders
168  case 1
169  fHandle=eval(['@(x1)(',typeSpec,')']);
170  case 2
171  fHandle=eval(['@(x1,x2)(',typeSpec,')']);
172  case 3
173  fHandle=eval(['@(x1,x2,x3)(',typeSpec,')']);
174  otherwise
175  throwerror('wrongInput',...
176  'unsupported number of arguments');
177  end
178  else
179  fHandle=typeSpec;
180  end
181  end
182  end
183  function self=testCheckVar(self)
184  import mxberry.core.check.lib.*;
185  a='sdfadf';
186  mxberry.core.checkvar(a,@isstring);
187  mxberry.core.checkvar(a,@isstring,'aa');
188  a=1;
189  checkN(a,@(x)isstring(x));
190  checkN(a,@(x)iscelloffunc(x));
191  %
192  checkP(a,@(x)(isstring(x)||isrow(x)));
193  %
194  checkP(a,@(x)(isstring(x)||isrow(x)||isabrakadabra(x)));
195  %
196  a=1;
197  checkN(a,@(x)(isstring(x)&&isvec(x)));
198  checkN(a,@(x)(isstring(x)&&isabrakadabra(x)));
199  %
200  a=true;
201  checkP(a,@(x)(islogical(x)&&isscalar(x)));
202  a=struct();
203  checkP(a,@(x)(isstruct(x)&&isscalar(x)));
204  %
205  a={'a','b'};
206  checkP(a,@(x)(iscellofstring(x)));
207  a={'a','b';'d','e'};
208  checkP(a,@(x)(iscellofstring(x)));
209  a={'a','b'};
210  checkP(a,@(x)(iscellofstring(x)));
211  a={'a','b';'d','e'};
212  checkP(a,@(x)iscellofstring(x));
213  a={'a','b';'d','esd'.'};
214  checkN(a,@(x)iscellofstring(x));
215  %
216  a={@(x)1,@(x)2};
217  checkP(a,@(x)iscelloffunc(x));
218  a={@(x)1,'@(x)2'};
219  checkN(a,@iscelloffunc);
220  %
221  checkNE('','myMessage',a,@iscelloffunc,...
222  'errorMessage','myMessage');
223  checkNE('wrongType:wrongSomething','myMessage',a,...
224  @iscelloffunc,...
225  'errorMessage','myMessage','errorTag',...
226  'wrongType:wrongSomething');
227  checkNE('wrongType:wrongSomething','',a,@iscelloffunc,...
228  'errorTag','wrongType:wrongSomething');
229  %
230  function checkN(x,typeSpec,varargin)
231  checkNE('','',x,typeSpec,varargin{:});
232 
233  end
234  %
235  function checkNE(errorTag,errorMessage,x,typeSpec,varargin)
236  import mxberry.core.check.lib.*;
237  if isempty(errorTag)
238  errorTag=':wrongInput';
239  end
240  if isempty(errorMessage)
241  addArgList={};
242  else
243  addArgList={errorMessage};
244  end
245  self.runAndCheckError(...
246  ['mxberry.core.checkvar(x,',...
247  'typeSpec,varargin{:})'],...
248  errorTag,addArgList{:});
249  if ischar(typeSpec)
250  fHandle=eval(['@(x)(',typeSpec,')']); %#ok<NASGU>
251  else
252  fHandle=typeSpec; %#ok<NASGU>
253  end
254  %
255  self.runAndCheckError(...
256  ['mxberry.core.checkvar(x,',...
257  'fHandle,varargin{:})'],...
258  errorTag,addArgList{:});
259  end
260  %
261  function checkP(x,typeSpec,varargin)
262  import mxberry.core.check.lib.*;
263  mxberry.core.checkvar(x,typeSpec,varargin{:});
264  if ischar(typeSpec)
265  fHandle=eval(['@(x)(',typeSpec,')']);
266  else
267  fHandle=typeSpec;
268  end
269  mxberry.core.checkvar(x,fHandle,varargin{:});
270  end
271 
272  end
273  %
274 
275  function testThrowWarn(self)
276  check('wrongInput','test message');
277  check('wrongInput',...
278  'test \n message C:\\SomeFolder\\sdf/sdf/sdfsdf');
279  function check(identifier,message)
280  ID_STR=...
281  ['MXBERRY:CORE:TEST:MLUNIT_TEST_COMMON:TESTTHROWWARN:',...
282  identifier];
283  %
284  lastwarn('');
285  s=warning('off',...
286  'MXBERRY:CORE:TEST:MLUNIT_TEST_COMMON:TESTTHROWWARN:wrongInput');
287  mxberry.core.throwwarn('wrongInput',message);
288  warning(s);
289  [lastMsg,lastId]=lastwarn();
290  self.verifyEqual(true,isequal(sprintf(message),lastMsg));
291  self.verifyEqual(true,isequal(ID_STR,lastId));
292  end
293  end
294  function self=testThrowError(self)
295  check('wrongInput','test message');
296  check('wrongInput',...
297  'test \\ message C:\\SomeFolder\\sdf/sdf/sdfsdf');
298  function check(identifier,message)
299  meExpObj=mxberry.core.throwerror(identifier,message);
300  try
301  mxberry.core.throwerror(identifier,message);
302  catch meObj
303  self.verifyEqual(true,isequal(meObj.identifier,meExpObj.identifier));
304  self.verifyEqual(true,isequal(meObj.message,meExpObj.message));
305  self.verifyEqual(true,isequal(meObj.cause,meExpObj.cause));
306  end
307  end
308  end
309  function testGenFileName(self)
310  resStr=mxberry.core.genfilename('sdfsdfsdf.;:sdfd');
311  expStr='sdfsdfsdf.;_sdfd';
312  self.verifyEqual(true,isequal(resStr,expStr));
313  end
314  function testInd2SubMat(self)
315  sizeVec=[2,3];
316  indVec=1:6;
317  %
318  nDims=length(sizeVec);
319  indSubList=cell(1,nDims);
320  indMat=mxberry.core.ind2submat(sizeVec,indVec);
321  [indSubList{:}]=ind2sub(sizeVec,indVec.');
322  indExpMat=[indSubList{:}];
323  self.verifyEqual(true,isequal(indMat,indExpMat));
324  end
325  %
326  function self=test_ismembercellstr(self)
327  import mxberry.core.ismembercellstr;
328  aList={'asdfsdf','sdfsfd','sdfsdf','sdf'};
329  bList={'sdf','sdfsdf','ssdfsfsdfsd','sdf'};
330  [isTVec,indLVec]=ismember(aList,bList,'legacy');
331  [isTOVec,indLOVec]=ismembercellstr(aList,bList,true);
332  self.verifyEqual(true,isequal(isTVec,isTOVec));
333  self.verifyEqual(true,isequal(indLVec,indLOVec));
334  %
335  [isTOVec,indLOVec]=ismembercellstr(aList,bList);
336  self.verifyEqual(true,isequal([false false true true],isTOVec));
337  self.verifyEqual(true,isequal([0 0 2 1],indLOVec));
338  %
339  [isTOVec,indLOVec]=ismembercellstr(aList,'sdfsfd');
340  self.verifyEqual(true,isequal([false true false false],isTOVec));
341  self.verifyEqual(true,isequal([0 1 0 0],indLOVec));
342  %
343  [isTOVec,indLOVec]=ismembercellstr('sdfsfd',aList);
344  self.verifyEqual(true,isequal(true,isTOVec));
345  self.verifyEqual(true,isequal(2,indLOVec));
346  [isTOVec,indLOVec]=ismembercellstr('sdfsfd','sdfsfd');
347  self.verifyEqual(true,isTOVec);
348  self.verifyEqual(indLOVec,1);
349  [isTOVec,indLOVec]=ismembercellstr('sdfsfd','sdfsf');
350  self.verifyEqual(false,isTOVec);
351  self.verifyEqual(indLOVec,0);
352  %
353  [isTOVec,indLOVec]=ismembercellstr('alpha',{'a','b','c'});
354  self.verifyEqual(false,isTOVec);
355  self.verifyEqual(indLOVec,0);
356  %
357  [isTOVec,indLOVec]=ismembercellstr({'a','b','c'},'alpha');
358  self.verifyEqual(true,isequal(false(1,3),isTOVec));
359  self.verifyEqual(true,isequal(zeros(1,3),indLOVec));
360  %
361  end
362  function self=test_isunique(self)
363  self.verifyEqual(false,mxberry.core.isunique([1 1]));
364  self.verifyEqual(true,mxberry.core.isunique([1 2]));
365  end
366  function self=test_cell2tablestr(self)
367  fNeg=@()check(1000,-1,{'1000'});
368  self.runAndCheckError(fNeg,'wrongInput');
369  check(1000,4,{'1000'});
370  check(1000,3,{'1e+003','1e+03'});
371  function check(value,numPrecision,expStr)
372  resStr=mxberry.core.cell.cell2tablestr([],num2cell(value),'_',...
373  'numPrecision',numPrecision);
374  self.verifyEqual(true,any(strcmp(expStr,resStr)));
375  end
376  end
377 
378  function self = test_cellfunallelem(self)
379  inpCell=repmat({rand(7,7,7)<10},4*500,2);
380  %
381  self.aux_test_cellfunallelem(inpCell,@all);
382  self.aux_test_cellfunallelem(inpCell,@any);
383  %
384  inpCell=repmat({rand(7,7,7)},4*500,2);
385  self.aux_test_cellfunallelem(inpCell,@max);
386  self.aux_test_cellfunallelem(inpCell,@min);
387  end
388  end
389  methods
390  function self=aux_test_cellfunallelem(self,inpCell,hFunc)
391  import mxberry.core.cellfunallelem;
392  %tic;
393  res=cellfunallelem(hFunc,inpCell);
394  %toc;
395  resCheck=cellfun(@(x)hFunc(x(:)),inpCell);
396  self.verifyEqual(isequal(res,resCheck),true);
397  %
398  %tic;
399  res=cellfunallelem(hFunc,inpCell,'UniformOutput',false);
400  %toc;
401  resCheck=cellfun(@(x)hFunc(x(:)),inpCell,'UniformOutput',false);
402  self.verifyEqual(isequal(res,resCheck),true);
403  end
404  end
405  methods (Test)
406  %
407  function self=test_subreffrontdim(self)
408  inp=[1 2;3 4];
409  res=mxberry.core.subreffrontdim(inp,1);
410  self.verifyEqual(res,[1 2]);
411  end
412  %
413  function self=test_num2cell(self)
414  inpArray=rand(3,20);
415  self.aux_test_num2cell(inpArray);
416  %
417  inpMat=rand(2,3,4);
418  resCellEthalon=num2cell(inpMat);
419  resCell=mxberry.core.num2cell(inpMat);
420  self.verifyEqual(true,isequal(resCell,resCellEthalon));
421  end
422  %
423  function self=test_num2cell_empty(self)
424  inpArray=zeros(3,0);
425  self.aux_test_num2cell(inpArray);
426  end
427  %
428  end
429  methods
430  function self=aux_test_num2cell(self,inpArray)
431  resCellEthalon={inpArray(1,:);inpArray(2,:);inpArray(3,:)};
432  resCell=mxberry.core.num2cell(inpArray,2);
433  self.verifyEqual(true,isequal(resCell,resCellEthalon));
434  %
435  end
436  end
437  methods(Test)
438  function self=test_iscelllogical(self)
439  isTrue=mxberry.core.iscelllogical({true,false});
440  self.verifyEqual(true,isTrue);
441  isTrue=mxberry.core.iscelllogical({});
442  self.verifyEqual(false,isTrue);
443  end
444  end
445  methods
446  function self=aux_test_iscellnumeric(self,isOk,isEmpty)
447  sizeVec=[1 1];
448  typeList={'single','double','int8','int16','int32','int64'};
449  for iType=1:length(typeList)
450  obj={mxberry.core.createarray(typeList{iType},sizeVec)};
451  if isEmpty
452  obj(:)=[];
453  end
454 
455  isTrue=mxberry.core.iscellnumeric(obj);
456  self.verifyEqual(isOk,isTrue,...
457  ['failed for type ',typeList{iType}]);
458  end
459  end
460  end
461  methods (Test)
462  function self=test_iscellnumeric(self)
463  self.aux_test_iscellnumeric(true,false);
464  self.aux_test_iscellnumeric(false,true);
465  end
466  %
467  function self=test_isvec(self)
468  isPositive=mxberry.core.iscol(rand(10,1));
469  self.verifyEqual(isPositive,true);
470  %
471  isPositive=mxberry.core.iscol(rand(10,2));
472  self.verifyEqual(isPositive,false);
473  %
474  isPositive=mxberry.core.iscol(zeros(0,1));
475  self.verifyEqual(isPositive,true);
476  %
477  isPositive=mxberry.core.iscol(zeros(1,0));
478  self.verifyEqual(isPositive,false);
479  %
480  isPositive=mxberry.core.iscol(zeros(0,0));
481  self.verifyEqual(isPositive,false);
482  %
483  isPositive=mxberry.core.isvec(rand(10,1));
484  self.verifyEqual(isPositive,true);
485  isPositive=mxberry.core.isvec(rand(1,10));
486  self.verifyEqual(isPositive,true);
487  isPositive=mxberry.core.isvec(rand(1,1,10));
488  self.verifyEqual(isPositive,false);
489  %
490  self.verifyEqual(mxberry.core.isrow(rand(10,1)),false);
491  self.verifyEqual(mxberry.core.isrow(rand(1,10)),true);
492  self.verifyEqual(mxberry.core.isrow([]),false);
493  %
494  self.verifyEqual(mxberry.core.isrow(zeros(0,1)),false);
495  self.verifyEqual(mxberry.core.isrow(zeros(1,0)),true);
496  %
497  self.verifyEqual(mxberry.core.iscol(rand(10,1)),true);
498  self.verifyEqual(mxberry.core.iscol(rand(1,10)),false);
499  self.verifyEqual(mxberry.core.iscol([]),false);
500  %
501  self.verifyEqual(mxberry.core.isrow(rand(1,1,2)),false);
502  end
503  function self=test_error(self)
504  inpArgList={'myTag','myMessage %d',1}; %#ok<NASGU>
505  self.runAndCheckError(...
506  'mxberry.core.test.aux.testerror(inpArgList{:})',...
507  'MXBERRY:CORE:TEST:AUX:TESTERROR:myTag','myMessage 1');
508  end
509  function test_parseparext_touch(~)
510  [reg,isRegSpec,putStorageHook,getStorageHook]=...
511  mxberry.core.parseparext(...
512  {},{...
513  'putStorageHook','getStorageHook';...
514  @(x,y)x,@(x,y)x;...
515  @(x)isa(x,'function_handle'),@(x)isa(x,'function_handle')},...
516  'regCheckList',...
517  {@(x)isa(x,...
518  'mxberry.core.struct.AStructChangeTracker')}); %#ok<ASGLU>
519  end
520  function self=test_parseparext_obligprop(self)
521  inpProp={1,'aa',1,'bb',2,'cc',3};
522  isObligatoryPropVec=[false false false];
523  check();
524  isObligatoryPropVec=[false false true];
525  self.runAndCheckError(@check,':wrong');
526  function check()
527  [reg,isRegSpec,prop,isPropSpec]=...
528  mxberry.core.parseparext(inpProp,{'aa','bb','dd'},...
529  'propRetMode','list','isObligatoryPropVec',...
530  isObligatoryPropVec); %#ok<ASGLU>
531  end
532  end
533  function test_parseparams_duplicate(self)
534  self.runAndCheckError(@check,...
535  'wrongInput:duplicatePropertiesSpec');
536  self.runAndCheckError(@check1,...
537  'wrongInput:duplicatePropertiesSpec');
538  function check()
539  mxberry.core.parseparams(...
540  {1,2,'prop1',1,'prop2',2,'prop2',3},{'prop1','prop2'},[0 2]);
541  end
542  function check1()
543  mxberry.core.parseparams(...
544  {1,2,'prop1',1,'prop2',2,'prop2',3});
545  end
546  end
547  function test_parseparext_isdefspecvec(self)
548  self.runAndCheckError(@check,...
549  'wrongInput:defPropSpecVecNotInListMode');
550  self.runAndCheckError(@check2,...
551  'wrongInput:defPropSpecVecNoDefValues');
552  %
553  [regList,isRegSpecVec,propList,isPropSpecVec]=check3();
554  expPropList={'prop1',1,'prop3',2};
555  expRegList={1,2};
556  isExpRegSpecVec=[true,true];
557  isExpPropSpecVec=[true,false,false];
558  %
559  expCompare();
560  %
561  [regList,isRegSpecVec,propList,isPropSpecVec]=check4();
562  %
563  expPropList={'prop1',1,'prop2',1,'prop3',2};
564  %
565  expCompare();
566  function expCompare()
567  self.verifyEqual(true,isequal(expRegList,regList));
568  self.verifyEqual(true,isequal(expPropList,propList));
569  self.verifyEqual(true,isequal(isExpRegSpecVec,isRegSpecVec));
570  self.verifyEqual(true,isequal(isExpPropSpecVec,isPropSpecVec));
571  end
572  function check()
573  mxberry.core.parseparext(...
574  {1,2,'prop1',1},...
575  {'prop1','prop2','prop3';...
576  [],1,2},'isDefaultPropSpecVec',[false,false,true],'propRetMode','separate');
577  end
578  function check2()
579  mxberry.core.parseparext(...
580  {1,2,'prop1',1},...
581  {'prop1','prop2','prop3'},'isDefaultPropSpecVec',[false,false,true],'propRetMode','list');
582  end
583  function [regList,isRegSpec,propList,isPropSpec]=check3()
584  [regList,isRegSpec,propList,isPropSpec]=mxberry.core.parseparext(...
585  {1,2,'prop1',1},...
586  {'prop1','prop2','prop3';...
587  [],1,2},'isDefaultPropSpecVec',[false,false,true],'propRetMode','list');
588  end
589  function [regList,isRegSpec,propList,isPropSpec]=check4()
590  [regList,isRegSpec,propList,isPropSpec]=mxberry.core.parseparext(...
591  {1,2,'prop1',1},...
592  {'prop1','prop2','prop3';...
593  [],1,2},'propRetMode','list');
594  end
595  end
596  function test_parseparext_duplicate(self)
597  self.runAndCheckError(@check,...
598  'wrongInput:duplicatePropertiesSpec');
599  self.runAndCheckError(@check1,...
600  'wrongInput:duplicatePropertiesSpec');
601  function check()
602  mxberry.core.parseparext(...
603  {1,2,'prop1',1,'prop2',2,'prop2',3},{'prop1','prop2'},[0 2]);
604  end
605  function check1()
606  mxberry.core.parseparext(...
607  {1,2,'prop1',1,'prop2',2,'prop2',3},[],[0 2],...
608  'propRetMode','list');
609  end
610  mxberry.core.parseparext({'prop0',1,'prop1',1,'prop2',2},...
611  {'prop1','prop2'},[0 2]);
612  end
613  function self=test_parseparext_simple(self)
614  inpReg={1};
615  inpFirstProp={'aa',1};
616  inpSecProp={'bb',2,'cc',3};
617  inpProp=[inpFirstProp,inpSecProp];
618  self.runAndCheckError(...
619  'mxberry.core.parseparext(inpReg,[],''propRetMode'',''separate'')',...
620  ':wrong');
621  %
622  [reg,isRegSpec,prop,isPropSpec]=...
623  mxberry.core.parseparext([inpReg,inpProp],[],...
624  'propRetMode','list');
625  self.verifyEqual(3,length(isPropSpec));
626  self.verifyEqual(true,all(isPropSpec));
627  self.verifyEqual(true,isRegSpec);
628  self.verifyEqual(true,isequal(reg,inpReg));%
629  self.verifyEqual(true,isequal(prop,inpProp));%
630  %
631  [reg,isRegSpec,prop,isPropSpec]=...
632  mxberry.core.parseparext([inpReg,inpProp],{'bb','cc'},...
633  'propRetMode','list');
634  self.verifyEqual([true,true,true],isRegSpec);
635  self.verifyEqual(true,isequal(reg,[inpReg,inpFirstProp]));%
636  self.verifyEqual(true,isequal(prop,inpSecProp));%
637  self.verifyEqual(true,all(isPropSpec));
638  self.verifyEqual(2,length(isPropSpec));
639  %
640  [reg,isRegSpec,prop,isPropSpec]=...
641  mxberry.core.parseparext({},{'bb','cc'},...
642  'propRetMode','list');
643  self.verifyEqual(true,isempty(reg));
644  self.verifyEqual(true,isempty(prop));
645  self.verifyEqual(true,isempty(isRegSpec));
646  self.verifyEqual(false,any(isPropSpec));
647  self.verifyEqual(2,length(isPropSpec));
648  %
649  [reg,isRegSpec,prop,isPropSpec]=...
650  mxberry.core.parseparext({},[],...
651  'propRetMode','list');
652  self.verifyEqual(true,isempty(reg));
653  self.verifyEqual(true,isempty(prop));
654  self.verifyEqual(true,isempty(isRegSpec));
655  self.verifyEqual(true,isempty(isPropSpec));
656  %
657  nRegs=1;
658  regDefList={1,3};
659  nRegExpMax=[0,2];
660  initInpArgList={1,'joinByInst',true,'keepJoinId',true};
661  propCheckMat={'joinByInst','keepJoinId';...
662  false,false;...
663  'isscalar(x)&&islogical(x)','isscalar(x)&&islogical(x)'};
664  %
665  checkMaster();
666  nRegExpMax=[1,2];
667  checkMaster();
668  %
669  nRegExpMax=[0,1];
670  checkN('regCheckList',{'true','true'});
671  nRegExpMax=1;
672  checkN('regCheckList',{'true','true'});
673  %
674  propCheckMat={'joinByInst','keepJoinId';...
675  false,false;...
676  @(x)isscalar(x)&&islogical(x),...
677  @(x)isscalar(x)&&islogical(x)};
678  nRegExpMax=[0,2];
679  checkMaster();
680  nRegExpMax=[1,2];
681  checkMaster();
682  nRegExpMax=[0,2];
683  nRegs=0;
684  initInpArgList={'joinByInst',true,'keepJoinId',true};
685  checkMaster();
686  %
687  function checkMaster()
688  checkP();
689  checkP('regCheckList',{'true'});
690  checkP('regCheckList',{@true});
691  checkN('regCheckList','true');
692  if nRegs>=1
693  checkN('regCheckList',{'false'});
694  end
695  checkP('regCheckList',{'true','true'});
696  checkP('regCheckList',{@true,@true});
697  end
698  function checkN(varargin)
699  inpArgList={initInpArgList,propCheckMat,nRegExpMax,...
700  varargin{:}}; %#ok<CCAT,NASGU>
701  self.runAndCheckError(...
702  'mxberry.core.parseparext(inpArgList{:})',...
703  ':wrong');
704  end
705  function checkP(varargin)
706  [reg1,isRegSpec1Vec]=checkPInt(varargin{:});
707  [reg2,isRegSpec2Vec]=checkPInt(varargin{:},'regDefList',regDefList);
708  if nRegs>=1
709  self.verifyEqual(true,isequal(reg1{1},reg2{1}));
710  self.verifyEqual(true,...
711  isequal(isRegSpec1Vec(1),isRegSpec2Vec(1)));
712  end
713  self.verifyEqual(false,isRegSpec2Vec(2));
714  self.verifyEqual(true,isequal(nRegs,length(isRegSpec1Vec)));
715  self.verifyEqual(true,isequal(2,length(isRegSpec2Vec)));
716  self.verifyEqual(true,isequal(nRegs,length(reg1)));
717  self.verifyEqual(true,isequal(2,length(reg2)));
718  self.verifyEqual(true,isequal(3,reg2{2}));
719  %
720  inpArgList={initInpArgList,...
721  varargin{:},'regDefList',[regDefList,4]}; %#ok<CCAT,NASGU>
722  self.runAndCheckError(...
723  'mxberry.core.parseparext(inpArgList{:})',...
724  ':wrong');
725  %
726  function [reg,isRegSpecVec]=checkPInt(varargin)
727  [reg,isRegSpecVec,isJoinByInst,isJoinIdKept]=...
728  mxberry.core.parseparext(initInpArgList,...
729  propCheckMat,nRegExpMax,...
730  varargin{:});
731  if nRegs>=1
732  self.verifyEqual(true,isRegSpecVec(1));
733  self.verifyEqual(true,isequal(reg(1:nRegs),{1}));
734  else
735  [~,prop]=mxberry.core.parseparams(varargin,{'regDefList'});
736  if isempty(prop)
737  self.verifyEqual(true,isempty(isRegSpecVec));
738  self.verifyEqual(true,isempty(reg));
739  else
740  self.verifyEqual(false,any(isRegSpecVec))
741  self.verifyEqual(length(prop{2}),...
742  length(reg));
743  end
744  end
745  %
746  self.verifyEqual(true,isJoinByInst);
747  self.verifyEqual(true,isJoinIdKept);
748  end
749  end
750 
751  end
752  function self=test_parseparams(self)
753  [reg,prop]=getparse({'alpha'});
754  self.verifyEqual(true,isequal(reg,{'alpha'}));
755  self.verifyEqual(true,isequal(prop,{}));
756  %
757  [reg,prop]=getparse({'alpha','beta',1});
758  self.verifyEqual(true,isequal(reg,{'alpha'}));
759  self.verifyEqual(true,isequal(prop,{'beta',1}));
760  %
761  [reg,prop]=getparse({'alpha',1,3,'beta',1});
762  self.verifyEqual(true,isequal(reg,{'alpha',1,3}));
763  self.verifyEqual(true,isequal(prop,{'beta',1}));
764  %
765  [reg,prop]=getparse({'alpha',1,3,'beta',1},{'alpha'});
766  self.verifyEqual(true,isequal(reg,{3,'beta',1}));
767  self.verifyEqual(true,isequal(prop,{'alpha',1}));
768  %
769  [reg,prop]=getparse({'alpha',1,3,'beta',1},{});
770  self.verifyEqual(true,isequal(reg,{'alpha',1,3,'beta',1}));
771  self.verifyEqual(true,isequal(prop,{}));
772  %
773  [reg,prop]=getparse({'alpha',1,3,'beta',1,'gamma',1},'gamma');
774  self.verifyEqual(true,isequal(reg,{'alpha',1,3,'beta',1}));
775  self.verifyEqual(true,isequal(prop,{'gamma',1}));
776  %
777  [reg,prop]=getparse({'alpha',1,3,'gamma',1,'beta',1},'gamma');
778  self.verifyEqual(true,isequal(reg,{'alpha',1,3,'beta',1}));
779  self.verifyEqual(true,isequal(prop,{'gamma',1}));
780  %
781  [reg,prop]=getparse({'alpha',1,3,'beta',1,'gamma',1},'Gamma');
782  self.verifyEqual(true,isequal(reg,{'alpha',1,3,'beta',1}));
783  self.verifyEqual(true,isequal(prop,{'gamma',1}));
784  %
785  [reg,prop]=getparse({'alpha',1},'beta');
786  self.verifyEqual(true,isequal(reg,{'alpha',1}));
787  self.verifyEqual(true,isequal(prop,{}));
788  %
789  [reg,prop]=getparse({'alpha',1},'beta',[0 2]);
790  self.verifyEqual(true,isequal(reg,{'alpha',1}));
791  self.verifyEqual(true,isequal(prop,{}));
792  %
793  [reg,prop]=getparse({1,'alpha'},'alpha');
794  self.verifyEqual(true,isequal(reg,{1,'alpha'}));
795  self.verifyEqual(true,isequal(prop,{}));
796  %
797  [reg,prop]=getparse(...
798  {1,'alpha',3,'beta',3,'gamma'},{'alpha','gamma'});
799  self.verifyEqual(true,isequal(reg,{1,'beta',3,'gamma'}));
800  self.verifyEqual(true,isequal(prop,{'alpha',3}));
801  function [reg,prop]=getparse(argList,varargin)
802  if (nargin>1)
803  propInpNameList=varargin{1};
804  if isnumeric(propInpNameList)&&isempty(propInpNameList)
805  isPropNameSpec=false;
806  else
807  if ischar(propInpNameList)
808  propInpNameList={lower(propInpNameList)};
809  else
810  propInpNameList=lower(propInpNameList);
811  end
812  isPropNameSpec=true;
813  end
814  else
815  isPropNameSpec=false;
816  end
817  %
818  [reg,prop]=mxberry.core.parseparams(argList,varargin{:});
819  %
820  if isPropNameSpec&&numel([varargin{:}])>0
821  nPairs=length(propInpNameList);
822  outCell=cell(1,2*nPairs);
823  [reg1,~,outCell{:}]=...
824  mxberry.core.parseparext(argList,varargin{:});
825  %
826  [propValList,isSpecVec]=getval(outCell);
827  %
828  propNameList=propInpNameList;
829  %
830  self.verifyEqual(true,isequal(reg,reg1));
831  isEqual=isequal(propNameList,...
832  propInpNameList)||isempty(propNameList)&&...
833  isempty(propInpNameList);
834  self.verifyEqual(true,isEqual);
835  pNameList=propNameList(isSpecVec);
836  pValList=propValList(isSpecVec);
837  inpArgList=[pNameList;pValList];
838  s1=struct(inpArgList{:});
839  s2=struct(prop{:});
840  isEqual=isequal(s1,s2);
841  self.verifyEqual(true,isEqual);
842  %
843  if ~all(isSpecVec)
844  defValList=num2cell(rand(size(propNameList)));
845  [reg2,~,outCell{:}]=...
846  mxberry.core.parseparext(argList,...
847  [propNameList;defValList],varargin{2:end});
848  self.verifyEqual(true,isequal(reg,reg2));
849  [propValList,isSpecVec]=getval(outCell);
850  isEqual=isequal(propValList(~isSpecVec),...
851  defValList(~isSpecVec));
852  self.verifyEqual(true,isEqual);
853  %
854  checkStrList=repmat({'false'},size(defValList));
855  checkStrList(isSpecVec)={'true'};
856  [reg3,~,outCell{:}]=...
857  mxberry.core.parseparext(argList,...
858  [propNameList;defValList;...
859  checkStrList],varargin{2:end});
860  [propValList3,isSpecVec3]=getval(outCell);
861  self.verifyEqual(true,isequal(reg,reg3));
862  self.verifyEqual(true,isequal(propValList3,propValList));
863  self.verifyEqual(true,isequal(isSpecVec,isSpecVec3));
864  end
865  end
866  %
867  function [propValList,isSpecVec]=getval(outCell)
868  propValList=outCell(1:nPairs);
869  isSpecVec=[outCell{nPairs+1:nPairs*2}];
870  end
871  end
872  end
873  function self=test_parseparams_negative(self)
874  inpArgList={'alpha',1,3,'beta',1,'gamma',1};
875  %
876  [reg1,prop1]=mxberry.core.parseparams(inpArgList);
877  [reg2,prop2]=mxberry.core.parseparams(inpArgList,[]);
878  %
879  self.verifyEqual(true,isequal(reg1,reg2));
880  self.verifyEqual(true,isequal(prop1,prop2));
881  %
882  self.runAndCheckError(...
883  'mxberry.core.parseparams(inpArgList,[],0);',...
884  ':wrongParamList');
885  mxberry.core.parseparams(inpArgList,[],3);
886  mxberry.core.parseparams(inpArgList,[],3,[]);
887  mxberry.core.parseparams(inpArgList,[],3,2);
888  mxberry.core.parseparams(inpArgList,[],[],2);
889  mxberry.core.parseparams(inpArgList,[],[3,3]);
890  mxberry.core.parseparams(inpArgList,[],[3,3],[]);
891  mxberry.core.parseparams(inpArgList,[],[3,6],2);
892  mxberry.core.parseparams(inpArgList,[],[0,3],2);
893  self.runAndCheckError(...
894  'mxberry.core.parseparams(inpArgList,[],3,3);',...
895  ':wrongParamList');
896  %
897  self.runAndCheckError(...
898  'mxberry.core.parseparams(inpArgList,[],[0,3],2.5);',...
899  ':wrongInput');
900  %
901  self.runAndCheckError(...
902  'mxberry.core.parseparams(inpArgList,[],[],3);',...
903  ':wrongParamList');
904  self.runAndCheckError(...
905  'mxberry.core.parseparams(inpArgList,[],3.5,3);',...
906  ':wrongInput');
907  self.runAndCheckError(...
908  'mxberry.core.parseparams(inpArgList,[],[-3 3],2);',...
909  ':wrongInput');
910  self.runAndCheckError(...
911  'mxberry.core.parseparams(inpArgList,[],[3.5 3.4],3);',...
912  ':wrongInput');
913  self.runAndCheckError(...
914  'mxberry.core.parseparams(inpArgList,[],[3.5 3.4],3);',...
915  ':wrongInput');
916  self.runAndCheckError(...
917  'mxberry.core.parseparams(inpArgList,[],[4 4],2);',...
918  ':wrongParamList');
919  self.runAndCheckError(...
920  'mxberry.core.parseparams(inpArgList,[],[4 6],2);',...
921  ':wrongParamList');
922  self.runAndCheckError(...
923  'mxberry.core.parseparams(inpArgList,[],[0 2],2);',...
924  ':wrongParamList');
925  end
926  function self=test_getfirstdimsize(self)
927  expSizeVec=[2,3];
928  inpArray=rand([expSizeVec,4,5]);
929  self.verifyEqual(expSizeVec,...
930  mxberry.core.getfirstdimsize(inpArray,2));
931  expSizeVec=[2,3,1];
932  inpArray=rand([expSizeVec,1,1]);
933  self.verifyEqual(expSizeVec,...
934  mxberry.core.getfirstdimsize(inpArray,3));
935  self.verifyEqual([expSizeVec,[1 1]],...
936  mxberry.core.getfirstdimsize(inpArray,5));
937  self.verifyEqual(true,...
938  isempty(mxberry.core.getfirstdimsize(inpArray,0)));
939  self.runAndCheckError(...
940  'mxberry.core.getfirstdimsize(inpArray,-1)',...
941  ':wrongInput');
942  %
943  end
944  function self=test_checksize(self)
945 
946  self.verifyEqual(true,mxberry.core.checksize(rand(2,3),[2,3,1]));
947  self.verifyEqual(true,mxberry.core.checksize(rand(2,3),[2,3]));
948  self.verifyEqual(false,mxberry.core.checksize(rand(2,4),[2,3]));
949  self.verifyEqual(false,mxberry.core.checksize(rand(2,4,5),[2,4]));
950  self.verifyEqual(true,mxberry.core.checksize([],[]));
951  self.verifyEqual(false,mxberry.core.checksize(1,[]));
952  end
953  function self=test_cat(self)
954  typeList={'int8','double','logical','struct'};
955  for iType=1:length(typeList)
956  for jType=1:length(typeList)
957  iObj=mxberry.core.createarray(typeList{iType},[]);
958  jObj=mxberry.core.createarray(typeList{jType},[]);
959  res=mxberry.core.cat(1,iObj,jObj);
960  self.verifyEqual(true,...
961  isa(res,typeList{iType}));
962  end
963  end
964  end
965  function self=test_getcallernameext(self)
966  testClassA=GetCallerNameExtTestClassA;
967  [methodName,className]=getCallerInfo(testClassA); %#ok<*NCOMMA>
968  self.verifyEqual(true,...
969  isequal(methodName,'GetCallerNameExtTestClassA')&&...
970  isequal(className,'GetCallerNameExtTestClassA'));
971  testClassA=simpleMethod(testClassA);
972  [methodName,className]=getCallerInfo(testClassA);
973  self.verifyEqual(true,...
974  isequal(methodName,'simpleMethod')&&...
975  isequal(className,'GetCallerNameExtTestClassA'));
976  testClassA=subFunctionMethod(testClassA);
977  [methodName,className]=getCallerInfo(testClassA);
978  self.verifyEqual(true,...
979  isequal(methodName,'subFunctionMethod/subFunction')&&...
980  isequal(className,'GetCallerNameExtTestClassA'));
981  testClassA=subFunctionMethod2(testClassA);
982  [methodName,className]=getCallerInfo(testClassA);
983  self.verifyEqual(true,...
984  isequal(methodName,'subFunctionMethod2/subFunction')&&...
985  isequal(className,'GetCallerNameExtTestClassA'));
986  testClassA=subFunctionMethod3(testClassA);
987  [methodName,className]=getCallerInfo(testClassA);
988  self.verifyEqual(true,...
989  isequal(methodName,'subFunctionMethod3/subFunction/subFunction2')&&...
990  isequal(className,'GetCallerNameExtTestClassA'));
991  %
992  testClassB=GetCallerNameExtTestClassB;
993  [methodName,className]=getCallerInfo(testClassB);
994  self.verifyEqual(true,...
995  isequal(methodName,'GetCallerNameExtTestClassB')&&...
996  isequal(className,'GetCallerNameExtTestClassB'));
997  simpleMethod(testClassB);
998  [methodName,className]=getCallerInfo(testClassB);
999  self.verifyEqual(true,...
1000  isequal(methodName,'simpleMethod')&&...
1001  isequal(className,'GetCallerNameExtTestClassB'));
1002  subFunctionMethod(testClassB);
1003  [methodName,className]=getCallerInfo(testClassB);
1004  self.verifyEqual(true,...
1005  isequal(methodName,'subFunctionMethod/subFunction')&&...
1006  isequal(className,'GetCallerNameExtTestClassB'));
1007  subFunctionMethod2(testClassB);
1008  [methodName,className]=getCallerInfo(testClassB);
1009  self.verifyEqual(true,...
1010  isequal(methodName,'subFunctionMethod2/subFunction')&&...
1011  isequal(className,'GetCallerNameExtTestClassB'));
1012  subFunctionMethod3(testClassB);
1013  [methodName,className]=getCallerInfo(testClassB);
1014  self.verifyEqual(true,...
1015  isequal(methodName,'subFunctionMethod3/subFunction/subFunction2')&&...
1016  isequal(className,'GetCallerNameExtTestClassB'));
1017  %
1018  testClassB=getcallernameexttest.GetCallerNameExtTestClassB;
1019  [methodName,className]=getCallerInfo(testClassB);
1020  self.verifyEqual(true,...
1021  isequal(methodName,'GetCallerNameExtTestClassB')&&...
1022  isequal(className,'getcallernameexttest.GetCallerNameExtTestClassB'));
1023  simpleMethod(testClassB);
1024  [methodName,className]=getCallerInfo(testClassB);
1025  self.verifyEqual(true,...
1026  isequal(methodName,'simpleMethod')&&...
1027  isequal(className,'getcallernameexttest.GetCallerNameExtTestClassB'));
1028  subFunctionMethod(testClassB);
1029  [methodName,className]=getCallerInfo(testClassB);
1030  self.verifyEqual(true,...
1031  isequal(methodName,'subFunctionMethod/subFunction')&&...
1032  isequal(className,'getcallernameexttest.GetCallerNameExtTestClassB'));
1033  subFunctionMethod2(testClassB);
1034  [methodName,className]=getCallerInfo(testClassB);
1035  self.verifyEqual(true,...
1036  isequal(methodName,'subFunctionMethod2/subFunction')&&...
1037  isequal(className,'getcallernameexttest.GetCallerNameExtTestClassB'));
1038  subFunctionMethod3(testClassB);
1039  [methodName,className]=getCallerInfo(testClassB);
1040  self.verifyEqual(true,...
1041  isequal(methodName,'subFunctionMethod3/subFunction/subFunction2')&&...
1042  isequal(className,'getcallernameexttest.GetCallerNameExtTestClassB'));
1043  %
1044  testClassC=GetCallerNameExtTestClassC;
1045  [methodName,className]=getCallerInfo(testClassC);
1046  self.verifyEqual(true,...
1047  isequal(methodName,'GetCallerNameExtTestClassB')&&...
1048  isequal(className,'GetCallerNameExtTestClassB'));
1049  testClassC=GetCallerNameExtTestClassC(false);
1050  [methodName,className]=getCallerInfo(testClassC);
1051  self.verifyEqual(true,...
1052  isequal(methodName,'GetCallerNameExtTestClassC')&&...
1053  isequal(className,'GetCallerNameExtTestClassC'));
1054  simpleMethod(testClassC);
1055  [methodName,className]=getCallerInfo(testClassC);
1056  self.verifyEqual(true,...
1057  isequal(methodName,'simpleMethod')&&...
1058  isequal(className,'GetCallerNameExtTestClassC'));
1059  subFunctionMethod(testClassC);
1060  [methodName,className]=getCallerInfo(testClassC);
1061  self.verifyEqual(true,...
1062  isequal(methodName,'subFunctionMethod/subFunction')&&...
1063  isequal(className,'GetCallerNameExtTestClassC'));
1064  subFunctionMethod2(testClassC);
1065  [methodName,className]=getCallerInfo(testClassC);
1066  self.verifyEqual(true,...
1067  isequal(methodName,'subFunctionMethod2/subFunction')&&...
1068  isequal(className,'GetCallerNameExtTestClassB'));
1069  subFunctionMethod3(testClassC);
1070  [methodName,className]=getCallerInfo(testClassC);
1071  self.verifyEqual(true,...
1072  isequal(methodName,'subFunctionMethod3/subFunction/subFunction2')&&...
1073  isequal(className,'GetCallerNameExtTestClassC'));
1074  %
1075  testClassC=getcallernameexttest.GetCallerNameExtTestClassC;
1076  [methodName,className]=getCallerInfo(testClassC);
1077  self.verifyEqual(true,...
1078  isequal(methodName,'GetCallerNameExtTestClassB')&&...
1079  isequal(className,'getcallernameexttest.GetCallerNameExtTestClassB'));
1080  testClassC=getcallernameexttest.GetCallerNameExtTestClassC(false);
1081  [methodName,className]=getCallerInfo(testClassC);
1082  self.verifyEqual(true,...
1083  isequal(methodName,'GetCallerNameExtTestClassC')&&...
1084  isequal(className,'getcallernameexttest.GetCallerNameExtTestClassC'));
1085  simpleMethod(testClassC);
1086  [methodName,className]=getCallerInfo(testClassC);
1087  self.verifyEqual(true,...
1088  isequal(methodName,'simpleMethod')&&...
1089  isequal(className,'getcallernameexttest.GetCallerNameExtTestClassC'));
1090  subFunctionMethod(testClassC);
1091  [methodName,className]=getCallerInfo(testClassC);
1092  self.verifyEqual(true,...
1093  isequal(methodName,'subFunctionMethod/subFunction')&&...
1094  isequal(className,'getcallernameexttest.GetCallerNameExtTestClassC'));
1095  subFunctionMethod2(testClassC);
1096  [methodName,className]=getCallerInfo(testClassC);
1097  self.verifyEqual(true,...
1098  isequal(methodName,'subFunctionMethod2/subFunction')&&...
1099  isequal(className,'getcallernameexttest.GetCallerNameExtTestClassB'));
1100  subFunctionMethod3(testClassC);
1101  [methodName,className]=getCallerInfo(testClassC);
1102  self.verifyEqual(true,...
1103  isequal(methodName,'subFunctionMethod3/subFunction/subFunction2')&&...
1104  isequal(className,'getcallernameexttest.GetCallerNameExtTestClassC'));
1105  %
1106  methodName='';className='';
1107  s_getcallernameext_test;
1108  self.verifyEqual(true,...
1109  isequal(methodName,'s_getcallernameext_test')&&...
1110  isequal(className,''));
1111  %
1112  methodName='';className='';
1113  getcallernameexttest.s_getcallernameext_test;
1114  self.verifyEqual(true,...
1115  isequal(methodName,'getcallernameexttest.s_getcallernameext_test')&&...
1116  isequal(className,''));
1117  %
1118  [methodName,className]=getcallernameext_simplefunction();
1119  self.verifyEqual(true,...
1120  isequal(methodName,'getcallernameext_simplefunction')&&...
1121  isequal(className,''));
1122  [methodName,className]=getcallernameext_subfunction();
1123  self.verifyEqual(true,...
1124  isequal(methodName,'getcallernameext_subfunction/subfunction')&&...
1125  isequal(className,''));
1126  [methodName,className]=getcallernameext_subfunction2();
1127  self.verifyEqual(true,...
1128  isequal(methodName,'getcallernameext_subfunction2/subfunction')&&...
1129  isequal(className,''));
1130  [methodName,className]=getcallernameext_subfunction3();
1131  self.verifyEqual(true,...
1132  isequal(methodName,'getcallernameext_subfunction3/subfunction/subfunction2')&&...
1133  isequal(className,''));
1134  %
1135  [methodName,className]=getcallernameexttest.getcallernameext_simplefunction();
1136  self.verifyEqual(true,...
1137  isequal(methodName,'getcallernameexttest.getcallernameext_simplefunction')&&...
1138  isequal(className,''));
1139  [methodName,className]=getcallernameexttest.getcallernameext_subfunction();
1140  self.verifyEqual(true,...
1141  isequal(methodName,'getcallernameexttest.getcallernameext_subfunction/subfunction')&&...
1142  isequal(className,''));
1143  [methodName,className]=getcallernameexttest.getcallernameext_subfunction2();
1144  self.verifyEqual(true,...
1145  isequal(methodName,'getcallernameexttest.getcallernameext_subfunction2/subfunction')&&...
1146  isequal(className,''));
1147  [methodName,className]=getcallernameexttest.getcallernameext_subfunction3();
1148  self.verifyEqual(true,...
1149  isequal(methodName,'getcallernameexttest.getcallernameext_subfunction3/subfunction/subfunction2')&&...
1150  isequal(className,''));
1151  end
1152  end
1153 end
function throwerror(in msgTag, in varargin)
THROWERROR works similarly to built-in ERROR function in case when there is no output arguments but s...
function absrelcompare(in leftArr, in rightArr, in absTol, in relTol, in fNormOp)
ABSRELCOMPARE - compares two numerical arrays by user defined norm. For each two corresponding fNormO...
function ind2submat(in sizeVec, in indVec)
IND2SUBMAT works similarly to the built-in ind2sub function but returns all the indices in a single m...
function iscelloffunc(in inpArray)
function iscellofstring(in inpArray)
function throwwarn(in msgTag, in varargin)
THROWWARN works similarly to built-in WARNING function in case when there is no output arguments but ...
function isstring(in inpArray)
function genfilename(in inpStr)
GENFILENAME generates a valid file name based on a given string.