% This file runs the complete matRad test suite.
This is a script file.
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017 run(['..' filesep 'matRad_rc']);
0018
0019
0020 matRad_cfg = MatRad_Config.instance();
0021 matRad_cfg.setDefaultPropertiesForTesting();
0022
0023
0024 if strcmp(matRad_getEnvironment,'OCTAVE')
0025 warning('off','Octave:divide-by-zero');
0026 end
0027
0028 exampleScripts = {'../examples/matRad_example1_phantom.m',...
0029 '../examples/matRad_example2_photons.m',...
0030 '../examples/matRad_example3_photonsDAO.m',...
0031 '../examples/matRad_example4_photonsMC.m',...
0032 '../examples/matRad_example5_protons.m',...
0033 '../examples/matRad_example6_protonsNoise.m',...
0034 '../examples/matRad_example7_carbon.m',...
0035 '../matRad.m'};
0036
0037 testing_suffix = '_test';
0038 unitTestBixelWidth = 20;
0039
0040
0041 [folders,names,exts] = cellfun(@fileparts,exampleScripts,'UniformOutput',false);
0042 testScriptNames = strcat(names,testing_suffix);
0043 testScripts = cellfun(@fullfile,folders,strcat(testScriptNames,exts),'UniformOutput',false);
0044 status = cellfun(@copyfile,exampleScripts,testScripts);
0045
0046 matRad_unitTestTextManipulation(testScripts,'pln.propStf.bixelWidth',['pln.propStf.bixelWidth = ' num2str(unitTestBixelWidth)]);
0047 matRad_unitTestTextManipulation(testScripts,'display(','%%%%%%%%%%%%%%% REMOVED DISPLAY FOR TESTING %%%%%%%%%%%%%%');
0048
0049 errors = {};
0050
0051 for testIx = 1:length(testScriptNames)
0052 fprintf('Running Integration Test for ''%s''\n',names{testIx});
0053 try
0054 run(testScripts{testIx});
0055 clear ct cst pln stf dij resultGUI;
0056 delete(testScripts{testIx});
0057 catch ME
0058 [~,scriptName] = fileparts(testScripts{testIx});
0059 if matRad_cfg.isMatlab
0060 message = ME.getReport();
0061 else
0062 message = ME.message;
0063 end
0064 errMsg = sprintf('Experiencd an error during testing of %s. Error-Message:\n %s',scriptName,message);
0065 warning(errMsg);
0066 errors{end+1} = errMsg;
0067 end
0068 end
0069
0070
0071 if ~isempty(errors)
0072 error(strjoin(errors,'\n\n============================\n\n'));
0073 end
0074