MatrixBerryCore
Suite.m
Go to the documentation of this file.
1 classdef Suite < matlab.unittest.TestCase
2  properties
3  end
4 
5  methods
6  function self = Suite(varargin)
7  self = self@matlab.unittest.TestCase(varargin{:});
8  end
9  %
10  end
11  methods(Test)
12  function test_basicTouch(self)
13  if ~ispc()
14  return;
15  end
16  check(true);
17  check(true,{'titlePrefix','test1'});
18  check(true,{'titlePrefix','test2'});
19  check(false);
20  check(false,{'keepCache',false});
21  check(false,{'keepCache',true});
22  %
23  function check(isProfInfo,inpArgList)
24  profile clear;
26  mxberry.io.rmdir(tmpDir,'s');
27  profile on;
28  checkIfOff(false);
29  profile off;
30  %
31  profile clear;
32  profile on;
33  for k=1:10,cellfun(@(y)cellfun(@(x)x,{1,2,3}),{1,2},...
34  'UniformOutput',false);
35  end
36  %
37  if nargin<2
38  inpArgList={};
39  end
40  %
41  SProfileInfo=profile('info');
42  checkIfOff(true);
43  %
44  if isProfInfo
45  inpArgList=[{0,SProfileInfo},inpArgList];
46  end
48  inpArgList{:});
49  hOut.close();
50  checkIfOff(true);
51  %
53  SProfileInfo,tmpDir);
54  SFiles=dir([tmpDir,filesep,'*.html']);
55  self.verifyEqual(true,numel(SFiles)>2);
56  %
57  function checkIfOff(isOff)
58  SStatus = profile('status');
59  self.verifyEqual(isOff,isequal('off',SStatus.ProfilerStatus));
60  end
61  end
62  end
63  function self=tear_down(self)
64  profile off;
65  end
66  function testRunAndCheckTimeTouch(~)
67  profileMgr=mxberry.dev.prof.ProfileManager();
68  %
69  [~]=profileMgr.runAndProcess(@run);
70  [~]=profileMgr.runAndProcess(@run,'myProfilingCase');
71  [~]=profileMgr.runAndProcess(@run,'myProfilingCase',...
72  'nRuns',3);
73  [~]=profileMgr.runAndProcess(@run,'myProfilingCase',...
74  'nRuns',3,'useMedianTime',true);
75  function run()
76  1+1; %#ok<VUNUS>
77  end
78  end
79  end
80 end
function filesep()
TMPDATAMANAGER provides a basic functionality for managing temporary data folders, root folder name is determined automatically.
Definition: TmpDataManager.m:5
static function getDirByCallerKey(in keyName)
GETDIRBYCALLERKEY returns a unique temporary directory name based on caller name and optionally based...
function profView(in varargin)
PROFVIEW enhances a functionality of Matlab built-in function profview by allowing to display several...
function profSave(in SProfileInfo, in dirName)
PROFSAVE does the same as the built-in profsave function except for displaying the saved report in th...