Mercurial > hg > ltpda
view testing/utp_1.1/utps/pest/utp_pest_setYunits.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_SETYUNITS a set of UTPs for the pest/setYunits method % % M Hewitson 06-08-08 % % $Id: utp_pest_setYunits.m,v 1.4 2011/04/06 19:14:54 ingo Exp $ % % <MethodDescription> % % The setYunits method of the pest class sets the yunits property. % % </MethodDescription> function results = utp_pest_setYunits(varargin) % Check the inputs if nargin == 0 % Some keywords class = 'pest'; mthd = 'setYunits'; prop = 'yunits'; 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 = 'Hz^2 m^-2'; val2 = plist(prop, unit('Hz^2 m^-2')); val3 = {'kg', 'Hz'}; val4 = [unit('s'), unit('Hz')]; % 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 call with plist results(4) = utp_genericAnyShape(mthd, pev, val3, @algoTests); % test vector call results(5) = utp_genericAnyShape(mthd, pev, val4, @algoTests); % test vector call results(6) = utp_genericAnyShapeInternal(mthd, pev, val1, @algoTestsInternal); % test internal vector call results(7) = utp_genericAnyShape(mthd, pem, val1, @algoTests); % test matrix call results(8) = utp_genericAnyShape(mthd, pem, val2, @algoTests); % test matrix call with plist results(9) = utp_genericAnyShapeInternal(mthd, pem, val1, @algoTestsInternal); % test internal matrix call results(10) = utp_genericList(mthd, pe1, pe2, pe3, val1, @algoTests); % test list results(11) = utp_genericList(mthd, pe1, pe2, pe3, val2, @algoTests); % test list with plist results(12) = utp_genericList(mthd, pe1, pev, pem, val1, @algoTests); % test mixed shape of input objs results(13) = utp_genericHistory(mthd, pe1, val1, ple2); % test the history results(14) = utp_genericModify(mthd, pe1, val1, @algoTests, ple1); % test the modifier call results(15) = 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 'yunits' 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 'yunits' 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. val = value.find(prop); else val = value; end if ischar(val) val = unit(val); elseif iscell(val) val = unit(val{:}); end if ~eq(out(idx).(prop), val), atest = false; 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 'yunits' 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 ischar(value) value = unit(value); elseif iscell(value) value = unit(value{:}); end if ~isequal(out(idx).(prop), value), atest = false; end end end