0001 function result = runElkTest(testCase, mode)
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035 testList.tmpThis = {'polytope/test', 'testPolytopeConversion:testConvertHrepToVrepUnbounded'};
0036 testList.polytopeCore = {'polytope/test', 'testPolytopeCore'};
0037 testList.polytopeConversion = {'polytope/test', 'testPolytopeConversion'};
0038 testList.polytopeOperation = {'polytope/test', 'testPolytopeOperation'};
0039 testList.polytopeView = {'polytope/test', 'testPolytopeView'};
0040 testList.polytopeMeasure = {'polytope/test', 'testPolytopeMeasure'};
0041 testList.polytopeBugList = {'polytope/test', 'testPolytopeBugList'};
0042 testList.crystalCore = {'crystal/test', 'testCrystal'};
0043 testList.decompositionCore = {'decomposition/test', 'testDecompositionCore'};
0044 testList.distributionCore = {'distribution/test', 'testDistributionCore'};
0045 testList.basicTest = {...
0046 testList.polytopeCore, ...
0047 testList.polytopeConversion, ...
0048 testList.polytopeOperation, ...
0049 testList.polytopeView, ...
0050 testList.polytopeMeasure, ...
0051 testList.crystalCore, ...
0052 testList.decompositionCore, ...
0053 testList.distributionCore};
0054 testList.extraTest = {...
0055 testList.polytopeBugList};
0056
0057
0058 if ~exist('mode', 'var') || isempty(mode)
0059 mode = 'manual';
0060 end
0061 if ~exist('testCase', 'var') || isempty(testCase)
0062 testCase = 'basicTest';
0063 end
0064 if ~isfield(testList, testCase)
0065 error('elk:test:invalidCase', 'The specified test case does not exist, try ''basicTest''.');
0066 end
0067 result = 0;
0068
0069
0070 callLocation = pwd;
0071 myLocation = fileparts(mfilename('fullpath'));
0072 cd(myLocation);
0073 run ../../extern/mxunit/configMxUnit
0074
0075
0076 clc
0077
0078
0079 thisTestSet = testList.(testCase);
0080 if ischar(thisTestSet{1})
0081 thisTestSet = {thisTestSet};
0082 end
0083
0084 for iTestCase = 1:length(thisTestSet)
0085 thisFolder = fullfile(['..' filesep thisTestSet{iTestCase}{1}]);
0086 thisFile = thisTestSet{iTestCase}{2};
0087 thisLogFile = [thisTestSet{iTestCase}{2} '.log'];
0088
0089
0090 cd(thisFolder)
0091 switch mode
0092 case 'auto'
0093 thisResult = runtests(thisFile, '-verbose', ...
0094 '-logfile', thisLogFile);
0095 type(thisLogFile);
0096 case 'manual'
0097 thisResult = runtests(thisFile);
0098 disp(' ')
0099 disp('--------------------------------------------------------------------------');
0100 otherwise
0101 error('elk:test:invalidCase', ...
0102 'The specified test mode does not exist, try ''manual'' or ''auto''.');
0103 end
0104
0105 cd(myLocation);
0106
0107
0108 result = result + thisResult;
0109 end
0110
0111
0112
0113 warning OFF BACKTRACE
0114 warning('elk:searchPath', 'MATLAB search path was changed to use mxunit.');
0115 warning ON BACKTRACE
0116
0117 cd(callLocation)
0118
0119
0120 disp('');
0121 if result == length(thisTestSet)
0122 disp(['SUMMARY: PASSED (' num2str(result) ' out of ' ...
0123 num2str(length(thisTestSet)) ')']);
0124 else
0125 disp(['SUMMARY: FAILED (' num2str(result) ' out of ' ...
0126 num2str(length(thisTestSet)) ')']);
0127 error('elk:test:issuesFound', 'unit testing found issues (see above)');
0128 end
0129
0130
0131 if nargout == 0
0132 clear result;
0133 end
0134
0135 end