matRad_runTests

Purpose ^

% This file runs the complete matRad test suite.

Synopsis ^

This is a script file.

Description ^

% This file runs the complete matRad test suite.

 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

 Copyright 2017 the matRad development team. 
 
 This file is part of the matRad project. It is subject to the license 
 terms in the LICENSE file found in the top-level directory of this 
 distribution and at https://github.com/e0404/matRad/LICENSES.txt. No part 
 of the matRad project, including this file, may be copied, modified, 
 propagated, or distributed except according to the terms contained in the 
 LICENSE file.

 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

Cross-reference information ^

This function calls: This function is called by:

Source code ^

0001 %% This file runs the complete matRad test suite.
0002 %
0003 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0004 %
0005 % Copyright 2017 the matRad development team.
0006 %
0007 % This file is part of the matRad project. It is subject to the license
0008 % terms in the LICENSE file found in the top-level directory of this
0009 % distribution and at https://github.com/e0404/matRad/LICENSES.txt. No part
0010 % of the matRad project, including this file, may be copied, modified,
0011 % propagated, or distributed except according to the terms contained in the
0012 % LICENSE file.
0013 %
0014 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0015 
0016 %% Set path
0017 run(['..' filesep 'matRad_rc']);
0018 
0019 %% Prepare settings for testing
0020 matRad_cfg = MatRad_Config.instance();
0021 matRad_cfg.setDefaultPropertiesForTesting();
0022 
0023 % supressing the inherent Ocatave warnings for division by zero
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 %Copy and manipulate all scripts
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 %Running tests
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; %Make sure the workspace is somewhat clean
0056         delete(testScripts{testIx}); %Delete after successful run
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 %Check if at least one script failed and report error
0071 if ~isempty(errors)
0072     error(strjoin(errors,'\n\n============================\n\n'));
0073 end
0074

| Generated by m2html © 2005