Mercurial > hg > ltpda
view testing/utp_1.1/utps/pest/utp_pest_setNames.m @ 49:0bcdf74587d1 database-connection-manager
Cleanup
author | Daniele Nicolodi <nicolodi@science.unitn.it> |
---|---|
date | Wed, 07 Dec 2011 17:24:36 +0100 |
parents | 409a22968d5e |
children |
line wrap: on
line source
% UTP_PEST_SETNAMES a set of UTPs for the pest/setNames method % % M Hewitson 06-08-08 % % $Id: utp_pest_setNames.m,v 1.4 2011/04/06 19:14:54 ingo Exp $ % % <MethodDescription> % % The setNames method of the pest class sets the names property. % % </MethodDescription> function results = utp_pest_setNames(varargin) % Check the inputs if nargin == 0 % Some keywords class = 'pest'; mthd = 'setNames'; prop = 'names'; disp('******************************************************'); disp(['**** Running UTPs for ' class '/' mthd]); disp('******************************************************'); % Test objects pe1 = pest([8, 9]); pe1.setName; pe2 = pest([1 2]); pe2.setName; pe3 = pe1; pev = [pe1, pe2, pe1]; pem = [pe1, pe2, pe1; pe1, pe2, pe1]; % Exception list for the UTPs: [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); % The setter method have different possibilities to set a property val1 = 'MyParamName'; val2 = {'MyParamName1', 'MyParamName2'}; val3 = plist(prop, 'MyParamName'); % Run the general tests results(1) = utp_genericSet_minfo(mthd, pe1, prop, @algoTests_minfo); % test getInfo call results(2) = utp_genericAnyShape(mthd, pev, val1, @algoTests); % test vector results(3) = utp_genericAnyShape(mthd, pev, val2, @algoTests); % test vector results(4) = utp_genericAnyShape(mthd, pev, val3, @algoTests); % test vector call with plist results(5) = utp_genericAnyShapeInternal(mthd, pev, val1, @algoTestsInternal); % test internal vector call results(6) = utp_genericAnyShape(mthd, pem, val1, @algoTests); % test matrix call results(7) = utp_genericAnyShape(mthd, pem, val3, @algoTests); % test matrix call with plist results(8) = utp_genericAnyShapeInternal(mthd, pem, val1, @algoTestsInternal); % test internal matrix call results(9) = utp_genericList(mthd, pe1, pe2, pe3, val1, @algoTests); % test list results(10) = utp_genericList(mthd, pe1, pe2, pe3, val3, @algoTests); % test list with plist results(11) = utp_genericList(mthd, pe1, pev, pem, val1, @algoTests); % test mixed shape of input objs results(12) = utp_genericHistory(mthd, pe1, val1, ple2); % test the history results(13) = utp_genericModify(mthd, pe1, val1, @algoTests, ple1); % test the modifier call results(14) = utp_genericOutput(mthd, pe1, pe2, val1, @algoTests, ple2); % test the outputs disp('Done.'); disp('******************************************************'); elseif nargin == 1 % Check for UTP functions if strcmp(varargin{1}, 'isutp') results = 1; else results = 0; end else error('### Incorrect inputs') end % Check that the default value un the PLIST function atest = algoTests_minfo(defVal) atest = true; % Check default value for the key 'names' if ~eq(defVal, []), atest = false; end end % Check that the property have the correct value function atest = algoTests(in, out, idx, value) atest = true; % Check that the input and output objects are the same except the % property 'names' and the history ple = plist('EXCEPTIONS', {'created', 'proctime', 'UUID', 'hist', prop}); if ~eq(in(idx), out(idx), ple), atest = false; end if ~eq(in(idx).hist, out(idx).hist.inhists), atest = false; end % Check that the parameter gets the correct value. if isa(value, 'plist') && value.nparams == 1 && value.isparam(prop) % The value was set with a plist. if ~isequal(out(idx).(prop), cellstr(value.find(prop))), atest = false; end else if ~isequal(out(idx).(prop), cellstr(value)'), atest = false; end end end % Check that the property have the correct value for an internal call function atest = algoTestsInternal(in, out, idx, value) atest = true; % Check that the input and output objects are the same except the % property 'names' and the history ple = plist('EXCEPTIONS', {'created', 'proctime', 'UUID', prop}); if ~eq(in(idx), out(idx), ple), atest = false; end % Check that the parameter gets the correct value. if ~isequal(out(idx).(prop), cellstr(value)), atest = false; end end end