test_ita_parse_arguments.m 1.23 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
function test_ita_parse_arguments()

% <ITA-Toolbox>
% This file is part of the ITA-Toolbox. Some rights reserved. 
% You can find the license for this m-file in the license.txt file in the ITA-Toolbox folder. 
% </ITA-Toolbox>


%% CHECK CASE SENSITIVITY OF SPELLING

parCell = {'testpar', 'testPar', 'TESTPAR', };
for iStructInput = 1:length(parCell)
    inStruct        = struct(parCell{iStructInput} , 1 );
    
    for iUserInput = 1: length(parCell)
%         try 
            [sArgs] = ita_parse_arguments(inStruct,{parCell{iUserInput}, 11 }); 
            fprintf('  struct field name: %s & userparname %s\n', parCell{iStructInput}, parCell{iUserInput} )
%         catch
%             error('struct field name: %s & userparname %s', parCell{iStructInput}, parCell{iUserInput} )
%         end
            if ~isequal(sArgs.(parCell{iStructInput}),11)
                error('wrong vaule')
            end
    end
end


% TODO:
% - Datentypen
% - 


34 35 36 37 38 39 40 41 42 43 44 45
%% test moving unknown options to second output
struct.testpar = 1;
struct.testpar2 = 2;

parCell = {'testpar', 2, 'testpar2', 4,'unknown', 6};

% this should give a warning
[sArgs] = ita_parse_arguments(struct,parCell); 

% this should not
[sArgs,unknownParams] = ita_parse_arguments(struct,parCell);